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

Show friendly error message if symbol is not found on ClojureDocs #3689

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

### Bugs fixed

- [#3689](https://github.com/clojure-emacs/cider/pull/3689): Fix `cider-clojuredocs-lookup` to show friendly error message if symbol is not found on ClojureDocs.
- [#3673](https://github.com/clojure-emacs/cider/pull/3673): Fix buggy `special-display-buffer-names` check.
- [#3659](https://github.com/clojure-emacs/cider/pull/3659): Fixes completions when using `flex`-like completion styles.
- [#3600](https://github.com/clojure-emacs/cider/pull/3600): Fix scittle jack-in when using `cider-jack-in-clj`.
Expand Down
18 changes: 10 additions & 8 deletions cider-clojuredocs.el
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,16 @@ 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)))
;; highlight the symbol in question in the docs buffer
(highlight-regexp
(regexp-quote
(or (cadr (split-string sym "/"))
sym))
'bold)))
(if-let ((docs (cider-sync-request:clojuredocs-lookup (cider-current-ns) sym)))
(progn
(pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs)))
;; highlight the symbol in question in the docs buffer
(highlight-regexp
(regexp-quote
(or (cadr (split-string sym "/"))
sym))
'bold))
(user-error "ClojureDocs documentation for %s is not found" sym)))

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