[neomutt-users] sourcing problems

Pietro Cerutti gahr at gahr.ch
Wed Oct 28 22:10:25 CET 2020


On Oct 28 2020, 19:53 UTC, Chris Bennett <cpb_neomutt at bennettconstruction.us> wrote:
>Hi.
>
>I would like to source external files for things like colors and macros,
>etc.
>But every attempt I've made has failed.
>
>My macros and source files for multiple accounts has worked well, except
>that the original sourced default account would not show new mails as
>new, but as O.

This suggets that the mailbox is opened twice. If your setup is based on 
my multi-account config files, you are probably both specifying 
spoolfile (which will cause NeoMutt to open that folder on startup) AND 
running a <change-folder> command because of a "source". Can you please 
double check that?

I have updated my multi-account setup here, in case you want to review 
them and adjust yours accordingly:
https://github.com/neomutt/dyk/blob/master/_dyk/008.md

>Is there something needed, like adding a macro or other thing in order
>to get files to source? Or am I barking up the wrong tree?

One think you need to pay attention to when using "source" is with 
relative paths. When "source" is encountered reading a config file, 
paths are taken to be relative to the file being parsed. When you run 
"source" within a macro, that context is lost, so paths will be relative 
to the current working directory.

I suggest using absolute paths in that case (possibly shortened by ~).  
As an example, the macro I use un my multi-account setup look like this:
macro index <F8> "<enter-command>source ~/.config/neomutt/imap/fastmail.cfg<enter>"

Hope this helps,

-- 
Pietro Cerutti


More information about the neomutt-users mailing list