summaryrefslogtreecommitdiff
path: root/cider.el
diff options
context:
space:
mode:
authorVitalie Spinu <spinuvit@gmail.com>2018-07-31 00:11:46 +0200
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-07-31 07:58:19 +0300
commited5f7ad93bcef343c801a9f02a080b7004e0e950 (patch)
tree89baeabe1b1e38dc579a14113eaadda695b58154 /cider.el
parent797d9fd30c98f7bf5f2de0f2754427b7d8202278 (diff)
Provide meaningful default selection in cider-select-cljs-repl
.. and add history (cider--select-cljs-repl-history)
Diffstat (limited to 'cider.el')
-rw-r--r--cider.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/cider.el b/cider.el
index 11f1a3e8..bb733594 100644
--- a/cider.el
+++ b/cider.el
@@ -785,10 +785,14 @@ you're working on."
(make-obsolete-variable 'cider-cljs-boot-repl 'cider-default-cljs-repl "0.17")
(make-obsolete-variable 'cider-cljs-gradle-repl 'cider-default-cljs-repl "0.17")
-(defun cider-select-cljs-repl ()
- "Select the ClojureScript REPL to use with `cider-jack-in-cljs'."
+(defvar cider--select-cljs-repl-history nil)
+(defun cider-select-cljs-repl (&optional default)
+ "Select the ClojureScript REPL to use with `cider-jack-in-cljs'.
+DEFAULT is the default CLJS REPL to offer in completion."
(let ((repl-types (mapcar #'car cider-cljs-repl-types)))
- (intern (completing-read "Select ClojureScript REPL type: " repl-types))))
+ (intern (completing-read "Select ClojureScript REPL type: " repl-types
+ nil nil nil 'cider--select-cljs-repl-history
+ (or default (car cider--select-cljs-repl-history))))))
(defun cider-cljs-repl-form (repl-type)
"Get the cljs REPL form for REPL-TYPE."
@@ -1087,12 +1091,13 @@ non-nil, don't start if ClojureScript requirements are not met."
"Update :cljs-repl-type in PARAMS."
(with-current-buffer (or (plist-get params :--context-buffer)
(current-buffer))
- (let ((params (cider--update-do-prompt params)))
+ (let ((params (cider--update-do-prompt params))
+ (inferred-type (or (plist-get params :cljs-repl-type)
+ cider-default-cljs-repl)))
(plist-put params :cljs-repl-type
(if (plist-get params :do-prompt)
- (cider-select-cljs-repl)
- (or (plist-get params :cljs-repl-type)
- cider-default-cljs-repl
+ (cider-select-cljs-repl inferred-type)
+ (or inferred-type
(cider-select-cljs-repl)))))))
(defun cider--update-jack-in-cmd (params)