bug#81644: sieve-mode: highlight imap4flags keywords

Stéphane Blondon <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <CAOy+up7nwk_KkY=qm3EuoL5BpVjaHUxp3mLJ7YJMsTZ0=JdmTw@mail.gmail.com>
Package: emacs
Version: 32.0.50
Tags: patch

Hello,

Emacs has built in syntax highlighting for sieve email filtering.
The RFC 5232 adds imap4flags ('setflag', 'addflag', 'removeflag' and 'hasflag').

see RFC: https://datatracker.ietf.org/doc/rfc5232/

These keywords are managed by dovecot (at least 'setflag', 'addflag'
in the examples:
https://doc.dovecot.org/main/howto/sieve.html#flagging-or-highlighting-your-mail

The patch adds the highlight for the 4 keywords. It's not needed for
':flags' because it already works.
It's based on the emacs git source code.
sieve_imap4flags.diff (text/x-patch, 903 B)
diff --git i/lisp/net/sieve-mode.el w/lisp/net/sieve-mode.el
index 54bccc179aa..908452b3f76 100644
--- i/lisp/net/sieve-mode.el
+++ w/lisp/net/sieve-mode.el
@@ -85,12 +85,14 @@ sieve-font-lock-keywords
       (,(regexp-opt '("require" "if" "else" "elsif" "stop") 'words)
        . 'sieve-control-commands)
       ;; action commands
-      (,(regexp-opt '("fileinto" "redirect" "reject" "keep" "discard") 'words)
+      (,(regexp-opt '("fileinto" "redirect" "reject" "keep" "discard"
+         "setflag" "addflag" "removeflag")
+         'words)
        . 'sieve-action-commands)
       ;; test commands
       (,(regexp-opt '("address" "allof" "anyof" "exists" "false"
 		      "true" "header" "not" "size" "envelope"
-                      "body")
+                      "body" "hasflag")
                     'words)
        . 'sieve-test-commands)
       ("\\Sw+:\\sw+" . 'sieve-tagged-arguments))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.