-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[emacs] More consistently highlight value keywords that appear in vectors #97594
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
[emacs] More consistently highlight value keywords that appear in vectors #97594
Conversation
…tors Previously something like `<i8 123, i8 poison>` would not properly highlight the `poison` keyword at the end.
de02c29
to
95b04ff
Compare
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.
LGTM
@@ -61,6 +61,8 @@ | |||
`(,(concat "\\<" llvm-mode-primitive-type-regexp "\\>") . font-lock-type-face) | |||
;; Integer literals | |||
'("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face) | |||
;; Values that can appear in a vec | |||
'("\\b\\(true\\|false\\|null\\|undef\\|poison\\|none\\)\\b" . font-lock-keyword-face) |
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 wonder if the 'words
paren argument to regexp-opt would also work? https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Functions.html#index-regexp_002dopt
`(,(regexp-opt '("true" "false" "null" "undef" "none" "poison") 'words) . font-lock-keyword-face
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.
Let me check.
BTW, first I tried (mapconcat 'identity '("true" "false" "null" "undef" "none" "poison") "//|")
for the list but that didn't work, any idea why?
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.
doesn't seem to work.
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.
BTW, first I tried
(mapconcat 'identity '("true" "false" "null" "undef" "none" "poison") "//|")
for the list but that didn't work, any idea why?
Did you mean \\|
?
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.
doesn't seem to work.
Ah well, was worth a shot
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.
Full code:
'((concat "\\b\\(" (mapconcat 'identity '("true" "false" "null" "undef" "none" "poison") "\\|") "\\)\\b") . font-lock-keyword-face)
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.
Also LGTM!
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.
Err that doesn't work, any idea why?
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.
No idea. Evaluating your snippet gives me "\\b\\(true\\|false\\|null\\|undef\\|none\\|poison\\)\\b"
which is the same as whats in this PR, but none and poison are swapped around?
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.
Yeah, I don't know either, cest la vie, ill merge this as is.
…tors (llvm#97594) Previously something like `<i8 123, i8 poison>` would not properly highlight the `poison` keyword at the end.
Previously something like
<i8 123, i8 poison>
would not properlyhighlight the
poison
keyword at the end.