Skip to content

Commit 3d6b97b

Browse files
xiongtxbbatsov
authored andcommitted
Support special forms for apropos and Grimoire
Add `apropos-special-form` button type Default to `clojure.core` ns for Grimoire; this is necessary for special forms, which do not have ns. Grimoire defaults to `clojure.core`.
1 parent 238c60c commit 3d6b97b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### New Features
66

7+
* [#2012](https://github.com/clojure-emacs/cider/pull/2007): Support special forms in `cider-apropos` and `cider-grimoire-lookup`.
78
* [#2007](https://github.com/clojure-emacs/cider/pull/2007): Fontify code blocks from `cider-grimoire` if possible.
89
* [#1990](https://github.com/clojure-emacs/cider/issues/1990): Add new customation variable `cider-save-files-on-cider-refresh` to allow auto-saving buffers when `cider-refresh` is called.
910
* Add new function `cider-load-all-files`, along with menu bar update.

cider-apropos.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ the symbol found by the apropos search as argument."
5454
:group 'cider
5555
:package-version '(cider . "0.13.0"))
5656

57+
(define-button-type 'apropos-special-form
58+
'apropos-label "Special form"
59+
'apropos-short-label "s"
60+
'face 'apropos-misc-button
61+
'help-echo "mouse-2, RET: Display more help on this special form"
62+
'follow-link t
63+
'action (lambda (button)
64+
(describe-function (button-get button 'apropos-symbol))))
65+
5766
(defun cider-apropos-doc (button)
5867
"Display documentation for the symbol represented at BUTTON."
5968
(cider-doc-lookup (button-get button 'apropos-symbol)))

cider-grimoire.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,13 @@ opposite of what that option dictates."
9191
(current-buffer)))
9292

9393
(defun cider-grimoire-lookup (symbol)
94-
"Look up the grimoire documentation for SYMBOL."
94+
"Look up the grimoire documentation for SYMBOL.
95+
96+
If SYMBOL is a special form, the clojure.core ns is used, as is
97+
Grimoire's convention."
9598
(if-let ((var-info (cider-var-info symbol)))
9699
(let ((name (nrepl-dict-get var-info "name"))
97-
(ns (nrepl-dict-get var-info "ns"))
100+
(ns (nrepl-dict-get var-info "ns" "clojure.core"))
98101
(url-request-method "GET")
99102
(url-request-extra-headers `(("Content-Type" . "text/plain"))))
100103
(url-retrieve (cider-grimoire-url name ns)

0 commit comments

Comments
 (0)