HTML email?

Cameron Simpson cs at cskk.id.au
Fri Apr 9 21:41:15 UTC 2021


On 09Apr2021 22:41, Andy Spiegl <mutt.andy at spiegl.de> wrote:
>> So in fact I choose the alternative order per message:
>Great idea!  And thanks for pointing out the "group" command which was
>completely unknown to me so far.  Unfortunately I'm missing some good
>examples in the manual in order to completely understand its possibilites.
>
>Questions like
> - Do I have to repeat the -rx before every pattern?

No.

However, the manual's misleading:

    4. Address Groups
    Usage: group [ -group name ...] { -rx expr ... | -addr expr ... }

I'd read that as: "-rx expr ..." is one of the 2 group definition 
alternatives.  It looks like a group is either a set of addresses or a 
set of regexps.

However, the following text description then falsifies the implication:

    The group command is used to directly add either addresses or
    regular expressions to the specified group or groups. The
    different categories of arguments to the group command can be
    in any order.  The flags -rx and -addr specify what the following
    strings (that cannot begin with a hyphen) should be interpreted
    as: either a regular expression or an email address, respectively.

That says to me you can do this:

    group -group group1 -group group2 -rx regexp1 regexp2 -addr addr1 addr2 -rx regexp3

which appends 5 definitions to "group1" and "group2". Or, on reflection, 
maybe:

    group -group group1 group2 -rx regexp1 regexp2 -addr addr1 addr2 -rx regexp3

On that basis I'd have written the syntax like this:

    Usage: group [ -group name ]... { -rx expr... | -addr expr... }...

Note the repetition bound to each optional thing: multiple "-group name"

But the above is somewhat conjecture - we need to read the source, alas.

> - Can I group mutt aliases with -addr or just addresses?

Not sure what you mean here.

I have no -rx groups, but _all_ my mutt alias definitions take the form:

    alias -group 37signals 37signals \
                37signals Billing <billing at 37signals.com>, \
                Jason Fried - 37signals Newsletter <newsletter at 37signals.com>

which defines _both_ an alias _and_ an address based group (which have 
the same name, hence the double "37signals" above - you can name these 
differently).

That's because all my groups are computed from my address db.

> - What is a good way to check/verify whether my group definition works?
>E.g. I defined the group "me":
> group -group me -rx me\..* -rx .*\.spiegl.*@ -rx .*\.andy.*@

Maybe write some index colouring rules based on the group membership?  
That seems the simplest way to test this stuff to me.

I think I'm going to have to write myself a macro to "reload all my 
settings" - I've had to muck around in the past trying stuff like this, 
and leaving/entering mutt every time I make a change is tedious.

>Hoping that it would also pick up all "me." aliases like: me.company1, me.company2, ...

Looks like it should. But the regexps may need to match the whole 
address part, maybe you need:

    spiegl\..*@.*

Or maybe not, if they're applied to the "whole address" eg "Andy Spiegl <mutt.andy at spiegl.de>".

I confess I'm just guessing here.

But note this in the PATTERNS section:

    Special attention has to be paid when using regular expressions 
    inside of patterns. Specifically, Mutt's parser for these patterns 
    will strip one level of backslash (“\”), which is normally used for 
    quoting. If it is your intention to use a backslash in the regular 
    expression, you will need to use two backslashes instead (“\\”).

So your regexps above need backslash doubling. Or maybe quoting :-)

>Do you happen to know where to find more about it? (my last resort 
>would be the source code)

The source, alas.

I don't use regexps for address matching (if I can help it); they're a 
lousy tool for matching addresses.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Mutt-users mailing list