]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fontification for else in macro body in rust-ts-mode
authorYuan Fu <casouri@gmail.com>
Thu, 2 May 2024 04:21:00 +0000 (21:21 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 6 May 2024 16:32:13 +0000 (18:32 +0200)
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Add a rule for else in macro body.  Also added the same rule for "in"
and "move" keyword, as they seems to have the same problem.

(cherry picked from commit 07c47ea002b4702285bbf467ec09c9b281eb19b7)

lisp/progmodes/rust-ts-mode.el

index 25f1df4a9f9e6034d5e781224d10b6403f24ea39..7bc05898d15640a85822244ac25a2dc3e397c369 100644 (file)
@@ -213,7 +213,11 @@ to be checked as its standard input."
 
    :language 'rust
    :feature 'keyword
-   `([,@rust-ts-mode--keywords] @font-lock-keyword-face)
+   `([,@rust-ts-mode--keywords] @font-lock-keyword-face
+     ;; If these keyword are in a macro body, they're marked as
+     ;; identifiers.
+     ((identifier) @font-lock-keyword-face
+      (:match ,(rx (or "else" "in" "move")) @font-lock-keyword-face)))
 
    :language 'rust
    :feature 'number