Gnus development mailing list
 help / color / mirror / Atom feed
From: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
To: ding@gnus.org
Subject: [PATCH] Use `gnus-parameters' in `gnus-group-split-fancy'
Date: Sat, 14 Dec 2013 15:27:39 +0100	[thread overview]
Message-ID: <87fvpvbj8k.fsf@hati.baby-gnu.org> (raw)

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

Hello,

I use a little patch[1] since years to split groups not only on group
parameters from “newsrc” but from “gnus-parameters” too.

I found the later easier to manage.

Following is my pull request, if you want it.

Regards.

The following changes since commit 23c6fe6e28b8b6f356bae60e2fc773c41cd8b540:

  gnus-msg.el (gnus-setup-message): Fix last commit (2013-12-09 00:35:04 +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 a0a3183b02ae84a53e266522fbc74d548a7cba00:

  Use `gnus-parameters' in `gnus-group-split-fancy' (2013-12-14 15:10:06 +0100)

----------------------------------------------------------------
Group splitting does not use `gnus-parameters'

I found `gnus-parameters' easier to manage than `newsrc':

- human readable file
- file is versionned

This patch add the `gnus-parameters' to `newsrc' structure before
building split.

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

 lisp/gnus-mlspl.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lisp/gnus-mlspl.el b/lisp/gnus-mlspl.el
index 3947c67..0690a12 100644
--- a/lisp/gnus-mlspl.el
+++ b/lisp/gnus-mlspl.el
@@ -94,10 +94,24 @@ See `gnus-group-split-fancy' for more information.
     (gnus-group-split-update)
     (nnmail-split-fancy)))
 
+(defun gnus-group-split-prepare-parameters (&optional parameters)
+  "Convert PARAMETERS alist or `gnus-parameters' to a newsrc
+structure usable by `gnus-group-split-fancy'"
+  (let ((group-params (if parameters
+			  parameters
+			gnus-parameters))
+	newsrc-alist)
+    (dolist (param-assoc group-params newsrc-alist)
+      (let ((group (car param-assoc))
+	    (param (cdr param-assoc)))
+	(setq newsrc-alist
+	      (append newsrc-alist (list (list group nil nil nil nil param))))))))
+
 ;;;###autoload
 (defun gnus-group-split-fancy
   (&optional groups no-crosspost catch-all)
-  "Uses information from group parameters in order to split mail.
+  "Uses information from group parameters and `gnus-parameters'
+in order to split mail.
 It can be embedded into `nnmail-split-fancy' lists with the SPLIT
 
 \(: gnus-group-split-fancy GROUPS NO-CROSSPOST CATCH-ALL\)
@@ -146,7 +160,7 @@ 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))
+  (let* ((newsrc (append (cdr gnus-newsrc-alist) (gnus-group-split-prepare-parameters)))
 	 split)
     (dolist (info newsrc)
       (let ((group (gnus-info-group info))


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 --]

             reply	other threads:[~2013-12-14 14:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-14 14:27 Daniel Dehennin [this message]
2013-12-28  1:17 ` Daniel Dehennin
2014-01-02 22:43 ` Daniel Dehennin
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=87fvpvbj8k.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).