Sublime Forum

Prevent SublimeREPL Clojure REPL from echoing most recent command

#1

I posted this question on Stack Overflow as well, so if you want some rep feel free to answer there. Here it is in full:


I’m running Sublime Text 3 Build 3117 on both OS X 10.10.5 and Ubuntu 16.04. I just installed Leiningen 2.6.1 on both, and I’m starting to play around in SublimeREPL. I’m following the lein tutorial. Here is my project.clj, in case it matters:

(defproject my-stuff "0.1.0"
  :description "Leiningen Tutorial Project"
  :url "http://example.com/FIXME"
  :license {:name "MIT"
            :url "http://opensource.org/licenses/MIT"}
  :dependencies [[org.clojure/clojure "1.8.0"]]
  :main ^:skip-aot my-stuff.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}}
  :repl-options {
    ;; custom prompt
    prompt (fn [ns] (str "> " ))
  }
)

Now, when I run lein repl in the my-stuff directory from the command line and run an arbitrary command (I’ve been using (+ 1 2 3)), it prints out the answer nicely:

lein repl from command line

However, if I run lein repl from SublimeREPL with project.clj focused, and run the same command, it echoes the command before printing the return value:

lein repl in SublimeREPL

I’ve also created a lein trampoline run -m clojure.main command for SublimeREPL, and it doesn’t have the echoing problem:

lein trampoline

Basically, what I would like to do is be able to run a REPL using project.clj, but not have every command echoed before the output is printed. I can’t seem to figure out how to run a trampoline REPL in Sublime using project.clj, if that’s the best option. If there’s a different way, i.e., using lein repl, I just want to get rid of the command echo, and make it look similar to what appears when I run it from the command line.

0 Likes

#2

Have you tried "suppress_echo": true? That seems to be what was recommended here: https://github.com/wuub/SublimeREPL/issues/49

1 Like

#3

Awesome, that did it! I somehow missed that issue in my googling. Are you on Stack Overflow? Feel free to write up an answer if you are.

For those that come across this in the future, open Packages/SublimeREPL/config/Clojure/Main.sublime-menu, put a comma , after "extend_env": {"INSIDE_EMACS": "1"}, then on the next line put "suppress_echo": true and you’re all set.

0 Likes

#4

No, I’m not on Stack Overflow.

Also, FWIW, it appears that this can be set on an OS-specific basis as well - e.g.,

"suppress_echo": {"osx": true, "linux": true, "windows": false}
1 Like