-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening paren in first column of docstring results in incorrect highlighting, paredit failures #183
Comments
This is actually Emacs warning you about a bug in its own parser--zero-column parens in strings need to be escaped for the built-in |
If I am not mistaken, this is actually a duplicate of #140 which might be closed as well, if it's not fixable in clojure-mode. |
I asked around about this, and there seems to be a reasonable workaround:
Been happy with this in my |
@cemerick You could do |
@tsdh You mean, to make the setting local to Clojure buffers? I think I know what you mean by "major mode function". :-P That fact makes me not want to propose your suggestion as a change to clojure-mode, in addition to the default being what it's been forever. If someone with more understanding of emacs/emacs-lisp mode innards has some confidence that a buffer-local change is a good new default for clojure-mode, that'd be great. |
I thought the above snippet would just disable the warning, but it turns out it actually fixes the undesirable behaviour entirely. Bizzare default, but par for the course with Emacs. Looks like a great change to me; thanks @tsdh. |
@cemerick with "major mode function", I mean the function |
@tsdh Yeah, makes sense. I'll put together a PR to do this, and we'll see what the powers-that-be say. :-) |
A snippet that will provoke the problems:
The opening paren in the docstring being in the first column causes (AFAICT) later expressions to be incorrectly highlighted. Sometimes it's subtle (e.g. affecting only the color of later brackets or parens), but sometimes it's not, e.g. here, where entire expressions are highlighted as if they were strings:
https://pbs.twimg.com/media/BW75CHSCMAAoUun.png
Further, some paredit commands will fail following the docstring containing the paren, e.g. "Invalid context for command
paredit-wrap-sexp
", splice will fail and report "unspliceable string".Just moving the opening paren in the docstring fixes the problems.
Thanks to @tomfaulhaber for noticing the correlation with the open paren's column position.
The text was updated successfully, but these errors were encountered: