diff options
author | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2015-12-23 11:35:44 +0200 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2015-12-23 11:35:44 +0200 |
commit | 4b5ffb7e593c755c7f7a44eb909994c781cdfb0a (patch) | |
tree | dfefe0b4451eaa78240c885654b01c22e3d4747d /cider-client.el | |
parent | c6b0c1e93b6e26890dd8c6e73ff446bf4b2d0ce0 (diff) | |
parent | 86f872f772ddce053c1808f4c30520b3425ddcb4 (diff) |
Merge pull request #1477 from fajpunk/check-major-mode-first
Check major mode first when choosing connection
Diffstat (limited to 'cider-client.el')
-rw-r--r-- | cider-client.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cider-client.el b/cider-client.el index 6cbe4c32..57457036 100644 --- a/cider-client.el +++ b/cider-client.el @@ -197,6 +197,14 @@ such a link cannot be established automatically." (cider-ensure-connected) (kill-local-variable 'cider-connections)) +(defun cider-connection-type-for-buffer () + "Return the matching connection type (clj or cljs) for the current buffer." + (cond + ((derived-mode-p 'clojurescript-mode) "cljs") + ((derived-mode-p 'clojure-mode) "clj") + (cider-repl-type) + (t "clj"))) + (defun cider-current-connection (&optional type) "Return the REPL buffer relevant for the current Clojure source buffer. A REPL is relevant if its `nrepl-project-dir' is compatible with the @@ -218,9 +226,7 @@ from the file extension." ;; Only one match, just return it. (car project-connections) ;; OW, find one matching the language of the current buffer. - (let ((type (or type cider-repl-type - (if (derived-mode-p 'clojurescript-mode) - "cljs" "clj")))) + (let ((type (or type (cider-connection-type-for-buffer)))) (or (seq-find (lambda (conn) (equal (cider--connection-type conn) type)) project-connections) |