Gnus development mailing list
 help / color / mirror / Atom feed
From: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
To: ding@gnus.org
Subject: Extending 'gnus-parameters usage
Date: Sat, 11 Feb 2012 17:57:16 +0100	[thread overview]
Message-ID: <878vk9xq8j.fsf@hati.baby-gnu.org> (raw)

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

Hello,

For some times now I use a hack to make the content of 'gnus-parameters
variable used by 'gnus-group-split-fancy.

I think it's dirty, I post here to propose the idea and hope for a clean
solution.

I do not like the group parameter customization from the group buffer,
I maintain my configuration in a git repository and would like to follow
any changes to my groups configuration.

So I define a 'my-gnus-group-split-prepare-parameters function to merge
'gnus-parameters and 'newsrc-alist.

#+begin_src emacs-lisp
(defun my-gnus-group-split-prepare-parameters (&optional parameters)
  "Take the ALIST of parameters or gnus-parameters and create a
fake newsrc structure to use in 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)))
	;; FIXME any better solution than (list (list ?
	(setq newsrc-alist 
	      (append newsrc-alist (list (list group nil nil nil nil param))))))))
#+end_src

Then I patched 'gnus-group-split-fancy:

#+begin_src diff
diff --git a/lisp/gnus-mlspl.el b/lisp/gnus-mlspl.el
index 3086e2b..b59e841 100644
--- a/lisp/gnus-mlspl.el
+++ b/lisp/gnus-mlspl.el
@@ -97,7 +97,8 @@ See `gnus-group-split-fancy' for more information.
 ;;;###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 +147,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) (my-gnus-group-split-prepare-parameters)))
 	 split)
     (dolist (info newsrc)
       (let ((group (gnus-info-group info))
#+end_src

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

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

             reply	other threads:[~2012-02-11 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-11 16:57 Daniel Dehennin [this message]
2012-03-10  1:21 ` Lars Magne 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=878vk9xq8j.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).