Skip to content

Accept cons pair for tcp connections. #34

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Add the following to your Emacs config to enable
(add-hook 'clojure-mode-hook #'inf-clojure-minor-mode)
```

`inf-clojure-program` is a custom variable that defines a program to run
or the tcp socket to connect to when starting `inf-clojure`. By default
this var is set to `lein repl`, which will start a repl via leiningen.
However, it is possible to use a cons pair like `("localhost" . 5555)` to
connect to a socket repl like the one provided with [planck](http://planck-repl.org/),
which can be started from the command line with `planck -n 5555`.

**Don't enable `inf-clojure-minor-mode` and `cider-mode` at the same
time. They have overlapping functionality and keybindings and the
result will be nothing short of havoc.**
Expand Down
11 changes: 8 additions & 3 deletions inf-clojure.el
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ The following commands are available:
#'inf-clojure-completion-at-point))

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

(defcustom inf-clojure-load-command "(clojure.core/load-file \"%s\")\n"
Expand Down Expand Up @@ -322,7 +325,9 @@ of `inf-clojure-program'). Runs the hooks from
(if (not (comint-check-proc "*inf-clojure*"))
;; run the new process in the project's root when in a project folder
(let ((default-directory (inf-clojure-project-root))
(cmdlist (split-string cmd)))
(cmdlist (if (consp cmd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing the related defcustom should be updated as well.

(list cmd)
(split-string cmd))))
(set-buffer (apply #'make-comint
"inf-clojure" (car cmdlist) nil (cdr cmdlist)))
(inf-clojure-mode)))
Expand Down