Gnus development mailing list
 help / color / mirror / Atom feed
From: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
To: ding@gnus.org
Subject: Re: [PATCH] Use `gnus-parameters' in `gnus-group-split-fancy'
Date: Thu, 02 Jan 2014 23:43:08 +0100	[thread overview]
Message-ID: <878uuyt37n.fsf@hati.baby-gnu.org> (raw)
In-Reply-To: <87fvpvbj8k.fsf@hati.baby-gnu.org> (Daniel Dehennin's message of "Sat, 14 Dec 2013 15:27:39 +0100")

[-- Attachment #1: Type: text/plain, Size: 3972 bytes --]

Hello,

This version of the patch[1] fixes two problems of the previous one:

1. some SPLIT where duplicated because the group name was present in
   “gnus-newsrc-alist” and in “gnus-parameters”

2. using only groups from “gnus-newsrc-alist” avoid creating new ones
   automatically when splitting, now, a user just need to:
   1. add a new entry to “gnus-parameters”
   2. update “nnmail-split-fancy” with “gnus-group-split-update”
   3. subscribe to the new mailing list
   4. the splitting will create the new group automatically when the
      first mail arrives

Regards.

The following changes since commit b4bc300f0dcddc2b17bb50a3501ed6e6db1ef12c:

  Update copyright year to 2014 (2014-01-01 10:39:44 +0000)

are available in the git repository at:

  git://git.baby-gnu.net/gnus.git tags/feature/use-gnus-parameters-in-gnus-group-split-fancy

for you to fetch changes up to b612682b8df60b5b4a2a854639f1cfb6d6fb28a3:

  Use `gnus-parameters' in `gnus-group-split-fancy' (2014-01-02 23:25:17 +0100)

----------------------------------------------------------------
Group splitting does not use “gnus-parameters”

This version of the patch build the list of all unique group names
gathered from “gnus-newsrc-alist” and “gnus-parameters” and then use
“gnus-group-find-parameter” to get each group parameters.

Using only “gnus-newsrc-alist” avoids the automatic creation of new
group during splitting when only “gnus-parameters” is configured.

Filter the groups during the build of group names, this avoid
calculation if user pass a list of group names.

----------------------------------------------------------------
Daniel Dehennin (1):
      Use `gnus-parameters' in `gnus-group-split-fancy'

 lisp/gnus-mlspl.el | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/lisp/gnus-mlspl.el b/lisp/gnus-mlspl.el
index 8dec6f2..2d86d0b 100644
--- a/lisp/gnus-mlspl.el
+++ b/lisp/gnus-mlspl.el
@@ -146,20 +146,27 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
       (any \"\\\\(foo@nowhere\\\\.gov\\\\|foo@localhost\\\\|foo-redist@home\\\\)\"
 	   - \"bugs-foo\" - \"rambling-foo\" \"mail.foo\"))
    \"mail.others\")"
-  (let* ((newsrc (cdr gnus-newsrc-alist))
-	 split)
-    (dolist (info newsrc)
-      (let ((group (gnus-info-group info))
-	    (params (gnus-info-params info)))
-	;; For all GROUPs that match the specified GROUPS
-	(when (or (not groups)
-		  (and (listp groups)
-		       (memq group groups))
-		  (and (stringp groups)
-		       (string-match groups group)))
-	  (let ((split-spec (assoc 'split-spec params)) group-clean)
-	    ;; Remove backend from group name
-	    (setq group-clean (string-match ":" group))
+  (let ((group-names (if (and (listp groups)
+                             (not (null groups)))
+			 groups
+		       (delete-dups
+			(delq nil
+			      (mapcar
+			       (lambda (info)
+				 (let ((group (gnus-info-group info)))
+				   (if (or (not groups)
+					   (and (stringp groups)
+						(string-match groups group)))
+				       group)))
+			       (append gnus-newsrc-alist gnus-parameters))))))
+       split)
+    (dolist (group group-names)
+      (let ((params (gnus-group-find-parameter group)))
+       ;; Skip groups without param (or nonexistent)
+       (when (not (null params))
+         (let ((split-spec (assoc 'split-spec params)) group-clean)
+           ;; Remove backend from group name
+           (setq group-clean (string-match ":" group))
 	    (setq group-clean
 		  (if group-clean
 		      (substring group (1+ group-clean))


Footnotes: 
[1]  http://git.baby-gnu.net/gitweb/gitweb.cgi?p=gnus.git;a=tag;h=refs/tags/feature/use-gnus-parameters-in-gnus-group-split-fancy

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF

[-- Attachment #2: Type: application/pgp-signature, Size: 229 bytes --]

  parent reply	other threads:[~2014-01-02 22:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-14 14:27 Daniel Dehennin
2013-12-28  1:17 ` Daniel Dehennin
2014-01-02 22:43 ` Daniel Dehennin [this message]
2014-01-04 14:55   ` Steinar Bang
2014-01-04 21:40     ` Daniel Dehennin
2014-01-05  5:13       ` Steinar Bang
2014-01-05  5:33         ` Daniel Dehennin
2014-01-05 13:03           ` Steinar Bang
2014-02-01  0:40   ` Lars Ingebrigtsen
2014-02-01 13:04     ` Daniel Dehennin
2014-02-01 20:39       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878uuyt37n.fsf@hati.baby-gnu.org \
    --to=daniel.dehennin@baby-gnu.org \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).