Search code examples
clojuresublimetext3sublimetextleiningensublimerepl

Prevent 'lein repl' in SublimeREPL from echoing the previous command


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.


Solution

  • Thanks to some help at the Sublime Text Forum, I got an answer: you simply need to put "suppress_echo": true in the Main.sublime-menu file where the Clojure menu options are defined. In this case, 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.