Skip to content

Commit eec15c4

Browse files
mahinshawbbatsov
authored andcommitted
Accept cons pair for tcp connections (#34)
1 parent aa81e31 commit eec15c4

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ Add the following to your Emacs config to enable
4646
(add-hook 'clojure-mode-hook #'inf-clojure-minor-mode)
4747
```
4848

49+
`inf-clojure-program` is a custom variable that defines a program to run
50+
or the tcp socket to connect to when starting `inf-clojure`. By default
51+
this var is set to `lein repl`, which will start a repl via leiningen.
52+
However, it is possible to use a cons pair like `("localhost" . 5555)` to
53+
connect to a socket repl like the one provided with [planck](http://planck-repl.org/),
54+
which can be started from the command line with `planck -n 5555`.
55+
4956
**Don't enable `inf-clojure-minor-mode` and `cider-mode` at the same
5057
time. They have overlapping functionality and keybindings and the
5158
result will be nothing short of havoc.**

inf-clojure.el

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ The following commands are available:
139139
#'inf-clojure-completion-at-point))
140140

141141
(defcustom inf-clojure-program "lein repl"
142-
"Program name for invoking an inferior Clojure in Inferior Clojure mode."
143-
:type 'string
142+
"Either a program name or a connection cons pair consisting of a host
143+
and port number (e.g. (\"localhost\" . 5555)), for invoking an inferior Clojure
144+
in Inferior Clojure mode."
145+
:type '(choice (string)
146+
(cons string integer))
144147
:group 'inf-clojure)
145148

146149
(defcustom inf-clojure-load-command "(clojure.core/load-file \"%s\")\n"
@@ -322,7 +325,9 @@ of `inf-clojure-program'). Runs the hooks from
322325
(if (not (comint-check-proc "*inf-clojure*"))
323326
;; run the new process in the project's root when in a project folder
324327
(let ((default-directory (inf-clojure-project-root))
325-
(cmdlist (split-string cmd)))
328+
(cmdlist (if (consp cmd)
329+
(list cmd)
330+
(split-string cmd))))
326331
(set-buffer (apply #'make-comint
327332
"inf-clojure" (car cmdlist) nil (cdr cmdlist)))
328333
(inf-clojure-mode)))

0 commit comments

Comments
 (0)