-
-
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
Inline and fix syntax table #559
Conversation
Define syntax table from scratch instead of inheriting from emacs-lisp-mode. The code taken from lisp-mode is refactored to use the cons cell range syntax of modify-syntax-entry instead of while loops.
Unlike other lisps, symbols like x' are syntatically valid in Clojure
Great changes!
I've been meaning to this for a very long time, so it's the right move. (see #270) You'll have to look into the build failures and add some changelog entry. |
Caused by leading quotes being detected as part of the symbol
And auto-indent some lines
642b1e8
to
0a75438
Compare
Fixed the emacs-25 build failure, I didn't realise string-trim's optional argument was a new feature in 26. The emacs-master failure was there in previous PRs and seems to be some unrelated checkdoc bug. I also just realised that this would introduce a breakage in the current |
I guess they do, so this shouldn't be a big problem. |
Thanks for tackling this! |
In Clojure single quotes
'
can be part of a symbol literal anywhere except the head, this is stated explicitly in https://clojure.org/reference/reader and recently confirmed by Alex Miller on the Clojurians Slack.Changing the syntax of
'
in the syntax table affects the output of functions like(thing-at-point 'symbol)
which currently does not treat quotes as part of the symbol. This in turn affectscider-symbol-at-point
and dependent functions likecider-doc
, which currently does not work on vars named eg.foo'
orhawai'i
I also took the liberty of inlining the definition of clojure-mode's syntax table rather than inheriting and overriding bits from
emacs-lisp-mode
(which in turn inherits fromlisp-mode
), making it simpler to understand it as a whole.Also added commas as whitespace to the syntax table, this helps with some edge cases where
[:space:]
is used in a font-lock regex.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!