From unknown Sun Jun 22 03:57:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25346: [PATCH] Gnus Group Mail Spliting on mailing-list headers Resent-From: Daniel Dehennin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Jan 2017 18:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 25346@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.148346639422094 (code B ref -1); Tue, 03 Jan 2017 18:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Jan 2017 17:59:54 +0000 Received: from localhost ([127.0.0.1]:40549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOTNG-0005kD-Vt for submit@debbugs.gnu.org; Tue, 03 Jan 2017 12:59:54 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOTNB-0005jv-Ut for submit@debbugs.gnu.org; Tue, 03 Jan 2017 12:59:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOTN2-0002hI-LI for submit@debbugs.gnu.org; Tue, 03 Jan 2017 12:59:40 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cOTN2-0002h7-IL for submit@debbugs.gnu.org; Tue, 03 Jan 2017 12:59:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOTMy-00051D-EB for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 12:59:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOTMt-0002Xv-EV for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 12:59:32 -0500 Received: from zion.baby-gnu.net ([82.225.168.180]:53958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOTMs-0002Qq-Tl for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 12:59:27 -0500 Received: from hati.asgardr.info ([192.168.1.2] helo=hati.baby-gnu.org) by zion.baby-gnu.net with esmtp (Exim 4.88) (envelope-from ) id 1cOTMe-0005mD-67 for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2017 18:59:12 +0100 From: Daniel Dehennin Organisation: Dark Church of Emacs Date: Tue, 03 Jan 2017 18:59:11 +0100 Message-ID: <87shp0uis0.fsf@hati.baby-gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Package: emacs Severity: wishlist Tags: patch Hello, This patch implement Group Mail Spliting on mailing-list headers, I'm using it since a long time now. This avoid the burden of cross-mailing-list posting when a mail is sent to 4 mailing-lists and finish duplicated 4 times in each mailing-list group. The trick is to to mangle the split-regexp to conform with RFC2919 list IDs. The following `gnus-parameters`: #+begin_src emacs-lisp ("gnu.emacs.gnus.ding" (to-list . "ding@gnus.org") (match-list . t) (subscribed . t)) #+end_src Produce the following fancy split: #+begin_src emacs-lisp (list "\\(ding[@.]gnus\\.org\\)" "gnu.emacs.gnus.ding") #+end_src --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Gnus-Group-Mail-Spliting-on-mailing-list-headers.patch Content-Transfer-Encoding: quoted-printable Content-Description: Gnus Add Group Mail Spliting on mailing-list headers From=2020bc756adcb8864fa5ec43d22b19db3ec2efaafc Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Tue, 3 Jan 2017 18:44:18 +0100 Subject: [PATCH] Gnus Group Mail Spliting on mailing-list headers This avoid the burden of cross-mailing-list posting when a mail is sent to 4 mailing-lists and finish duplicated 4 times in each mailing-list group. * lisp/nnmail.el: Add new `list' split abbreviation matching common mailing-list headers. * 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 `@` or `.` as domain separator to comply with RFC2919 IDs too. * texi/gnus.texi: Document the new `list' split abbreviation and `match-list' group parameter. =2D-- doc/misc/gnus.texi | 18 ++++++++++++++++++ lisp/gnus/gnus-mlspl.el | 25 +++++++++++++++++++------ lisp/gnus/nnmail.el | 3 ++- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 05159d4b2f..dba51f1dda 100644 =2D-- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -3108,6 +3108,21 @@ interest in relation to the sieve parameter. The Sieve language is described in RFC 3028. @xref{Top, Emacs Sieve, Top, sieve, Emacs Sieve}. =20 +@item match-list +@cindex 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}, +@code{to-list}, @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 +parameters. + @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 @@ -15469,6 +15484,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 +@item list +Matches the @samp{List-ID}, @samp{List-Post}, @samp{X-Mailing-List}, +@samp{X-BeenThere} and @samp{X-Loop} fields. =20 @vindex nnmail-split-fancy-syntax-table @code{nnmail-split-fancy-syntax-table} is the syntax table in effect diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el index c42c34adce..378a06100e 100644 =2D-- a/lisp/gnus/gnus-mlspl.el +++ b/lisp/gnus/gnus-mlspl.el @@ -184,7 +184,8 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\"= ) returns: (to-list (cdr (assoc 'to-list params))) (extra-aliases (cdr (assoc 'extra-aliases params))) (split-regexp (cdr (assoc 'split-regexp params))) =2D (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 @@ -204,16 +205,28 @@ Calling (gnus-group-split-fancy nil nil \"mail.others= \") returns: "\\|") "\\)")) ;; Now create the new SPLIT =2D (push (append =2D (list 'any split-regexp) + (let ((split-regexp-with-list-ids + (replace-regexp-in-string "@" "[@.]" split-regexp t t)) + (exclude ;; Generate RESTRICTs for SPLIT-EXCLUDEs. (if (listp split-exclude) (apply #'append (mapcar (lambda (arg) (list '- arg)) split-exclude)) =2D (list '- split-exclude)) =2D (list group-clean)) =2D 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 3f2e08171e..96be94922c 100644 =2D-- 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") =2D (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent= -cc")) + (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-c= c") + (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))) =2D-=20 2.11.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Regards. =2D-=20 Daniel Dehennin R=C3=A9cup=C3=A9rer ma clef GPG: gpg --recv-keys 0xCC1E9E5B7A6FE2DF Fingerprint: 3E69 014E 5C23 50E8 9ED6 2AAD CC1E 9E5B 7A6F E2DF --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iNUEAREKAH0WIQQJqolqDsb9CZJ2h+gWstExzKAaSwUCWGvmcF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MDlB QTg5NkEwRUM2RkQwOTkyNzY4N0U4MTZCMkQxMzFDQ0EwMUE0QgAKCRAWstExzKAa S1DcAP9Q8kK6CKmhBP+4YdReCqw71Vb2SqmUlScK8fToLAY3mQD9HAOad47uxqJX /YitxxMh5EthQHxx/wj6VHShYQlSYCc= =dXoe -----END PGP SIGNATURE----- --==-=-=-- From unknown Sun Jun 22 03:57:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25346: [PATCH] Gnus Group Mail Spliting on mailing-list headers Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Apr 2018 22:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Dehennin Cc: 25346@debbugs.gnu.org Received: via spool by 25346-submit@debbugs.gnu.org id=B25346.152348645016590 (code B ref 25346); Wed, 11 Apr 2018 22:41:01 +0000 Received: (at 25346) by debbugs.gnu.org; 11 Apr 2018 22:40:50 +0000 Received: from localhost ([127.0.0.1]:46750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f6OQ6-0004JV-7y for submit@debbugs.gnu.org; Wed, 11 Apr 2018 18:40:50 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:50839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f6OQ4-0004JH-Bb for 25346@debbugs.gnu.org; Wed, 11 Apr 2018 18:40:48 -0400 Received: from 46.67.12.60.tmi.telenormobil.no ([46.67.12.60] helo=corrigan) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1f6OQ1-0000qa-Ag; Thu, 12 Apr 2018 00:40:47 +0200 Received: from larsi by corrigan with local (Exim 4.89) (envelope-from ) id 1f6OPv-0003HF-Ba; Thu, 12 Apr 2018 00:40:39 +0200 From: Lars Ingebrigtsen References: <87shp0uis0.fsf@hati.baby-gnu.org> Date: Thu, 12 Apr 2018 00:40:38 +0200 In-Reply-To: <87shp0uis0.fsf@hati.baby-gnu.org> (Daniel Dehennin's message of "Tue, 03 Jan 2017 18:59:11 +0100") Message-ID: <87bmepv02h.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Daniel Dehennin writes: > This patch implement Group Mail Spliting on mailing-list headers, I'm > using it since a long time now. > > This avoid the burden of cross-mailing-list posting when a mail is > sent to 4 mailing-lists and finish duplicated 4 times in each > mailing-list group. > > The trick is to to mangle the split-regexp to conform with RFC2919 list > IDs. Looks good; I've applied it to Emacs 27.1. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 11 18:40:51 2018 Received: (at control) by debbugs.gnu.org; 11 Apr 2018 22:40:51 +0000 Received: from localhost ([127.0.0.1]:46752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f6OQ7-0004Je-GN for submit@debbugs.gnu.org; Wed, 11 Apr 2018 18:40:51 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:50844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f6OQ5-0004JP-Lv for control@debbugs.gnu.org; Wed, 11 Apr 2018 18:40:49 -0400 Received: from 46.67.12.60.tmi.telenormobil.no ([46.67.12.60] helo=corrigan) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1f6OQ3-0000td-A2 for control@debbugs.gnu.org; Thu, 12 Apr 2018 00:40:49 +0200 Received: from larsi by corrigan with local (Exim 4.89) (envelope-from ) id 1f6OPx-0003HJ-Ih for control@debbugs.gnu.org; Thu, 12 Apr 2018 00:40:41 +0200 To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #25346 Message-Id: Date: Thu, 12 Apr 2018 00:40:41 +0200 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 25346 fixed close 25346