[PATCH 05/24] CLI: generalize notmuch_config_mode_t

2020-12-24 Thread David Bremner
The renaming and extra values will make sense when we start to convert subcommands to the new configuration framework. It will also avoid collisions with a new enum for configuration keys to be introduced in a future commit. --- notmuch-client.h | 10 ++ notmuch-config.c | 6 +++---

[PATCH 08/24] CLI: add (unused) database argument to subcommands.

2020-12-24 Thread David Bremner
This will allow transitioning individual subcommands to the new configuration framework. Eventually when they are all converted we can remove the notmuch_config_t * argument. For now, live with the parameter shadowing in some some subcommands; it will go away when they are converted. ---

[PATCH 01/24] lib: add _notmuch_string_map_set

2020-12-24 Thread David Bremner
This will be used (and tested) by the configuration caching code to be added in the next commit. --- lib/notmuch-private.h | 5 + lib/string-map.c | 15 +++ 2 files changed, 20 insertions(+) diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 57ec7f72..51016b0b

[PATCH 21/24] cli/tag: convert to new config framework.

2020-12-24 Thread David Bremner
In addition to changing configuration access, change talloc context for allocation. --- notmuch-tag.c | 25 ++--- notmuch.c | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/notmuch-tag.c b/notmuch-tag.c index 205f2733..464874b4 100644 ---

[PATCH 04/24] lib/open: add support for config profiles and default locations

2020-12-24 Thread David Bremner
This commit fills in the remainder of the documented functionality for n_d_open_with_config with respect to config file location. Similar searching default locations of the database file still needs to be added. --- lib/open.cc| 95 + test/T590-libconfig.sh |

[PATCH 11/24] CLI/count: switch to new configuration framework

2020-12-24 Thread David Bremner
The main effort is changing from the old argv style config list iterators to the new more opaque ones provided by the library (and backed by the database+file config cache). --- notmuch-count.c| 48 -- notmuch.c | 2 +- test/T060-count.sh

[PATCH 13/24] lib: add notmuch_config_get_bool

2020-12-24 Thread David Bremner
Booleans have no out of band values, so return a status for errors. --- lib/config.cc | 26 ++ lib/notmuch.h | 19 +++ 2 files changed, 45 insertions(+) diff --git a/lib/config.cc b/lib/config.cc index 4500fe1a..17af4b46 100644 --- a/lib/config.cc +++

[PATCH 02/24] lib: cache configuration information from database

2020-12-24 Thread David Bremner
The main goal is to allow configuration information to be temporarily overridden by a separate config file. That will require further changes not in this commit. The performance impact is unclear, and will depend on the balance between number of queries and number of distinct metadata items read

[PATCH 12/24] cli/dump: convert to new config framework

2020-12-24 Thread David Bremner
This conversion is trivial because the only configuration information accessed by dump is that stored in the database (in order to dump it). We do need to be careful to keep the write lock on the database to ensure dump consistency. --- notmuch-dump.c| 7 +-- notmuch.c

[PATCH 22/24] lib/config: add _notmuch_config_cache

2020-12-24 Thread David Bremner
This is a simple convenience routine to cache a configuration value without writing it to the database. --- lib/config.cc | 5 + lib/notmuch-private.h | 4 2 files changed, 9 insertions(+) diff --git a/lib/config.cc b/lib/config.cc index 17af4b46..99fcda1f 100644 ---

[PATCH 06/24] lib/config: add notmuch_config_key_{get,set}

2020-12-24 Thread David Bremner
By using an enum we can have better error detection than copy pasting key strings around. The question of what layer this belongs in is a bit tricky. Historically most of the keys are defined by the CLI. On the other hand features like excludes are supported in the library/bindings, and it makes

[PATCH 18/24] CLI/{search,address}: convert to new configuration framework

2020-12-24 Thread David Bremner
Since we are already passing a search context around as a kind of parameter block, add a new talloc context to that to replace relying on 'config'. Convert notmuch-search and notmuch-address at the same time, because they share some code. Add a test to make sure we don't break passing

[PATCH 14/24] CLI/restore: convert to new config framework

2020-12-24 Thread David Bremner
Switch one configuration check to new n_c_get_bool function, and switch use of config as talloc context to notmuch. --- notmuch-restore.c | 17 ++--- notmuch.c | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/notmuch-restore.c b/notmuch-restore.c index

[PATCH 15/24] CLI/insert: convert to new config framework.

2020-12-24 Thread David Bremner
The new talloc context is needed to run the hook at the very end of the function. That in turn is needed so that this process gives up the write lock on the database. --- notmuch-insert.c| 59 +++-- notmuch.c | 2 +- test/T070-insert.sh | 8

[PATCH 17/24] CLI/reply: convert to new config framework

2020-12-24 Thread David Bremner
This is messier than some of the other conversions because the extensive use of 'config' as a talloc context. --- notmuch-reply.c| 100 ++--- notmuch.c | 2 +- test/T220-reply.sh | 24 +++ 3 files changed, 74 insertions(+), 52

