-
Notifications
You must be signed in to change notification settings - Fork 16
Add syntax table #14
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
Add syntax table #14
Conversation
How does anything use this syntax table? I get that this fix works and clojure-mode just defines it and nothing else. But what kind of magic is emacs doing to find it? |
I think at least one thing that might be affected is how The parse state it returns apparently contains:
Grepping for I think the function may be part of low level machinery that is used in more than a few places. But perhaps there is someone else who can give a better answer :) |
FWIW, I also made similar changes to Here is an example from emacs source on the emacs-29 branch. |
Thanks for the insight @sogaiu, the typescript-ts-mode link led me down the right path. So it will look for |
LOL, I totally misread your comment before. You made good use of an answer to a misunderstood question :) Nice detective work! |
This adds a syntax table to clojure-ts-mode, Emacs syntax tables are used to determine where words, symbols, and other syntactic constructs begin and end. This information is used by many Emacs facilities, (not just font locking).
I ran into a use case for it, while using cider.
Cider relies on clojure-mode.el
clojure-find-ns
which relies on(thing-at-point 'symbol)
to give you the full clojure symbol, in many of it's functionality.e.g. When Cider is sending sexp's to the nREPL it needs to determine which namespace that sexp should be executed under, and this boils down to a (thing-at-point 'symbol) call. Originally, I was getting 'namespace' not found, because at the top of my file
(ns foo.bar)
, (thing-at-point 'symbol) was being called by cider at the beginning of the symbol , but thing-at-point was returning 'foo instead of 'foo.bar leading to my sexps being evaluated under the wrong namespace. Some of the code for this can be found at:https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L2142
This PR simply adds a syntax table, i've confirmed thing-at-point behaves as expected now. The syntax table I copied verbatim from clojure-mode.el, so it'll be accurate.
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!