diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-09-20 03:29:50 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-09-20 03:29:50 +0100 |
commit | 6473cd433fb8f49f316706ba4acd09bc68aa305e (patch) | |
tree | 3974009bb2a9210ee2fb76dfb4382a373f9b3be0 /cider-util.el | |
parent | e6876951b23e7a49192a5c4aa129700c782b59fe (diff) |
Move some prompting functions/vars to cider-util
Diffstat (limited to 'cider-util.el')
-rw-r--r-- | cider-util.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cider-util.el b/cider-util.el index 8f4b3995..55bcc404 100644 --- a/cider-util.el +++ b/cider-util.el @@ -70,6 +70,27 @@ Setting this to nil removes the fontification restriction." (let ((beg (save-excursion (beginning-of-defun) (point)))) (nth 4 (parse-partial-sexp beg (point))))) +(defcustom cider-prompt-for-symbol t + "Controls when to prompt for symbol when a command requires one. + +When non-nil, always prompt, and use the symbol at point as the default +value at the prompt. + +When nil, attempt to use the symbol at point for the command, and only +prompt if that throws an error." + :type '(choice (const :tag "always" t) + (const :tag "dwim" nil)) + :group 'cider + :package-version '(cider . "0.9.0")) + +(defun cider--should-prompt-for-symbol (&optional invert) + (if invert (not cider-prompt-for-symbol) cider-prompt-for-symbol)) + +(defun cider-prompt-for-symbol-function (&optional invert) + (if (cider--should-prompt-for-symbol invert) + #'cider-read-symbol-name + #'cider-try-symbol-at-point)) + ;;; Text properties (defun cider-maybe-intern (name) |