Skip to content

Commit 5d0fce5

Browse files
Roy Crihfieldpnkfelix
authored andcommitted
Fix word and symbol syntax distinction
By passing 'symbols as 2nd argument to regexp-opt, keywords will not be erroneously matched inside symbols. This obviates changing the syntax of `_' to "w".
1 parent 493cc99 commit 5d0fce5

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

rust-mode.el

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
(modify-syntax-entry ?\" "\"" table)
3333
(modify-syntax-entry ?\\ "\\" table)
3434

35-
;; mark _ as a word constituent so that identifiers
36-
;; such as xyz_type don't cause type to be highlighted
37-
;; as a keyword
38-
(modify-syntax-entry ?_ "w" table)
39-
4035
;; Comments
4136
(modify-syntax-entry ?/ ". 124b" table)
4237
(modify-syntax-entry ?* ". 23" table)
@@ -335,10 +330,10 @@
335330
(append
336331
`(
337332
;; Keywords proper
338-
(,(regexp-opt rust-mode-keywords 'words) . font-lock-keyword-face)
333+
(,(regexp-opt rust-mode-keywords 'symbols) . font-lock-keyword-face)
339334

340335
;; Special types
341-
(,(regexp-opt rust-special-types 'words) . font-lock-type-face)
336+
(,(regexp-opt rust-special-types 'symbols) . font-lock-type-face)
342337

343338
;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
344339
(,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))

0 commit comments

Comments
 (0)