* Extending 'gnus-parameters usage
@ 2012-02-11 16:57 Daniel Dehennin
2012-03-10 1:21 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Dehennin @ 2012-02-11 16:57 UTC (permalink / raw)
To: ding
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Extending 'gnus-parameters usage
2012-02-11 16:57 Extending 'gnus-parameters usage Daniel Dehennin
@ 2012-03-10 1:21 ` Lars Magne Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-03-10 1:21 UTC (permalink / raw)
To: Daniel Dehennin; +Cc: ding
Daniel Dehennin <daniel.dehennin@baby-gnu.org> writes:
> 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.
Well, we could add a `gnus-parameter-function' variable to be plugged in
here that would take a group name and return the group parameters.
(dolist (info newsrc)
(let ((group (gnus-info-group info))
(params (gnus-info-params info)))
;; For all GROUPs that match the specified GROUPS
That should allow for great flexibility for the user to choose where the
parameters come from...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-10 1:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-11 16:57 Extending 'gnus-parameters usage Daniel Dehennin
2012-03-10 1:21 ` Lars Magne Ingebrigtsen
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).