[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 45e3753: Gnus Group Mail Spliting on mailing-list h

From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 45e3753: Gnus Group Mail Spliting on mailing-list headers
Date: Wed, 11 Apr 2018 18:40:58 -0400 (EDT)

branch: master
commit 45e37537620e594f0fb77210a9163e3da246666d
Author: Daniel Dehennin <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Gnus Group Mail Spliting on mailing-list headers
    * texi/gnus.texi: Document the new `list' split abbreviation and
    `match-list' group parameter (bug#25346).
    * lisp/gnus-mlspl.el: Use the `list' abbreviation when the new
    `match-list' group parameter is set to `t'.
    The split regexp is modified to match either address@hidden or `.` as domain
    separator to comply with RFC2919 IDs too.
    * lisp/nnmail.el: Add new `list' split abbreviation matching common
    mailing-list headers.
 doc/misc/gnus.texi      | 18 ++++++++++++++++++
 etc/NEWS                |  5 +++++
 lisp/gnus/gnus-mlspl.el | 25 +++++++++++++++++++------
 lisp/gnus/nnmail.el     |  3 ++-
 4 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index cc4b234..de219c6 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -3102,6 +3102,21 @@ interest in relation to the sieve parameter.
 The Sieve language is described in RFC 3028.  @xref{Top, Emacs Sieve,
 Top, sieve, Emacs Sieve}.
address@hidden match-list
address@hidden match-list
+If this parameter is set to @code{t} and @code{nnmail-split-method} is
+set to @code{gnus-group-split}, Gnus will match @code{to-address},
address@hidden, @code{extra-aliases} and @code{split-regexp} against
+the @code{list} split abbreviation.  The split regexp is modified to
+match either a @code{@@} or a dot @code{.} in mail addresses to
+conform to RFC2919 @code{List-ID}.
+See @code{nnmail-split-abbrev-alist} for the regular expression
+matching mailing-list headers.
+See @pxref{Group Mail Splitting} to automatically split on group
 @item (agent parameters)
 If the agent has been enabled, you can set any of its parameters to
 control the behavior of the agent in individual groups.  See Agent
@@ -15475,6 +15490,9 @@ Matches the @samp{To}, @samp{Cc}, @samp{Apparently-To},
 @item any
 Is the union of the @code{from} and @code{to} entries.
 @end table
address@hidden list
+Matches the @samp{List-ID}, @samp{List-Post}, @samp{X-Mailing-List},
address@hidden and @samp{X-Loop} fields.
 @vindex nnmail-split-fancy-syntax-table
 @code{nnmail-split-fancy-syntax-table} is the syntax table in effect
diff --git a/etc/NEWS b/etc/NEWS
index 059c6ee..caa67c9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -190,6 +190,11 @@ from 'gnus-score-find-favourite-words'.
 *** Gmane has been removed as an nnir backend, since Gmane no longer
 has a search engine.
+*** Splitting mail on common mailing list has been added.  See the
+concept index in the Gnus manual for the `match-list' entry.
 ** Htmlfontify
 *** The functions 'hfy-color', 'hfy-color-vals' and
 'hfy-fallback-color-values' and the variables 'hfy-fallback-color-map'
diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el
index fb45007..599b9c6 100644
--- a/lisp/gnus/gnus-mlspl.el
+++ b/lisp/gnus/gnus-mlspl.el
@@ -182,7 +182,8 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") 
                    (to-list (cdr (assoc 'to-list params)))
                    (extra-aliases (cdr (assoc 'extra-aliases params)))
                    (split-regexp (cdr (assoc 'split-regexp params)))
-                   (split-exclude (cdr (assoc 'split-exclude params))))
+                   (split-exclude (cdr (assoc 'split-exclude params)))
+                   (match-list (cdr (assoc 'match-list params))))
                (when (or to-address to-list extra-aliases split-regexp)
                  ;; regexp-quote to-address, to-list and extra-aliases
                  ;; and add them all to split-regexp
@@ -202,16 +203,28 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") 
                  ;; Now create the new SPLIT
-                 (push (append
-                        (list 'any split-regexp)
+                 (let ((split-regexp-with-list-ids
+                        (replace-regexp-in-string "@" "address@hidden" 
split-regexp t t))
+                       (exclude
                         ;; Generate RESTRICTs for SPLIT-EXCLUDEs.
                         (if (listp split-exclude)
                             (apply #'append
                                    (mapcar (lambda (arg) (list '- arg))
-                          (list '- split-exclude))
-                        (list group-clean))
-                       split)
+                          (list '- split-exclude))))
+                   (if match-list
+                       ;; Match RFC2919 IDs or mail addresses
+                       (push (append
+                              (list 'list split-regexp-with-list-ids)
+                              exclude
+                              (list group-clean))
+                             split)
+                     (push (append
+                            (list 'any split-regexp)
+                            exclude
+                            (list group-clean))
+                           split)))
                  ;; If it matches the empty string, it is a catch-all
                  (when (string-match split-regexp "")
                    (setq catch-all nil)))))))))
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index b2c86d3..5083fa2 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -488,7 +488,8 @@ Example:
     (to . "to\\|cc\\|apparently-to\\|resent-to\\|resent-cc")
     (from . "from\\|sender\\|resent-from")
     (nato . "to\\|cc\\|resent-to\\|resent-cc")
-    (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-cc"))
+    (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-cc")
+    (list . "list-id\\|list-post\\|x-mailing-list\||x-beenthere\\|x-loop"))
   "Alist of abbreviations allowed in `nnmail-split-fancy'."
   :group 'nnmail-split
   :type '(repeat (cons :format "%v" symbol regexp)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]