-
-
Notifications
You must be signed in to change notification settings - Fork 247
Namespace font-locking according to clojure.lang.LispReader #353
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
Conversation
@@ -352,6 +352,13 @@ Called by `imenu--generic-function'." | |||
(set-match-data (list def-beg def-end))))) | |||
(goto-char start))))) | |||
|
|||
(eval-when-compile | |||
;; See clojure.lang.LispReader definition and getMacro invocation(s) |
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.
Could you add a url link to the LispReader source here?
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 we're going to link I think we should link to a line in a specific revision, e.g. the tag for clojure 1.7. If just put a link to a line number in a file on master we might get in a situation where there's something else on that line or that the file itself has been moved/deleted.
Please see my improvements in cb62888. |
(defconst clojure-sym-1st-chars (concat clojure-sym-rest-chars "0-9") | ||
"A black list of chars a clojure symbol must not start with. See | ||
getMacro invocation: | ||
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L260 |
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.
This links to a function invocation, at least to me this line:
IFn macroFn = getMacro(ch);
doesn't shed much light on anything discussed in this PR.
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.
Well, basically I took a look at the for-loop https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L232 consuming the input string in order to see which chars can be a part of a clojure symbol and which chars delimit string boundaries, lists, vectors, special forms etc. From this point of view the line 260 (together with line 254) is the key point of the for-loop.
@expez your note about linking to a specific clojure version (1.7) was right. I'm gonna fix that too. |
Fix namespace alias font-locking for aliases containing non-letter charactes like $, 0-9, _, etc.
Looks good to me. |
Namespace font-locking according to clojure.lang.LispReader
Merged. Thanks again! |
Just for the protocol - the second commit had a commit message, that doesn't match our standards and should have been simply squashed into the first one. Anyways, didn't have time to take a look at this until just now. |
And a bit more feedback - I strongly prefer the usage of whitelists over blacklists as they tend to leave less probability for mistakes. The naming of the 3 constants is not exactly ideal either - one would hardly imagine those are blacklists. |
Sorry. The thing with the commits escaped me indeed. |
Sounds good. |
Agreed, but in this case a whitelist is rather impractical. Clojure symbols are like elisp symbols in the sense that almost anything is a valid symbol char (e.g., |
Fair enough. |
Yes I noticed that white vs. black list dissent too. Here I made a conscious decision "correctness before practicality". If authors of clojure.lang.LispReader decided for blacklist, so be it! I should follow their decision. An Emacs plugin is not the right place to question it.
???
|
@Malabarba thanx for the "Add whitespace to clojure--sym-forbidden-rest-chars" commit. That was a mistake! I realized that only a day ago. |
I'm quite fine with the naming changes Artur made. Variable names should convey meaning and the original names conveyed less meaning.
CONTRIBUTING.md |
Except the first two variables are not regexps (they lack the surrounding Anyway, let's not bikeshed this too much. I believe we are all happy with the current state, right? |
Yea. Sort of. Either way I started to work more on this regexp thing. I hope I'll sent you a PR withing next 2 or 3 weeks. |
That's a nit-picky remark... or(!) a fine demonstration of a sharp, bug-catching eye. I like that! I'll incorporate that in my PR. Thx Artur. |
Fix namespace alias font-locking for aliases containing non-letter
charactes like $, 0-9, _, etc.