From fca57b3aee015b64a7c926812476cb916700ef56 Mon Sep 17 00:00:00 2001 From: Tom Jakubowski Date: Wed, 11 Jun 2014 04:04:00 -0700 Subject: [PATCH 1/2] emacs: do not highlight `#foo]` as an attribute part of #14347 --- src/etc/emacs/rust-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index 175592d792bbf..f5a3fb92cb953 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -213,7 +213,7 @@ (,(regexp-opt rust-special-types 'words) . font-lock-type-face) ;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` - (,(rust-re-grab (concat "#\\!?[" rust-re-ident "[^]]*\\]")) + (,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]")) 1 font-lock-preprocessor-face) ;; Syntax extension invocations like `foo!`, highlight including the ! From e5baf1d94a6c2c41fa4307c4dd3105afe5924a71 Mon Sep 17 00:00:00 2001 From: Tom Jakubowski Date: Wed, 11 Jun 2014 05:06:51 -0700 Subject: [PATCH 2/2] emacs: highlight `#[foo = "bar"]` attributes Setting `OVERRIDE` to `t` overrides the conflicting highlight Emacs places on string literals. Fix #14347 --- src/etc/emacs/rust-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index f5a3fb92cb953..bec78302f05b6 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -212,9 +212,9 @@ ;; Special types (,(regexp-opt rust-special-types 'words) . font-lock-type-face) - ;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` + ;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]` (,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]")) - 1 font-lock-preprocessor-face) + 1 font-lock-preprocessor-face t) ;; Syntax extension invocations like `foo!`, highlight including the ! (,(concat (rust-re-grab (concat rust-re-ident "!")) "[({[:space:][]")