From 5d0fce59c71f66e7d11469dc9264817d37f51028 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 17 Feb 2015 20:44:22 -0500 Subject: 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". --- rust-mode.el | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rust-mode.el b/rust-mode.el index 290dd6b..856ee5a 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -32,11 +32,6 @@ (modify-syntax-entry ?\" "\"" table) (modify-syntax-entry ?\\ "\\" table) - ;; mark _ as a word constituent so that identifiers - ;; such as xyz_type don't cause type to be highlighted - ;; as a keyword - (modify-syntax-entry ?_ "w" table) - ;; Comments (modify-syntax-entry ?/ ". 124b" table) (modify-syntax-entry ?* ". 23" table) @@ -335,10 +330,10 @@ (append `( ;; Keywords proper - (,(regexp-opt rust-mode-keywords 'words) . font-lock-keyword-face) + (,(regexp-opt rust-mode-keywords 'symbols) . font-lock-keyword-face) ;; Special types - (,(regexp-opt rust-special-types 'words) . font-lock-type-face) + (,(regexp-opt rust-special-types 'symbols) . font-lock-type-face) ;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]` (,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]")) -- cgit v1.3