Skip to content

Commit 5aa9c15

Browse files
committed
Add clojure socket REPL command and tweak
1 parent b2224bc commit 5aa9c15

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

README.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,39 +103,65 @@ point. You can, however, change this behaviour by invoking such
103103
commands with a prefix argument. For instance: `C-u C-c C-v` will ask
104104
for the symbol you want to show the docstring for.
105105

106-
#### Starting and connecting to a socket server
106+
#### Starting and connecting to a socket REPL
107107

108-
For Leiningen, add the following option to your ~/.lein/profiles.clj or your project.clj:
108+
If you have the new [Clojure CLI tools][] installed you can use the `clojure` command:
109+
110+
_do not use `clj` because it adds readline support_
111+
112+
```shell
113+
clojure -J-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"
109114
```
110-
:jvm-opts ["-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl}"]
115+
116+
Then either `C-c M-c RET localhost RET 5555` from within Emacs or add the following to your `.dir-locals.el`:
117+
118+
```el
119+
((nil . ((inf-clojure-tools-deps-cmd . ("localhost" . 5555)))))
111120
```
112121

113-
Then run `lein repl` from within your project directory to start the
114-
REPL, and `C-c M-c RET localhost RET 5555` from within Emacs to
115-
connect, or add the following to your `.dir-locals.el`
122+
or the following to your [Emacs init file][]:
123+
124+
```el
125+
(setf inf-clojure-tools-deps-cmd '("localhost" . 5555)):
116126
```
117-
((nil . ((inf-clojure-lein-cmd . ("localhost" . 5555)))))
127+
128+
For Leiningen, add the following option to your `~/.lein/profiles.clj` or your `project.clj`:
129+
130+
```clojure
131+
:jvm-opts ["-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl}"]
118132
```
119-
or the following to your `.emacs`
133+
134+
Then run `lein repl` from within your project directory to start the REPL, and either `C-c M-c RET localhost RET 5555` from within Emacs or add the following to your `.dir-locals.el`:
135+
136+
```el
137+
((nil . ((inf-clojure-lein-cmd . ("localhost" . 5555)))))
120138
```
139+
140+
or the following to your [Emacs init file][]:
141+
142+
```el
121143
(setf inf-clojure-lein-cmd '("localhost" . 5555))
122144
```
123145

124-
For boot, export the environment variable BOOT_JVM_OPTIONS:
125-
```
146+
For boot, export the environment variable `BOOT_JVM_OPTIONS`:
147+
148+
```shell
126149
export BOOT_JVM_OPTIONS='-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"'
127150
```
151+
128152
or add the following to your `.dir-locals.el`:
129-
```
153+
154+
```el
130155
((nil . ((inf-clojure-boot-cmd . ("localhost" . 5555)))))
131156
```
132-
or the following to your `.emacs`
133-
```
157+
158+
or the following to your [Emacs init file][]:
159+
160+
```el
134161
(setf inf-clojure-boot-cmd '("localhost" . 5555))
135162
```
136163

137-
You can also start a socket server via the [Clojure CLI tools](https://clojure.org/guides/getting_started).
138-
Configuration options are described [here](https://dev.clojure.org/display/design/Socket+Server+REPL).
164+
The socket server REPL configuration options are described [here](https://dev.clojure.org/display/design/Socket+Server+REPL).
139165

140166
#### Caveats
141167

@@ -320,3 +346,5 @@ Distributed under the GNU General Public License; type <kbd>C-h C-c</kbd> to vie
320346
[contributors]: https://github.com/clojure-emacs/inf-clojure/contributors
321347
[melpa]: http://melpa.org
322348
[melpa stable]: http://stable.melpa.org
349+
[Emacs init file]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html
350+
[Clojure cli tools]: https://clojure.org/guides/getting_started

0 commit comments

Comments
 (0)