[PATCH 20/24] CLI/show: mostly switch show to new config framework

2020-12-24 Thread David Bremner
This will need some cleanup when the transition completes, and we stop passing notmuch_config_t structs to the subcommands. Unlike the general case, we open the database in the subcommand, since we don't know whether it should be opened read/write until we parse the command line arguments. Add a

[PATCH 07/24] lib/open: load default values for known configuration keys.

2020-12-24 Thread David Bremner
This emulates the behaviour of notmuch_config_open defined in the CLI, in that it fills in default values if they are not otherwise defined. --- lib/config.cc | 50 +- lib/notmuch-private.h | 3 +++ lib/open.cc| 4

[PATCH 03/24] lib: add stub for notmuch_database_open_with_config

2020-12-24 Thread David Bremner
Initially document the intended API and copy the code from notmuch_database_open_verbose. Most of the documented functionality is not there yet. --- lib/config.cc | 34 ++ lib/notmuch-private.h | 3 + lib/notmuch.h | 138

[PATCH 16/24] cli/reindex: convert new config framework

2020-12-24 Thread David Bremner
The only non-trivial part is switching the talloc context for query_string_from args from 'config' to 'notmuch'. --- notmuch-reindex.c| 9 ++--- notmuch.c| 2 +- test/T700-reindex.sh | 10 ++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git

[PATCH 24/24] cli/compact: convert to new configuration framework

2020-12-24 Thread David Bremner
Switch to the newly created API function notmuch_database_compact_db, which takes the database opened in main(). --- notmuch-compact.c | 7 +++ notmuch.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/notmuch-compact.c b/notmuch-compact.c index

[PATCH 19/24] cli/config: add accessor for config file name

2020-12-24 Thread David Bremner
This is intended for use in temporary code transitioning to the new configuration system. The name is chosen to avoid cluttering the notmuch_config_* namespace further with non-library functions. --- notmuch-client.h | 2 ++ notmuch-config.c | 3 +++ 2 files changed, 5 insertions(+) diff --git

[PATCH 09/24] util: add strsplit_len: simplified strtok with delimiter escaping

2020-12-24 Thread David Bremner
This will be used to make iterators for configuration values. --- util/string-util.c | 23 +++ util/string-util.h | 14 ++ 2 files changed, 37 insertions(+) diff --git a/util/string-util.c b/util/string-util.c index de8430b2..27f8a26b 100644 ---

[PATCH 10/24] lib/config: add config values iterator

2020-12-24 Thread David Bremner
This is intended to avoid duplicating the string splitting and traversal code for all clients of the config API. --- lib/config.cc | 52 ++ lib/notmuch.h | 64 ++ notmuch.c | 35

[PATCH 23/24] lib: split notmuch_database_compact

2020-12-24 Thread David Bremner
The "back end" function takes an open notmuch database, which should know its own path (i.e. the path needs to be cached in the configuration data). --- lib/database.cc | 42 +- lib/notmuch.h | 12 2 files changed, 45 insertions(+), 9

v2 Merged Config

2020-12-24 Thread David Bremner
This is a revised version of the series at id:20200808141653.1124111-1-da...@tethera.net It now converts everything but notmuch-setup and notmuch-config to the new framework, which means that the distinction between configuration stored in the database and that in an auxilary config file is

Re: filtering headers from forwarded messages

2020-12-24 Thread Daniel Kahn Gillmor
On Thu 2020-01-16 15:20:49 -0500, Daniel Kahn Gillmor wrote: > On Wed 2020-01-08 10:25:50 -0500, Daniel Kahn Gillmor wrote: >> Thanks for the pointer! it looks like >> message-forward-{ignored,included}-headers should do (roughly) what i >> want. I'll try them out. > > Just reporting back that

Re: python notmuch2 bindings exclude_tags not added correctly to query

2020-12-24 Thread Floris Bruynooghe
Hi Johannes, On Wed 23 Dec 2020 at 02:34 +0100, Johannes Larsen wrote: > A typo in Database._create_query loses the exclude_tag names during the > string to utf-8 conversion. > > > The problem is fixed by this patch applied to current master (ced341e8): > > diff --git

Re: Adding config cache to notmuch_database_t breaks python-cffi test

2020-12-24 Thread Floris Bruynooghe
On Sun 20 Dec 2020 at 19:22 -0400, David Bremner wrote: Hi David, I'm just catching up on some mailing lists... > David Bremner writes: > >> David Bremner writes: >> >>> I hope Floris (or someone) can tell me what is going on here, I don't >>> understand the memory management in the CFFI

Re: Folder+tags

2020-12-24 Thread Alan Schmitt
On 2020-12-23 12:53, "inwit" writes: > What I would like to, then, is to use notmuch-el to read and classify my > mail. And the functionality I'm missing at the moment is a way to move > an email from the inbox to its corresponding folder, hopefully updating > its folder tags at the same time.