Re: Re: Re: Re: Loading several intialisation files at startup

2022-09-15 Thread Sébastien Hinderer
Jan Eden via Mutt-users (2022/09/15 21:39 +0200):
> > I think what I described in the first e-mail would allow you to have
> > only one file per account and to not repeat the line, no?
> 
> Right, I misread your initial request. Sorry!

No problem. Seeing your macros will a source of inspiraiton so thanks
for that!

Sébastien.


Re: Re: Re: Re: Loading several intialisation files at startup

2022-09-15 Thread Jan Eden via Mutt-users

On 2022-09-15 21:23, Sébastien Hinderer wrote:
> Jan,
> 
> I think I got it.
> 
> Am I correct that, for each account, you have actually two files: one
> that you use in your alias and one that you use in your macro. Is that
> right?

More or less: For three of my accounts, there is only a single address,
but for the fourth account, I have five additional files to use in my
macros.

> I think what I described in the first e-mail would allow you to have
> only one file per account and to not repeat the line, no?

Right, I misread your initial request. Sorry!

- Jan


signature.asc
Description: PGP signature


Re: Re: Re: Loading several intialisation files at startup

2022-09-15 Thread Sébastien Hinderer
Jan,

I think I got it.

Am I correct that, for each account, you have actually two files: one
that you use in your alias and one that you use in your macro. Is that
right?

I think what I described in the first e-mail would allow you to have
only one file per account and to not repeat the line, no?

Cheers,

Sébastien.


Re: Re: Re: Loading several intialisation files at startup

2022-09-15 Thread Jan Eden via Mutt-users
Hi Sébastien,

On 2022-09-15 20:26, Sébastien Hinderer wrote:
> Hello Jan, thanks a lot for your response and the link!
> 
> Jan Eden via Mutt-users (2022/09/15 11:42 +0200):
> > I defined aliases for my accounts in .zshrc, because I do not mind
> > restarting mutt when switching to a different account:
> > 
> > alias m1='cd ~/Downloads && /opt/homebrew/bin/mutt -F ~/.mutt/account1.cf 
> > && cd'
> > alias m2='cd ~/Downloads && /opt/homebrew/bin/mutt -F
> > ~/.mutt/account2.cf && cd'
> 
> That's what I am doing currently, yse. But then, am I correct that each
> of your account.cf file needs to source the main configuration file to
> get the default values in? Precisely, it's the repetition of this line
> that I wanted to avoid.

Yes, that line is repeated in each account configuration.

> Plus, that way, when you change configuraiton
> interactively, all the common settings are read in again useessly. It's
> cheap of course but I'de still like to avoid it.

Not really, because I only re-set a few parameters interactively (i.e. I
do not source a complete account configuration, but an address
configuration):

macro generic \e1 ":source ~/.mutt/default_address.cf\r"

# default_address.cf
set my_address = "x...@eden.one"
set my_pgp_key = '257A9B6F3DEDCA11319000877CD4656792A3A1F4'
source '~/.mutt/set_address.cf'

# set_address.cf
set from=$my_address
set pgp_default_key = $my_pgp_key
set status_format="-%r $my_address: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? 
Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? 
%l?]---(%s/%S)-%>-(%P)---"
unmy_hdr *
my_hdr Bcc: $my_address

Each macro sources only six lines of configuration. To use a different
account, I restart mutt (or rather, I have four terminal tabs running
mutt for different accounts).

- Jan


signature.asc
Description: PGP signature


Re: Re: Loading several intialisation files at startup

2022-09-15 Thread Sébastien Hinderer
Hello Jan, thanks a lot for your response and the link!

Jan Eden via Mutt-users (2022/09/15 11:42 +0200):
> I defined aliases for my accounts in .zshrc, because I do not mind
> restarting mutt when switching to a different account:
> 
> alias m1='cd ~/Downloads && /opt/homebrew/bin/mutt -F ~/.mutt/account1.cf && 
> cd'
> alias m2='cd ~/Downloads && /opt/homebrew/bin/mutt -F
> ~/.mutt/account2.cf && cd'

That's what I am doing currently, yse. But then, am I correct that each
of your account.cf file needs to source the main configuration file to
get the default values in? Precisely, it's the repetition of this line
that I wanted to avoid. Plus, that way, when you change configuraiton
interactively, all the common settings are read in again useessly. It's
cheap of course but I'de still like to avoid it.

Cheers,

Sébastien.


Re: Re: Loading several intialisation files at startup

2022-09-15 Thread Jan Eden via Mutt-users
On 2022-09-15 10:23, Sébastien Hinderer wrote:
> Hello,
> 
> Many thanks for your reponse!
> 
> Cameron Simpson (2022/09/15 08:27 +1000):
> > I thought the common approach was what you next outline: a single muttrc
> > which sources the appropriate account-specific muttrc.
> 
> [...]
> 
> For files that define different thisgs yes, that works. But for
> accounts, which have different values for the smae variables, I think
> you don't want to include all them simultaneously, because then the last
> one would win, but you want to source exactly one of them. And then if
> you wnat to change accout without leaving mutt you just source another
> one...

I defined aliases for my accounts in .zshrc, because I do not mind
restarting mutt when switching to a different account:

alias m1='cd ~/Downloads && /opt/homebrew/bin/mutt -F ~/.mutt/account1.cf && cd'
alias m2='cd ~/Downloads && /opt/homebrew/bin/mutt -F ~/.mutt/account2.cf && cd'

For switching e-mail addresses, PGP keys etc within an account, I
adopted a suggestion by Cos:

http://lists.mutt.org/pipermail/mutt-users/Week-of-Mon-20220905/003863.html

I also bind the source commands used in the solution above to message-hooks:

message-hook '~C ^a...@eden.one$' 'source ~/.mutt/default.cf'
message-hook '~C ^x...@eden.one$' 'source ~/.mutt/alternative_address1.cf'

- Jan


signature.asc
Description: PGP signature


Re: Loading several intialisation files at startup

2022-09-15 Thread Sébastien Hinderer
Hello,

Many thanks for your reponse!

Cameron Simpson (2022/09/15 08:27 +1000):
> I thought the common approach was what you next outline: a single muttrc
> which sources the appropriate account-specific muttrc.

[...]

For files that define different thisgs yes, that works. But for
accounts, which have different values for the smae variables, I think
you don't want to include all them simultaneously, because then the last
one would win, but you want to source exactly one of them. And then if
you wnat to change accout without leaving mutt you just source another
one...

Do I make sense?

Sébastien.