Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text, SublimeREPL, Clojure & Windows 8

I've got both Leiningen & Clojure working on Windows 8 separately from Sublime Text (e.g. I can get a repl working in Windows PowerShell).

My problem is that I can't get the SublimeREPL working in SublimeText (the REPL loads up but doesn't then do anything). Are there any simple traps that I might be missing or, failing that, are there a series of steps I could follow to troubleshoot?

like image 664
duncsoz Avatar asked Jan 20 '14 22:01

duncsoz


2 Answers

Please see this SublimeREPL issue for instructions on how I got a Clojure REPL to work, at least on XP (I haven't tried it on Win7 or 8 yet). Basically, I edited the menu file for Clojure, and changed the command from lein repl to lein trampoline run -m clojure.main, which for some reason did the trick. I also changed the path to $file so you can open up a REPL while your project.clj is the current tab in Sublime, and the REPL should inherit the project's settings.

For reference, the complete Packages/User/SublimeREPL/config/Clojure/Main.sublime-menu file (Packages is accessible via Preferences -> Browse Packages...) is as follows:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"caption": "Clojure",
                 "id": "Clojure",
                 "children":[
                    {"command": "repl_open",
                     "caption": "Clojure Trampoline",
                     "id": "repl_clojure",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "cmd": {"windows": ["lein.bat", "trampoline", "run", "-m", "clojure.main"],
                                "linux": ["lein", "repl"],
                                "osx":  ["lein", "repl"]},
                        "soft_quit": "\n(. System exit 0)\n",
                        "cwd": {"windows":"$file_path",
                                "linux": "$file_path",
                                "osx": "$file_path"},
                        "syntax": "Packages/Clojure/Clojure.tmLanguage",
                        "external_id": "clojure",
                        "extend_env": {"INSIDE_EMACS": "1"}
                        }
                    },
                    {"command": "clojure_auto_telnet_repl",
                     "id": "repl_clojure_telnet",
                     "caption": "Clojure-Telnet"}]}
            ]
        }]
    }
]
like image 187
MattDMo Avatar answered Oct 20 '22 23:10

MattDMo


I solved this problem with Git Bash Shell. I have used the shell script version of leiningen instead of lein.bat

This is the command I use:

["C:\\Program Files\\Git\\bin\\sh.exe", "-l", "--", "/d/lein.sh", "repl"]

assuming lein.sh is in d:\

lein trampoline command sometimes behaves differently from lein repl and could fail due to unknown reasons.

like image 44
kakarukeys Avatar answered Oct 21 '22 01:10

kakarukeys