summaryrefslogtreecommitdiff
path: root/cider-apropos.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-03-26 12:29:37 +0200
committerBozhidar Batsov <bozhidar@batsov.com>2016-03-26 12:29:37 +0200
commitfc1be820559db6c6eacc67e7094214585d335195 (patch)
treef1f355262cfc692ba6d3b56487c85330562010ad /cider-apropos.el
parentac631ce074e85336b97dfc2bed612e93c05d61d9 (diff)
Make cider-apropos-select more flexible
Now you can select which command to apply to the symbol you've selected.
Diffstat (limited to 'cider-apropos.el')
-rw-r--r--cider-apropos.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/cider-apropos.el b/cider-apropos.el
index 6ad560d2..c930987d 100644
--- a/cider-apropos.el
+++ b/cider-apropos.el
@@ -130,6 +130,20 @@ sensitive."
(cider-ensure-op-supported "apropos")
(cider-apropos (read-string "Search for Clojure documentation (a regular expression): ") nil t))
+(defun cider-apropos-act-on-symbol (symbol)
+ "Apply selected action on SYMBOL."
+ (let ((action (completing-read (format "Choose action to apply to `%s`: " symbol)
+ '("display-doc"
+ "find-def"
+ "lookup-on-grimoire"
+ "quit"))))
+ (pcase action
+ ("display-doc" (cider-doc-lookup symbol))
+ ("find-def" (cider--find-var symbol))
+ ("lookup-on-grimoire" (cider-grimoire-lookup symbol))
+ ("quit" nil)
+ (_ (user-error "Unknown action `%s`" action)))))
+
;;;###autoload
(defun cider-apropos-select (query &optional ns docs-p privates-p case-sensitive-p)
"Similar to `cider-apropos', but presents the results in a completing read."
@@ -147,7 +161,7 @@ sensitive."
query ns docs-p privates-p case-sensitive-p))
(results (mapcar (lambda (r) (nrepl-dict-get r "name"))
(cider-sync-request:apropos query ns docs-p privates-p case-sensitive-p))))
- (cider-doc-lookup (completing-read (concat summary ": ") results))
+ (cider-apropos-act-on-symbol (completing-read (concat summary ": ") results))
(message "No apropos matches for %S" query)))
;;;###autoload