Skip to content

Commit

Permalink
[#1217] Add a command for associating projects with connections
Browse files Browse the repository at this point in the history
This command should mostly be used with connections created using
`cider-connect`.
  • Loading branch information
bbatsov committed Aug 10, 2015
1 parent b1a7b1f commit b306117
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* [#1217](https://github.com/clojure-emacs/cider/issues/1217): Add new command `cider-assoc-project-with-connection` to associate a project directory with a connection.
* [#1248](https://github.com/clojure-emacs/cider/pull/1248): Add <kbd>TAB</kbd> and <kbd>RET</kbd> keys to the test-report buffer.
* [#1245](https://github.com/clojure-emacs/cider/pull/1245): New variable, `cider-ovelays-use-font-lock` controls whether results overlay should be font-locked or just use a single face.
* [#1235](https://github.com/clojure-emacs/cider/pull/1235): Add support for syntax-quoted forms to the debugger.
Expand Down
12 changes: 12 additions & 0 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,18 @@ is ambiguity, therefore nil is returned."
(file-name-directory buffer-file-name)
default-directory))

(defun cider-assoc-project-with-connection ()
"Associate a Clojure project with an nREPL connection.
Useful for connections created using `cider-connect', as for them
such a link cannot be established automatically."
(interactive)
(let ((conn-buf (completing-read "Connection: " (nrepl-connection-buffers)))
(project-dir (read-directory-name "Project: " nil (clojure-project-dir))))
(when conn-buf
(with-current-buffer conn-buf
(setq nrepl-project-dir project-dir)))))

(defun cider-set-relevant-connection (&optional do-prompt)
"Try to set the current REPL buffer based on the the current Clojure source buffer.
If succesful, return the new connection buffer.
Expand Down

0 comments on commit b306117

Please sign in to comment.