Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert "See Also" text to buttons in *cider-clojuredocs* buffer #3093

Merged
merged 5 commits into from
Dec 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cider-clojuredocs.el
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ opposite of what that option dictates."
(insert "\n== See Also\n\n")
(if-let ((see-alsos (nrepl-dict-get dict "see-alsos")))
(dolist (see-also see-alsos)
(insert (format "* %s\n" see-also)))
(insert-text-button (format "* %s\n" see-also)
tongjie-chen marked this conversation as resolved.
Show resolved Hide resolved
'sym see-also
'action (lambda (btn)
(cider-clojuredocs-lookup (button-get btn 'sym)))
'help-echo (format "Press Enter or middle click to jump to %s" see-also)))
(insert "Not available\n"))
(insert "\n== Examples\n\n")
(if-let ((examples (nrepl-dict-get dict "examples")))
Expand All @@ -140,7 +144,8 @@ opposite of what that option dictates."
(defun cider-clojuredocs-lookup (sym)
"Look up the ClojureDocs documentation for SYM."
(let ((docs (cider-sync-request:clojuredocs-lookup (cider-current-ns) sym)))
(pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs)))))
(pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs)))
(highlight-regexp (car (last (split-string sym "/"))) 'bold)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unrelated to the button to me. Also if you know that split-string returns just two elements you can use directly cadr or nth.


;;;###autoload
(defun cider-clojuredocs (&optional arg)
Expand Down