Skip to content

[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

Merged

Conversation

goldsteinn
Copy link
Contributor

Previously something like <i8 123, i8 poison> would not properly
highlight the poison keyword at the end.

@goldsteinn goldsteinn requested a review from lukel97 July 3, 2024 15:44
…tors

Previously something like `<i8 123, i8 poison>` would not properly
highlight the `poison` keyword at the end.
@goldsteinn goldsteinn force-pushed the goldsteinn/emacs-highlight-vec-values branch from de02c29 to 95b04ff Compare July 3, 2024 16:04
Copy link
Contributor

@lukel97 lukel97 left a 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)
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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 \\|?

Copy link
Contributor

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

Copy link
Contributor Author

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also LGTM!

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@goldsteinn goldsteinn merged commit 8431170 into llvm:main Jul 4, 2024
7 checks passed
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
…tors (llvm#97594)

Previously something like `<i8 123, i8 poison>` would not properly
highlight the `poison` keyword at the end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants