Skip to content

Commit de973bd

Browse files
Tianxiang Xiongbbatsov
authored andcommitted
Make filter-regex for cider-browse-spec-all optional
It's tedious to call `(cider-browse-spec-all "")` each time.
1 parent b7f79b1 commit de973bd

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cider-browse-spec.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,19 @@ a more user friendly representation of SPEC-FORM."
297297
(defun cider-browse-spec (spec)
298298
"Start a new navigation and browse to SPEC definition."
299299
(interactive (list (completing-read "Browse spec: "
300-
(cider-sync-request:spec-list "")
300+
(cider-sync-request:spec-list)
301301
nil nil
302302
(cider-symbol-at-point))))
303303
(cider-browse-spec--clear-nav-history)
304304
(cider-browse-spec--browse spec))
305305

306306

307307
;;;###autoload
308-
(defun cider-browse-spec-all (filter-regex)
308+
(defun cider-browse-spec-all (&optional filter-regex)
309309
"List all loaded specs in BUFFER filtered by FILTER-REGEX.
310-
If FILTER-REGEX is empty, list all specs in the registry."
310+
311+
Optional argument FILTER-REGEX is a regexp string matching spec names. The
312+
default value, \"\", matches all specs in the registry."
311313
(interactive (list (read-string "Filter regex: ")))
312314
(with-current-buffer (cider-popup-buffer cider-browse-spec-buffer t)
313315
(let ((specs (cider-sync-request:spec-list filter-regex)))
@@ -335,7 +337,7 @@ If FILTER-REGEX is empty, list all specs in the registry."
335337
(cider-browse-spec-all (cl-second (pop cider-browse-spec-navigation)))
336338
(cider-browse-spec--browse (pop cider-browse-spec-navigation))))
337339
(unless (cider-browse-spec--is-nav-searchp (cl-first cider-browse-spec-navigation))
338-
(cider-browse-spec-all ""))))
340+
(cider-browse-spec-all))))
339341

340342
(defun cider-browse-spec-handle-mouse (event)
341343
"Handle mouse click EVENT."

cider-client.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,9 @@ CONTEXT represents a completion context for compliment."
952952
nil
953953
eldoc)))
954954

955-
(defun cider-sync-request:spec-list (filter-regex)
955+
(defun cider-sync-request:spec-list (&optional filter-regex)
956956
"Get a list of the available specs in the registry."
957+
(setq filter-regex (or filter-regex ""))
957958
(thread-first `("op" "spec-list"
958959
"filter-regex" ,filter-regex)
959960
(cider-nrepl-send-sync-request)

0 commit comments

Comments
 (0)