From 605d409d882e3576f9847fafa06bbe2ee6053086 Mon Sep 17 00:00:00 2001 From: Kato Muso Date: Thu, 30 May 2024 12:52:31 +0000 Subject: [PATCH] Show error message if symbol is not found on ClojureDocs (#3689) --- CHANGELOG.md | 1 + cider-clojuredocs.el | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93429a3c7..12cbff8c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/cider-clojuredocs.el b/cider-clojuredocs.el index 1c7af97c4..50e7620a7 100644 --- a/cider-clojuredocs.el +++ b/cider-clojuredocs.el @@ -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)