Re: more general hooks to handle similar mailing lists

2020-10-11 Thread Claus Assmann
On Sun, Oct 11, 2020, Remco Rnders wrote:

> > save-hook "~C ietf-\\([a-z0-9]+\\)@ietf.org" =%1

> I know it is not a direct answer to your question, but it might perhaps get 
> the
> end result you want; Have you considered using procmail or a sieve filter to
> automatically save mail matching your regex to the folder you want?

I'm doing that, but the theoretical configuration command above was
just one example of what I would like to do -- something like
"parameterized" commands. Other examples would be

send-hook ietf-\([a-z0-9]+\\)@ietf.org 'my_hdr From: My Name 
'
folder-hook ietf-\([a-z0-9]+\\) 'my_hdr From: My Name '


Re: more general hooks to handle similar mailing lists

2020-10-11 Thread Remco Rijnders
On Sun, Oct 11, 2020 at 08:08:07AM +0200, Claus wrote in 
<20201011060807.ga46...@kiel.esmtp.org>:

I'm trying to use a more generic approach for some patterns
to handle mailing list, e.g., something like:

save-hook "~C ietf-\\([a-z0-9]+\\)@ietf.org" =%1

instead of having one entry for each mailing list.
Is that possible with the current mutt features?


I know it is not a direct answer to your question, but it might perhaps get the
end result you want; Have you considered using procmail or a sieve filter to
automatically save mail matching your regex to the folder you want?


Re: more general hooks to handle similar mailing lists

2020-10-11 Thread Kevin J. McCarthy

On Sun, Oct 11, 2020 at 08:08:07AM +0200, Claus Assmann wrote:

I'm trying to use a more generic approach for some patterns
to handle mailing list, e.g., something like:

save-hook "~C ietf-\\([a-z0-9]+\\)@ietf.org" =%1

instead of having one entry for each mailing list.
Is that possible with the current mutt features?


No, that's not possible right now.  The regexec() is inside the pattern 
modifier processor (e.g. ~C).  The save-hook mailbox evaluation takes 
place far removed from there, preventing easy access to the back 
reference structure as well as the string the back reference would apply 
to.


Additionally, nothing prevents multiple patterns modifiers with a 
regexp.



It seems that back-references in regular expressions can only
be used for "spam":
spam pattern format


The "pattern" argument for spam isn't really a pattern, it's a regexp. 
The regexec() matching and format generation take place in the same 
place for the spam command, so it's easy to process back references.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature