Skip to content

Commit b246466

Browse files
committed
Add a command for refreshing the ClojureDocs cache
1 parent a131791 commit b246466

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* New configuration variable `cider-result-overlay-position` determining where debugger and inline eval result overlays should be displayed. Current options are 'at-eol and 'at-point.
88
* [#2606](https://github.com/clojure-emacs/cider/pull/2606): Defcustom `cider-path-translations` for translating paths from nREPL messages (useful where a file appears to be somewhere, but it's actually somewhere else).
99
* [#2698](https://github.com/clojure-emacs/cider/pull/2689): Infer figwheel builds automatically.
10+
* New command `cider-clojuredocs-refresh-cache`.
1011

1112
### Changes
1213

cider-clojuredocs.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
(cider-nrepl-send-sync-request)
4848
(nrepl-dict-get "clojuredocs")))
4949

50+
(defun cider-sync-request:clojuredocs-refresh ()
51+
"Refresh the ClojureDocs cache."
52+
(thread-first '("op" "clojuredocs-refresh-cache")
53+
(cider-nrepl-send-sync-request)
54+
(nrepl-dict-get "status")))
55+
5056
(defun cider-clojuredocs-replace-special (name)
5157
"Convert the dashes in NAME to a ClojureDocs friendly format.
5258
We need to handle \"?\", \".\", \"..\" and \"/\"."
@@ -81,6 +87,15 @@ opposite of what that option dictates."
8187
"ClojureDocs doc for"
8288
#'cider-clojuredocs-web-lookup))
8389

90+
;;;###autoload
91+
(defun cider-clojuredocs-refresh-cache ()
92+
"Refresh the ClojureDocs cache."
93+
(interactive)
94+
(let ((result (cider-sync-request:clojuredocs-refresh)))
95+
(if (member "ok" result)
96+
(message "ClojureDocs cache refreshed successfully")
97+
(message "An error occurred while trying to refresh the ClojureDocs cache"))))
98+
8499
(defun cider-create-clojuredocs-buffer (content)
85100
"Create a new ClojureDocs buffer with CONTENT."
86101
(with-current-buffer (cider-popup-buffer cider-clojuredocs-buffer t)

cider-doc.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@
8383
'("Documentation"
8484
["CiderDoc" cider-doc]
8585
["JavaDoc in browser" cider-javadoc]
86+
"--"
8687
["Clojuredocs" cider-clojuredocs]
8788
["Clojuredocs in browser" cider-clojuredocs-web]
89+
["Refresh ClojureDocs cache" cider-clojuredocs-refresh-cache]
90+
"--"
8891
["Search symbols" cider-apropos]
8992
["Search symbols & select" cider-apropos-select]
9093
["Search documentation" cider-apropos-documentation]

0 commit comments

Comments
 (0)