Re: setting NOTMUCH_CONFIG in hooks

Subject: Re: setting NOTMUCH_CONFIG in hooks

Date: Tue, 27 Apr 2021 15:03:46 +0200

To: David Bremner, Uwe Kleine-König, notmuch@notmuchmail.org

Cc:

From: Michael J Gruber


David Bremner venit, vidit, dixit 2021-04-27 14:34:30:
> Uwe Kleine-König <uwe@kleine-koenig.org> writes:
> 
> > Hello,
> >
> > when I run
> >
> >       notmuch --config=$HOME/.notmuch-config-work new
> >
> > NOTMUCH_CONFIG isn't set when the hooks are running. This would however
> > be quite useful such that e.g. afew uses the right database. Of course I
> > could do
> >
> >       NOTMUCH_CONFIG=$HOME/.notmuch-config-work notmuch new
> >
> > instead, but then it would be consequent to drop the --config option
> > from notmuch completely :-)
> >
> 
> It's not the same thing, but seems to relate to your use case. There is
> some new and mostly untested support for a "NOTMUCH_PROFILE" environment
> variable that might help. Or it might have the same issue with
> propagation to hooks. See notmuch-config(1) in master / 0.32~rc1.

Note that a typical use case for a post hook is `notmuch tag` (not just
in the disguise of `afew`), and it is essential that it runs against the
same db and config as the notmuch which is calling the hook.

So, either notmuch should export `NOTMUCH_CONFIG` into the environment
which it runs the hooks in (if overriden by `--config`), or, as Uwe
suggests, and in the light of other variables like `NOTMUCH_PROFILE`,
`--config` could be deprecated so that users automatically do "the right
thing". Seems to be more future proof.

Regards
Michael
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: