-
-
Notifications
You must be signed in to change notification settings - Fork 247
Fix imenu with Clojure code in string or comment #638
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Friendly ping. |
Can you push again? I see something was broken with the CI back then and I guess that's why I didn't review this PR. |
@@ -776,7 +776,8 @@ Called by `imenu--generic-function'." | |||
(let (found? | |||
(deftype (match-string 2)) | |||
(start (point))) | |||
(down-list) | |||
(ignore-errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess some comment here would be useful, otherwise it's really hard to tell why this error needs to be ignored. I'm also a bit worried this might suppress actual errors and complicate the debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked a bit more into it why I didn't happen before and nobody noticed.
The change to down-list came only in May with this: https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0b3b295776ce723885c9997ab26d57314db2a5df
I guess a better workaround would be to wrap it in
unless (ppss-comment-or-string-start (syntax-ppss))
instead of ignore-errors
,
but ppss-comment-or-string-start
is only available since Emacs 27 and clojure-mode
is marked to support Emacs 25+.
I updated the commit message with this info and added a short comment.
Happy to rephrase it or change something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ppss-comment-or-string-start
is not complex I guess we can just copy it and inline it.
11261f0
to
83c4103
Compare
CircleCI still red because it couldn't find a usable config.yml |
Ah, CircleCI is killing me these days... Let me try resetting the build token once again. @vemv (or anyone else) - if someone has better ideas what to do about this build issue let me know. |
@dakra You can try pushing again to see if now the CI will work. I plan to cut a new release soon and it'd be nice for this to make it there. |
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". This user-error in `down-list` got introduced 2022-05-06 with https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0b3b295776ce723885c9997ab26d57314db2a5df The `when ignore-errors` could be replaced with `unless (ppss-comment-or-string-start (syntax-ppss))` once the minimum requirement for clojure-mode is Emacs 27.
@bbatsov done. but CircleCI instantly failed again :/ |
@vemv Any idea what's wrong with CircleCI these days? I'm getting progressively more frustrated with it, given the recent OAuth issues that happened for no apparent reason. |
Ignore error that's thrown from
down-list
when calledwith point inside a string or comment.
E.g. with code like:
clojure-match-next-def
callsdown-list
with point insidethe string and
down-list
will throw an user-error with"This command doesn't work in strings or comments".
Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):
M-x checkdoc
and fixed any warnings in the code you've written.Thanks!