emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode 7960c74 417/486: Do not allow subword-match when


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 7960c74 417/486: Do not allow subword-match when detecting built-in formatting macros
Date: Sat, 7 Aug 2021 09:26:05 -0400 (EDT)

branch: elpa/rust-mode
commit 7960c74d4f575fec7b0b435a86f8f07594f24f9f
Author: Dato Simó <dato@net.com.org.es>
Commit: Nathan Moreau <nathan.moreau@m4x.org>

    Do not allow subword-match when detecting built-in formatting macros
    
    Before this change, a user-created macro like ‘cprintln!’ would see the
    ‘println’ subword highlighted as a built-in macro, and the leading ‘c’
    left without color.
    
    After this commit, only full words will be recognized as built-ins, and
    ‘cprintln!’ is highlighted as a regular macro in full, not as a built-in.
    
    In addition, this commit fixes the same issue for the write! macro.
---
 rust-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust-mode.el b/rust-mode.el
index b912140..b361749 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -676,7 +676,7 @@ Returns nil if the point is not within a Rust string."
       1 font-lock-preprocessor-face keep)
 
      ;; Builtin formatting macros
-     (,(concat (rust-re-grab (concat (regexp-opt 
rust-builtin-formatting-macros) "!")) (concat rust-formatting-macro-opening-re 
"\\(?:" rust-start-of-string-re) "\\)?")
+     (,(concat (rust-re-grab (concat (rust-re-word (regexp-opt 
rust-builtin-formatting-macros)) "!")) (concat rust-formatting-macro-opening-re 
"\\(?:" rust-start-of-string-re) "\\)?")
       (1 'rust-builtin-formatting-macro-face)
       (rust-string-interpolation-matcher
        (rust-end-of-string)
@@ -684,7 +684,7 @@ Returns nil if the point is not within a Rust string."
        (0 'rust-string-interpolation-face t nil)))
 
      ;; write! macro
-     (,(concat (rust-re-grab "write\\(ln\\)?!") (concat 
rust-formatting-macro-opening-re "[[:space:]]*[^\"]+,[[:space:]]*" 
rust-start-of-string-re))
+     (,(concat (rust-re-grab (concat (rust-re-word "write\\(ln\\)?") "!")) 
(concat rust-formatting-macro-opening-re "[[:space:]]*[^\"]+,[[:space:]]*" 
rust-start-of-string-re))
       (1 'rust-builtin-formatting-macro-face)
       (rust-string-interpolation-matcher
        (rust-end-of-string)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]