Skip to content

Commit 2bcf576

Browse files
authored
Convert "See Also" text to buttons in *cider-clojuredocs* buffer (#3093)
I've also added highlights to the symbol in *cider-clojuredocs* buffer.
1 parent 1f763f8 commit 2bcf576

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cider-clojuredocs.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ opposite of what that option dictates."
121121
(insert "\n== See Also\n\n")
122122
(if-let ((see-alsos (nrepl-dict-get dict "see-alsos")))
123123
(dolist (see-also see-alsos)
124-
(insert (format "* %s\n" see-also)))
124+
(insert-text-button (format "* %s\n" see-also)
125+
'sym see-also
126+
'action (lambda (btn)
127+
(cider-clojuredocs-lookup (button-get btn 'sym)))
128+
'help-echo (format "Press Enter or middle click to jump to %s" see-also)))
125129
(insert "Not available\n"))
126130
(insert "\n== Examples\n\n")
127131
(if-let ((examples (nrepl-dict-get dict "examples")))
@@ -140,7 +144,8 @@ opposite of what that option dictates."
140144
(defun cider-clojuredocs-lookup (sym)
141145
"Look up the ClojureDocs documentation for SYM."
142146
(let ((docs (cider-sync-request:clojuredocs-lookup (cider-current-ns) sym)))
143-
(pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs)))))
147+
(pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs)))
148+
(highlight-regexp (car (last (split-string sym "/"))) 'bold)))
144149

145150
;;;###autoload
146151
(defun cider-clojuredocs (&optional arg)

0 commit comments

Comments
 (0)