Database path discovery in bindings

Tomi Ollila tomi.ollila at iki.fi
Wed Apr 22 11:28:23 PDT 2020


On Sun, Apr 19 2020, Kirill Elagin wrote:

> Hello,
>
> Notmuch contains a bit of logic for “normalising” the database path: it can
> be relative to $HOME and fallsback to $MAILDIR or $HOME/mail. However, this
> logic is implemented in `notmuch_config_open` and is not available through
> bindings. So if a third-party tool wants to discover the database, it will
> either do this incorrectly ([alot]) or will have to roll its own
> implementation ([afew]). Neither option is good.
>
> [alot]: https://github.com/pazz/alot/issues/1396
> [afew]: https://github.com/afewmail/afew/pull/233
>
> Rather than reimplementing it in bindings, I see two possible solutions:
>
> 1. Move the logic to `notmuch_database_open` itself.
> 2. Extract into a separate C function, use it in `notmuch_config_open`, and
> expose through bindings.
>
> What do you think?

There has been thoughts to dump the configuration file, and put the
configuration to the database -- so then the bindings can just open the
database to find the configuration.... oh wait...

In this case we'd find the database in $NOTMUCH_DATABASE_DIR[ECTORY?] or
in $HOME/mail/.notmuch/... if that env var did not exist.

There are at least 2 issues to solve with this approach:

1: SMOP
2: how to edit the configuration using text editor (preserving comments),
   i.e. export and import functionality
3. review latency (especially w/ large patches...) ;/

>
> Cheers,
> Kirill

Tomi


More information about the notmuch mailing list