Discussion:
group splitting and gnus-secondary-select-methods
Christoph Groth
2017-08-10 22:47:25 UTC
Permalink
Hi,

I'm trying to setup group mail splitting in a setup where I
receive mail through multiple IMAP accounts that are configured
through gnus-secondary-select-methods.

Simply setting gnus-secondary-select-methods in ~/.gnus, like with
plain splitting, doesn't work, since at the time when ~/.gnus is
executed (gnus-group-split-fancy) returns an empty split.

In order to solve this problem, I have defined a function
my-set-secondary-select-methods and add it to one or multiple
appropriate hooks. Is there a better alternative?

If not, what hooks should I add my function to? It seems to work
with

(add-hook 'gnus-read-newsrc-el-hook
'my-set-secondary-select-methods)
(add-hook 'gnus-get-new-news-hook
'my-set-secondary-select-methods)

Thanks for any hints,
Christoph
Eric Abrahamsen
2017-08-11 16:22:44 UTC
Permalink
Hi,
I'm trying to setup group mail splitting in a setup where I receive
mail through multiple IMAP accounts that are configured through
gnus-secondary-select-methods.
Simply setting gnus-secondary-select-methods in ~/.gnus, like with
plain splitting, doesn't work, since at the time when ~/.gnus is
executed (gnus-group-split-fancy) returns an empty split.
In order to solve this problem, I have defined a function
my-set-secondary-select-methods and add it to one or multiple
appropriate hooks. Is there a better alternative?
If not, what hooks should I add my function to? It seems to work with
(add-hook 'gnus-read-newsrc-el-hook 'my-set-secondary-select-methods)
(add-hook 'gnus-get-new-news-hook 'my-set-secondary-select-methods)
I'm not entirely sure what's going on with your setup, here, but I'm
pretty sure it should work without having to re-set your secondary
select methods in a hook.

Can you show us a simple config, setting gnus-secondary-select-methods
and the splitting rules in ~/.gnus? The setup that isn't working for
you?

Eric
Christoph Groth
2017-08-11 18:34:50 UTC
Permalink
Eric, Emanuel,

Thank you for the quick replies! Perhaps I haven't been clear:
when I said that I'm trying to setup "group mail splitting" I
didn't mean plain mail splitting (I have been using that one since
the begin of the century or so), I meant what the Gnus manual
calls "group mail splitting" (there's a section on it). Gnus has
functionality to generate fancy splitting rules automatically for
groups that contain 'to-list' or 'to-address' parameters. If you
have defined these parameters for some groups and evaluate
(gnus-group-split-fancy), you'll get a split that can be assigned
to the variable nnimap-split-fancy.

So far so good, the only problem is that at the time that ~/.gnus
gets executed, (gnus-group-split-fancy) returns an empty split
'(&)'. You can see this by putting
(setq my-group-split-fancy-result (gnus-group-split-fancy))
in your ~/.gnus and examining the variable. It seems to me that
this is because when it executes its configuration file, Gnus
doesn't yet know what groups there are.

That's why I've been using hooks to set the variable
gnus-secondary-select-methods. Gnus has some functionality to
setup hooks for group mail splitting by itself, but this doesn't
cover multiple select methods.

The hooks that I've found (gnus-read-newsrc-el-hook and
gnus-get-new-news-hook), but I'm not sure whether that's the best
way to setup things. And if it is, it should be maybe added to
the manual.

Christoph
Eric Abrahamsen
2017-08-13 03:01:01 UTC
Permalink
Post by Christoph Groth
Eric, Emanuel,
Thank you for the quick replies! Perhaps I haven't been clear: when I
said that I'm trying to setup "group mail splitting" I didn't mean
plain mail splitting (I have been using that one since the begin of
the century or so), I meant what the Gnus manual calls "group mail
splitting" (there's a section on it). Gnus has functionality to
generate fancy splitting rules automatically for groups that contain
'to-list' or 'to-address' parameters. If you have defined these
parameters for some groups and evaluate (gnus-group-split-fancy),
you'll get a split that can be assigned to the variable
nnimap-split-fancy.
Oh... that's something I haven't used before, sorry.

Are you using it as directed, as an element of `nnmail-split-fancy'?
Simply calling it in your gnus file isn't going to produce the correct
results, the function needs to be a part of that variable's value to do
the right thing.

If that doesn't work, try putting (gnus-group-split-setup t) in your
gnus file? That looks like it will set up the correct hooks for
updating.

Like I said, I haven't used this before, and the above suggestions just
come from a brief perusal of gnus-mlspl.el. Apologies if you've already
gone through that file and these approaches haven't worked...

Eric

Emanuel Berg
2017-08-11 16:35:43 UTC
Permalink
Post by Christoph Groth
Hi,
I'm trying to setup group mail splitting in
a setup where I receive mail through multiple
IMAP accounts that are configured through
gnus-secondary-select-methods.
I don't use IMAP, but old POP, but
mail-splitting I don't see why it shouldn't be
the same.

Here is an example what you can do:

(setq nnmail-split-methods
'(
("blogomatic" "Subject: \\[blogomatic\\]")
("mail.ml-ooa" "\\(To\\|Cc\\):.*\\(emacs-***@namazu.org\\|\\(help-gnu-emacs\\|emacs-devel\\)@gnu.org\\|gmane-***@quimby.gnus.org\\|tex-***@tug.org\\|gnuplot-***@lists.sourceforge.net\\)")
("mail.misc" "")
))

Obviously if you want to split depending on
from what account the mail originated, you'd
have to change the parameters accordingly.

(This probably didn't help, so just sayin'. :))
--
underground experts united
http://user.it.uu.se/~embe8573
Loading...