Subject: [PATCH] sieve-mode.el: Keywords should be word delimited.

From: "Akinori MUSHA" <[email-masked]>
Date: Fri, 14 Dec 2012 00:03:13 +0900

In sieve-mode, font-lock keywords will wrongly match because the
regexp patterns are unaware of word boundaries.

For example, if you put an action command "notify", it is highlighted
as "not"+"if"+y.

Apply the following simple patch to fix that.

---
 lisp/gnus/ChangeLog     | 5 +++++
 lisp/gnus/sieve-mode.el | 9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 601ed0c..42b3e59 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-13  Akinori MUSHA  <[email-masked]>
+
+	* sieve-mode.el (sieve-font-lock-keywords): Keywords should be word
+	delimited.
+
 2012-12-06  Sam Steingold  <[email-masked]>
 
 	* gnus-start.el (gnus-before-resume-hook): Add.
diff --git a/lisp/gnus/sieve-mode.el b/lisp/gnus/sieve-mode.el
index f49f767..32abbfe 100644
--- a/lisp/gnus/sieve-mode.el
+++ b/lisp/gnus/sieve-mode.el
@@ -131,14 +131,17 @@
   (eval-when-compile
     (list
      ;; control commands
-     (cons (regexp-opt '("require" "if" "else" "elsif" "stop"))
+     (cons (regexp-opt '("require" "if" "else" "elsif" "stop")
+                       'words)
 	   'sieve-control-commands-face)
      ;; action commands
-     (cons (regexp-opt '("fileinto" "redirect" "reject" "keep" "discard"))
+     (cons (regexp-opt '("fileinto" "redirect" "reject" "keep" "discard")
+                       'words)
 	   'sieve-action-commands-face)
      ;; test commands
      (cons (regexp-opt '("address" "allof" "anyof" "exists" "false"
-			 "true" "header" "not" "size" "envelope"))
+			 "true" "header" "not" "size" "envelope")
+                       'words)
 	   'sieve-test-commands-face)
      (cons "\\Sw+:\\sw+"
 	   'sieve-tagged-arguments-face))))
-- 
1.8.0.1

-- 
Akinori MUSHA / http://akinori.org/