Skip to content
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
10 changes: 4 additions & 6 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,14 @@ you'd like to use the default Emacs behavior use
:group 'cider-repl)

(defcustom cider-lein-command
"lein"
(or (executable-find "lein")
(executable-find "lein.bat"))
"The command used to execute leiningen 2.x."
:type 'string
:group 'cider-repl)

(defcustom cider-server-command
(if (or (locate-file cider-lein-command exec-path)
(locate-file (format "%s.bat" cider-lein-command) exec-path))
(format "%s repl :headless" cider-lein-command)
(format "echo \"%s repl :headless\" | eval $SHELL -l" cider-lein-command))
(defcustom cider-lein-parameters
"repl :headless"
"The command used to start the nREPL via command `cider-jack-in'.
For a remote nREPL server lein must be in your PATH. The remote
proc is launched via sh rather than bash, so it might be necessary
Expand Down
55 changes: 29 additions & 26 deletions cider.el
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,35 @@ If PROMPT-PROJECT is t, then prompt for the project for which to
start the server."
(interactive "P")
(setq cider-current-clojure-buffer (current-buffer))
(let* ((project (when prompt-project
(read-directory-name "Project: ")))
(project-dir (nrepl-project-directory-for
(or project (nrepl-current-dir)))))
(when (nrepl-check-for-repl-buffer nil project-dir)
(let* ((nrepl-project-dir project-dir)
(cmd (if project
(format "cd %s && %s" project cider-server-command)
cider-server-command))
(default-directory (or project-dir default-directory))
(nrepl-buffer-name (generate-new-buffer-name
(nrepl-server-buffer-name)))
(process
(progn
;; the buffer has to be created before the proc:
(get-buffer-create nrepl-buffer-name)
(start-file-process-shell-command
"nrepl-server"
nrepl-buffer-name
cmd))))
(set-process-filter process 'nrepl-server-filter)
(set-process-sentinel process 'nrepl-server-sentinel)
(set-process-coding-system process 'utf-8-unix 'utf-8-unix)
(with-current-buffer (process-buffer process)
(setq nrepl-project-dir project-dir))
(message "Starting nREPL server...")))))
(if cider-lein-command
(let* ((project (when prompt-project
(read-directory-name "Project: ")))
(project-dir (nrepl-project-directory-for
(or project (nrepl-current-dir))))
(server-command (if prompt-project
(read-string (format "Server command: %s " cider-lein-command) cider-lein-parameters)
cider-lein-parameters)))
(when (nrepl-check-for-repl-buffer nil project-dir)
(let* ((nrepl-project-dir project-dir)
(cmd (format "cd %s && %s %s" (or project ".") cider-lein-command cider-lein-parameters))
(default-directory (or project-dir default-directory))
(nrepl-buffer-name (generate-new-buffer-name
(nrepl-server-buffer-name)))
(process
(progn
;; the buffer has to be created before the proc:
(get-buffer-create nrepl-buffer-name)
(start-file-process-shell-command
"nrepl-server"
nrepl-buffer-name
cmd))))
(set-process-filter process 'nrepl-server-filter)
(set-process-sentinel process 'nrepl-server-sentinel)
(set-process-coding-system process 'utf-8-unix 'utf-8-unix)
(with-current-buffer (process-buffer process)
(setq nrepl-project-dir project-dir))
(message "Starting nREPL server..."))))
(message "The lein executable isn't on your exec-path or set absolutely as cider-lein-command")))

(defun cider-known-endpoint-candidates ()
"Known endpoint candidates for establishing an nREPL connection.
Expand Down