diff options
author | Bozhidar Batsov <bozhidar@batsov.com> | 2018-06-24 09:08:52 +0300 |
---|---|---|
committer | Bozhidar Batsov <bozhidar@batsov.com> | 2018-06-24 09:08:52 +0300 |
commit | c9153e2061361d815ef7dcaf31b28c91e54cc660 (patch) | |
tree | f296dc3aa3ea34bca095f425e87e56cc5492e112 /cider-interaction.el | |
parent | fb27fd69486f5892fbd13b17d8ab730697638fac (diff) |
[#2203] Move cider-read-from-minibuffer to cider-common.el
Diffstat (limited to 'cider-interaction.el')
-rw-r--r-- | cider-interaction.el | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/cider-interaction.el b/cider-interaction.el index e3695880..f44f55b5 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -161,48 +161,10 @@ If t, save the file without confirmation." (defconst cider-latest-clojure-version "1.8.0" "Latest supported version of Clojure.") -;;; Minibuffer -(defvar cider-minibuffer-history '() - "History list of expressions read from the minibuffer.") - -(defvar cider-minibuffer-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-map) - (define-key map (kbd "TAB") #'complete-symbol) - (define-key map (kbd "M-TAB") #'complete-symbol) - map) - "Minibuffer keymap used for reading Clojure expressions.") - (defvar-local cider-connection-created-with 'jack-in "Save how the connection was created. Its value can be either 'jack-in or 'connect.") -(defun cider-read-from-minibuffer (prompt &optional value) - "Read a string from the minibuffer, prompting with PROMPT. -If VALUE is non-nil, it is inserted into the minibuffer as initial-input. -PROMPT need not end with \": \". If it doesn't, VALUE is displayed on the -prompt as a default value (used if the user doesn't type anything) and is -not used as initial input (input is left empty)." - (minibuffer-with-setup-hook - (lambda () - (set-syntax-table clojure-mode-syntax-table) - (add-hook 'completion-at-point-functions - #'cider-complete-at-point nil t) - (setq-local eldoc-documentation-function #'cider-eldoc) - (run-hooks 'eval-expression-minibuffer-setup-hook)) - (let* ((has-colon (string-match ": \\'" prompt)) - (input (read-from-minibuffer (cond - (has-colon prompt) - (value (format "%s (default %s): " prompt value)) - (t (format "%s: " prompt))) - (when has-colon value) ; initial-input - cider-minibuffer-map nil - 'cider-minibuffer-history - (unless has-colon value)))) ; default-value - (if (and (equal input "") value (not has-colon)) - value - input)))) - ;;; Utilities |