Skip to content

Commit

Permalink
[Fix #1563] Handle invalid regular expressions in apropos
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Mar 19, 2016
1 parent b2c4efd commit c4ae3e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bugs fixed

* [#1599](https://github.com/clojure-emacs/cider/pull/1599): Don't error when test makes 0 assertions.
* [#1563](https://github.com/clojure-emacs/cider/issues/1563): Handle invalid regular expressions in apropos.

### New Features

Expand Down
22 changes: 12 additions & 10 deletions cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -789,16 +789,18 @@ If CALLBACK is nil, use `cider-load-file-handler'."
"Send \"apropos\" request for regexp QUERY.
Optional arguments include SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P."
(thread-first `("op" "apropos"
"session" ,(cider-current-session)
"ns" ,(cider-current-ns)
"query" ,query
,@(when search-ns `("search-ns" ,search-ns))
,@(when docs-p '("docs?" "t"))
,@(when privates-p '("privates?" "t"))
,@(when case-sensitive-p '("case-sensitive?" "t")))
(cider-nrepl-send-sync-request)
(nrepl-dict-get "apropos-matches")))
(let ((response (cider-nrepl-send-sync-request
`("op" "apropos"
"session" ,(cider-current-session)
"ns" ,(cider-current-ns)
"query" ,query
,@(when search-ns `("search-ns" ,search-ns))
,@(when docs-p '("docs?" "t"))
,@(when privates-p '("privates?" "t"))
,@(when case-sensitive-p '("case-sensitive?" "t"))))))
(if (member "apropos-regexp-error" (nrepl-dict-get response "status"))
(user-error "Invalid regexp: %s" (nrepl-dict-get response "error-msg"))
(nrepl-dict-get response "apropos-matches"))))

(defun cider-sync-request:classpath ()
"Return a list of classpath entries."
Expand Down

0 comments on commit c4ae3e5

Please sign in to comment.