Skip to content

Commit 1e8adcd

Browse files
committed
Fix imenu with Clojure code in string or comment
Ignore error that's thrown from `down-list` when called with point inside a string or comment. E.g. with code like: ``` (defn foo [] (let [a " (defn b [_] (bar {:bla \"bla\"}))"])) ``` `clojure-match-next-def` calls `down-list` with point inside the string and `down-list` will throw an user-error with "This command doesn't work in strings or comments".
1 parent 414157c commit 1e8adcd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
* [#581](https://github.com/clojure-emacs/clojure-mode/issues/581): Fix font locking not working for keywords starting with a number.
1212
* [#377](https://github.com/clojure-emacs/clojure-mode/issues/377): Fix everything starting with the prefix 'def' being highlighted as a definition form. Now definition forms are enumerated explicitly in the font-locking code, like all other forms.
13+
* [#638](https://github.com/clojure-emacs/clojure-mode/pull/638): Fix imenu with Clojure code in string or comment
1314

1415
## 5.15.1 (2022-07-30)
1516

Diff for: clojure-mode.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,8 @@ Called by `imenu--generic-function'."
776776
(let (found?
777777
(deftype (match-string 2))
778778
(start (point)))
779-
(down-list)
779+
(ignore-errors
780+
(down-list))
780781
(forward-sexp)
781782
(while (not found?)
782783
(ignore-errors

0 commit comments

Comments
 (0)