[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 5e77aed 191/486: Correcting highlighting of capi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 5e77aed 191/486: Correcting highlighting of capitals in function names. |
Date: |
Sat, 7 Aug 2021 09:25:16 -0400 (EDT) |
branch: elpa/rust-mode
commit 5e77aedb27761d770e7e1a3b37875d3a4b0e932f
Author: Wilfred Hughes <me@wilfred.me.uk>
Commit: Wilfred Hughes <me@wilfred.me.uk>
Correcting highlighting of capitals in function names.
Previously, code of the form:
fn foo_Bar () {}
would be incorrectly highlighted, because the regex matched on word
boundaries rather than symbol boundaries. Test added.
---
rust-mode-tests.el | 6 ++++++
rust-mode.el | 9 ++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 8f25f06..e621f82 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -979,6 +979,12 @@ list of substrings of `STR' each followed by its face."
'("'\"'" font-lock-string-face
"let" font-lock-keyword-face)))
+(ert-deftest font-lock-fn-contains-capital ()
+ (rust-test-font-lock
+ "fn foo_Bar() {}"
+ '("fn" font-lock-keyword-face
+ "foo_Bar" font-lock-function-name-face)))
+
(ert-deftest font-lock-single-quote-character-literal ()
(rust-test-font-lock
"fn main() { let ch = '\\''; }"
diff --git a/rust-mode.el b/rust-mode.el
index a97e2eb..7de82bf 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -359,11 +359,14 @@
"bool"
"str" "char"))
-(defconst rust-re-CamelCase "[[:upper:]][[:word:][:multibyte:]_[:digit:]]*")
+(defconst rust-re-type-or-constructor
+ (rx symbol-start
+ (group upper (0+ (any word nonascii digit "_")))
+ symbol-end))
+
(defconst rust-re-pre-expression-operators "[-=!%&*/:<>[{(|.^;}]")
(defun rust-re-word (inner) (concat "\\<" inner "\\>"))
(defun rust-re-grab (inner) (concat "\\(" inner "\\)"))
-(defun rust-re-grabword (inner) (rust-re-grab (rust-re-word inner)))
(defun rust-re-item-def (itype)
(concat (rust-re-word itype) "[[:space:]]+" (rust-re-grab rust-re-ident)))
@@ -400,7 +403,7 @@
(,(concat "'" (rust-re-grab rust-re-ident) "[^']") 1
font-lock-variable-name-face)
;; CamelCase Means Type Or Constructor
- (,(rust-re-grabword rust-re-CamelCase) 1 font-lock-type-face)
+ (,rust-re-type-or-constructor 1 font-lock-type-face)
)
;; Item definitions
- [nongnu] elpa/rust-mode 3878cc6 107/486: Allow user to override which emacs is used in run_rust_emacs_tests.sh, (continued)
- [nongnu] elpa/rust-mode 3878cc6 107/486: Allow user to override which emacs is used in run_rust_emacs_tests.sh, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6b57bbf 117/486: Make features (and their tests) work on emacs 23, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4d633fc 125/486: Merge pull request #32 from MicahChalmer/raw-string-handling, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8d99bf8 126/486: Merge pull request #31 from pnkfelix/more-robust-test-driver, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e16c37c 161/486: Remove Marmalade from the README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee171df 172/486: test $EMACS directly rather than using "which", ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d1ed015 173/486: Distinguish face for doc-comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c9c7871 179/486: Merge pull request #79 from MicahChalmer/angle-bracket-madness, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee564d5 185/486: Merge pull request #85 from talchas/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 99b128c 187/486: Fix slowness in angle bracket matching, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5e77aed 191/486: Correcting highlighting of capitals in function names.,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 5e51aaa 194/486: Merge pull request #69 from tromey/safe-local-variables, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 012537b 195/486: remove byte-compiler warnings and prevent future ones, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 866df37 196/486: make rust-mode use lexical binding, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6252cf1 217/486: Fix indentation of closing delimiters, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode dd6d417 215/486: Fix type annotations incorrectly highlighted as modules., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 86d636a 223/486: Remove duplicate keywords, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b1cca0f 222/486: Merge pull request #72 from birkenfeld/builtin-face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 061e6d8 214/486: Merge pull request #109 from mrBliss/highlight-unsafe, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 86c55b1 220/486: Integrate rustfmt support, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode beec95a 231/486: Allow disabling rustfmt with a dir-local/file-local variable, ELPA Syncer, 2021/08/07