Re: Re: Loading several intialisation files at startup

2022-09-19 Thread Jan Eden via Mutt-users
On 2022-09-15 08:27, Cameron Simpson wrote:
> On 13Sep2022 16:50, Sébastien Hinderer  
> wrote:
> > I would like to have a nice way to deal with several accounts in mutt. I
> > am talking just about the .muttrc file aspect here.
> > 
> > My present configuration is that each account has its own muttrc file
> > which sources a common one.
> 
> I thought the common approach was what you next outline: a single muttrc
> which sources the appropriate account-specific muttrc.
> 
> [...]
> reply-hook . "my_hdr BCC: $my_cs"

An indirect version of this reply-hook does not work for me

reply-hook '~C "^mutt-users@mutt.org$"' 'source ~/.mutt/mutt-users.cf'

where mutt-users.cf sets an address and sources reset.cf:

# reset.cf
set from=$my_address
unmy_hdr *
my_hdr Bcc: $my_address

According to the docs, the BCC header is set before reply-hooks are
evaluated[1], and the above configuration does not change this header
(unlike the From header):

> my_hdr processing for To, Cc, Bcc, Subject headers.
> Prompts for To, Cc, Bcc, Subject headers. See $askcc, $askbcc, $fast_reply.
> From header setting. Note: this is so send-hooks below can match ~P, but From 
> is re-set further below in case a send-hook changes the value.
> reply-hook
> send-hook
> From header setting.
> my_hdr processing for From, Reply-To, Message-ID and user-defined headers. 
> The To, Cc, Bcc, Subject, and Return-Path headers are ignored at this stage.

How did you manage to change the BCC header with your reply hook?

- Jan

[1] http://mutt.org/doc/manual/#compose-flow


signature.asc
Description: PGP signature


Re: Regard To-Envelope for alternates?

2022-09-19 Thread Bastian
On 13Sep22 09:49-0700, Will Yardley wrote:
> I agree that would be useful. That said, I usually handle the scenario
> you describe this way:
> send-hook '~C ^mutt-users@mutt\.org$' 'my_hdr From: Will Yardley 
> '

I had a look into the code and also experimented a bit how 
mutt_find_user_in_envelope [1] works. But as far as I see, there is no 
easy way to make it also look into further headers, because the ENVELOPE 
struct [2] does not provide those.

  1: https://gitlab.com/muttmua/mutt/-/blob/master/alias.c#L692
  2: https://gitlab.com/muttmua/mutt/-/blob/master/mutt.h#L739

Anyways, your reply gave me the idea, if the `reply-hook` might work. 
But I also did not succeed here. I think it is not possible with mutt 
hooks to work with the matched groups like below, is it?

--- paste:
reply-hook ~h'^Envelope-to:\ (.\*)$' set from=\1
--- eop

This does not work because if the expression is matched, the from is set 
to "1", group referencing is not applied or I do it wrongly. Also the 
alternates matching is run afterwards, which is good. So when the 
alternates match, they'll overwrite what the reply-hook set before.

Any idea how to use the reply-hook properly?


Cheers,
-- 
Bastian