unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Database path discovery in bindings
@ 2020-04-19 18:53 Kirill Elagin
  2020-04-22 18:28 ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill Elagin @ 2020-04-19 18:53 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 815 bytes --]

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?

Cheers,
Kirill

[-- Attachment #1.2: Type: text/html, Size: 1131 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Database path discovery in bindings
  2020-04-19 18:53 Database path discovery in bindings Kirill Elagin
@ 2020-04-22 18:28 ` Tomi Ollila
  2020-04-22 18:48   ` Kirill Elagin
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2020-04-22 18:28 UTC (permalink / raw)
  To: Kirill Elagin, notmuch

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Database path discovery in bindings
  2020-04-22 18:28 ` Tomi Ollila
@ 2020-04-22 18:48   ` Kirill Elagin
  0 siblings, 0 replies; 3+ messages in thread
From: Kirill Elagin @ 2020-04-22 18:48 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

On Wed, Apr 22, 2020 at 9:28 PM Tomi Ollila <tomi.ollila@iki.fi> wrote:
>
> 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.

That sounds reasonable to me.

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

Given that named queries are already stored in the database (even though
considered part of config), it sounds very doable.

> 2: how to edit the configuration using text editor (preserving comments),
>    i.e. export and import functionality

I’m not sure this is relevant, if the configuration is stored in the db.
Especially comments.
Again, named queries as a case in point.
A simple `notmuch config list` is “esport”, `notmuch config set
--batch` can be added.

> 3. review latency (especially w/ large patches...) ;/
>
>
> Tomi

However, all this sounds as an entirely independent proposal, even
though a reasonable one.

It is a much bigger change than potential options for solving the
problem that I raised,
and, most importantly, it doesn’t even solve it, because the
difficulty of discovering the db,
with all the falling-back logic and relative paths would remain
_exactly_ the same.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-22 19:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 18:53 Database path discovery in bindings Kirill Elagin
2020-04-22 18:28 ` Tomi Ollila
2020-04-22 18:48   ` Kirill Elagin

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).