[PATCH v3 32/34] emacs: Do not abuse advice to monkey patch while testing

2020-08-08 Thread Jonas Bernoulli
Use `cl-letf*' instead. --- test/T310-emacs.sh | 14 -- test/test-lib.el | 8 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 5f74305d..78ac19a8 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -40,12

[PATCH v3 34/34] try-emacs-mua: Trim `require' advice for Emacs 25

2020-08-08 Thread Jonas Bernoulli
- Since Emacs 25 comes with `load-prefer-newer' we can remove the complicated variant of the advice, which implemented a poorman's version of that. - Since Emacs 25 comes with the new advice mechanism, we can use that now for the simple variant of the advice, which just informs about the

[PATCH v3 33/34] emacs: Use new advice mechanism do advice mm-shr

2020-08-08 Thread Jonas Bernoulli
Also because we now only support Emacs >= 25, we can remove the check for Emacs >= 24. --- emacs/notmuch-lib.el | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 91c94781..118faf1e 100644 --- a/emacs/notmuch-lib.el +++

[PATCH v3 31/34] emacs: Drop old advices that were only need for Emacs 23

2020-08-08 Thread Jonas Bernoulli
--- emacs/notmuch-mua.el | 14 -- test/test-lib.el | 17 - 2 files changed, 31 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index f321e0c6..dcddca76 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -425,20 +425,6 @@

[PATCH v3 28/34] emacs: Use cl-incf where appropriate

2020-08-08 Thread Jonas Bernoulli
It's shorter. That's it pretty much. --- emacs/notmuch-hello.el | 2 +- emacs/notmuch-lib.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 876d8ef1..c127bba9 100644 --- a/emacs/notmuch-hello.el +++

[PATCH v3 30/34] emacs: Remove notmuch-read-char-choice

2020-08-08 Thread Jonas Bernoulli
Just use `read-char-choice', which existed since Emacs 24.1. --- emacs/notmuch-compat.el | 56 emacs/notmuch-maildir-fcc.el | 4 +-- 2 files changed, 2 insertions(+), 58 deletions(-) diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el index

[PATCH 15/19] WIP: add config values iterator

2020-08-08 Thread David Bremner
--- lib/config.cc | 49 + lib/notmuch.h | 17 + 2 files changed, 66 insertions(+) diff --git a/lib/config.cc b/lib/config.cc index ca7ac2a8..dd042ab2 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -31,6 +31,11 @@ struct

[PATCH 18/19] WIP converting notmuch search to new style config

2020-08-08 Thread David Bremner
this breaks passing the config file as a command line argument, but that is not currently tested for notmuch-search --- notmuch-search.c | 45 +++-- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index

[PATCH 07/19] test/libconfig; use n_database_open_with_config

2020-08-08 Thread David Bremner
This allows testing the "override database config with file functionality". It also requires passing a config file explicitly to each test program. --- test/T590-libconfig.sh | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/T590-libconfig.sh

Initial implementation of merged config

2020-08-08 Thread David Bremner
This follow-up to id:20200703134338.3311659-1-da...@tethera.net is a first draft of a rewrite of the notmuch configuration system. It aims to remove several annoyances including: - not being able to have certain configuration items in a plain text config file - bindings support for

[PATCH v3 02/34] emacs: Remove excess empty lines

2020-08-08 Thread Jonas Bernoulli
Most people who write lots of lisp tend to only sparsely use empty "separator" lines within forms. In lisp they feel unnecessary and since most files stick to this convention we get a bit confused when there are extra empty lines. It feels like the s-expressions are falling into pieces. All of

[PATCH v3 17/34] emacs: Autoload notmuch-jump using an autoload cookie

2020-08-08 Thread Jonas Bernoulli
Doing that is better than using an `autoload' form because the latter may result in dependencies getting hidden and indeed it turns out we have to declare `notmuch-jump' in "notmuch-tag.el". --- emacs/notmuch-jump.el | 1 + emacs/notmuch-tag.el | 3 +-- 2 files changed, 2 insertions(+), 2

[PATCH v3 01/34] emacs: Shorten long lines

2020-08-08 Thread Jonas Bernoulli
--- emacs/coolj.el | 2 +- emacs/notmuch-address.el | 38 +++-- emacs/notmuch-company.el | 17 -- emacs/notmuch-crypto.el | 16 +++--- emacs/notmuch-draft.el | 12 ++-- emacs/notmuch-hello.el | 43 ++- emacs/notmuch-jump.el

[PATCH v3 08/34] emacs: Use 'when' instead of 'if' when there is no ELSE part

2020-08-08 Thread Jonas Bernoulli
--- emacs/notmuch-address.el | 8 ++-- emacs/notmuch-compat.el | 6 +-- emacs/notmuch-hello.el | 8 ++-- emacs/notmuch-jump.el| 54 ++--- emacs/notmuch-lib.el | 10 ++-- emacs/notmuch-mua.el | 24 +- emacs/notmuch-query.el | 4 +-

[PATCH v3 12/34] emacs: No longer define notmuch-hello-mode-map as a function

2020-08-08 Thread Jonas Bernoulli
It was defined as such for a decade; ever since a56010ac8b89a2489eee5c78469f05cee85ec858 but there wasn't a reason to do that then nor is there now. --- emacs/notmuch-hello.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index

[PATCH v3 16/34] emacs: Autoload notmuch-jump-search only once

2020-08-08 Thread Jonas Bernoulli
This function is being autoloaded using an autoload cookie, so it shouldn't additionally be autoloaded using an `autoload' form. When building libraries we don't actually load the autoloads file and dropping the `autoload' form results in an error, which reveals a so far unspecified dependency:

[PATCH v3 03/34] emacs: Fix indentation

2020-08-08 Thread Jonas Bernoulli
--- emacs/coolj.el | 16 ++--- emacs/notmuch-address.el | 18 +++--- emacs/notmuch-compat.el| 86 - emacs/notmuch-draft.el | 18 +++--- emacs/notmuch-hello.el | 24 +++ emacs/notmuch-lib.el | 56

[PATCH v3 15/34] emacs: Improve doc-strings

2020-08-08 Thread Jonas Bernoulli
- The first sentence should fit on the first line in full. This is even the case when that causes the line to get a bit long. If it gets very long, then it should be made shorter. - Even even the second sentence would fit on the first line, if it just provides some details, then it

[PATCH v3 21/34] .dir-locals.el: Set variables for correct "shell" mode

2020-08-08 Thread Jonas Bernoulli
The major mode used for shell scripts is named 'sh-mode'. 'shell-mode' on the other hand implements an interactive shell in emacs-lisp. --- .dir-locals.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dir-locals.el b/.dir-locals.el index fc75ae61..b3ddffe8 100644 ---

[PATCH v3 05/34] emacs: Only set one variable per setq form

2020-08-08 Thread Jonas Bernoulli
It's a bit weird to avoid having to write the "(setq ... )" more than once, just because we can. In a language that uses '=' for the same purpose we also happily use that once per assignment. While there are no benefit to using just one 'setq' there are some drawbacks. It is not always clear on

[PATCH v3 13/34] emacs: notmuch-poll: Let the user know we are polling

2020-08-08 Thread Jonas Bernoulli
It is done synchronously and it can take a while, so we should let the user know what is going on. --- emacs/notmuch-lib.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 4496ecd2..6ff351d7 100644 --- a/emacs/notmuch-lib.el

[PATCH v3 11/34] emacs: Fix some function declarations

2020-08-08 Thread Jonas Bernoulli
--- emacs/notmuch-tag.el | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index e71de041..1cef17e1 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -32,9 +32,10 @@ (require 'crm) (require 'notmuch-lib)

[PATCH v3 06/34] emacs: Use 'and' instead of 'when' when the return value matters

2020-08-08 Thread Jonas Bernoulli
Also do so for some 'if' forms that lack an ELSE part. Even go as far as using 'and' and 'not' instead of 'unless'. --- emacs/coolj.el | 12 +++--- emacs/notmuch-address.el | 72 ++-- emacs/notmuch-crypto.el | 2 +- emacs/notmuch-draft.el

[PATCH v3 18/34] emacs: Various cosmetic changes

2020-08-08 Thread Jonas Bernoulli
--- emacs/make-deps.el | 3 ++- emacs/notmuch-lib.el| 8 +++- emacs/notmuch-parser.el | 9 +++-- emacs/notmuch-show.el | 18 +++--- emacs/rstdoc.el | 9 - test/test-lib.el| 31 +++ 6 files changed, 34

[PATCH v3 22/34] test: Fix indentation

2020-08-08 Thread Jonas Bernoulli
Fix it to consistently match the style we have configured in ".dir-locals.el". --- test/test-lib.sh | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index 527c9e8b..c23a0d20 100644 --- a/test/test-lib.sh

[PATCH v3 19/34] emacs: Increase consistency of library headers

2020-08-08 Thread Jonas Bernoulli
--- emacs/make-deps.el| 2 +- emacs/notmuch-company.el | 37 +++-- emacs/notmuch-compat.el | 22 +--- emacs/notmuch-crypto.el | 2 +- emacs/notmuch-lib.el | 2 -- emacs/notmuch-maildir-fcc.el | 39

[PATCH v3 24/34] emacs: Provide 'rstdoc' feature at end of file

2020-08-08 Thread Jonas Bernoulli
Features should nearly always be provided at the very end of their libraries. This feature isn't one of the rare exceptions. --- emacs/rstdoc.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el index 41390bbe..63fa2794 100644 ---

[PATCH v3 25/34] emacs: Add end-of-file line to libraries that lack it

2020-08-08 Thread Jonas Bernoulli
--- emacs/notmuch-compat.el | 2 ++ emacs/notmuch-tag.el| 2 ++ 2 files changed, 4 insertions(+) diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el index 9d82a729..370cafa1 100644 --- a/emacs/notmuch-compat.el +++ b/emacs/notmuch-compat.el @@ -107,3 +107,5 @@ (if (fboundp

[PATCH v3 20/34] Fix typos

2020-08-08 Thread Jonas Bernoulli
--- NEWS | 2 +- bindings/python-cffi/notmuch2/__init__.py | 2 +- bindings/python-cffi/notmuch2/_base.py | 6 +++--- bindings/python-cffi/notmuch2/_database.py | 8 bindings/python-cffi/notmuch2/_message.py | 4 ++--

[PATCH v3 09/34] emacs: Use one or three lines for 'if' forms

2020-08-08 Thread Jonas Bernoulli
Putting the COND and THEN parts on the same line but ELSE on a separate line makes it harder to determine if there actually is an ELSE part. --- emacs/notmuch-lib.el | 6 -- emacs/notmuch-tag.el | 3 ++- emacs/notmuch-tree.el | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff

[PATCH v3 07/34] emacs: Use 'unless' instead of 'when' and 'not'

2020-08-08 Thread Jonas Bernoulli
Also use 'unless' in a few cases where previously 'if' was used with 'not' but without an ELSE part. --- emacs/notmuch-hello.el | 6 +++--- emacs/notmuch-mua.el| 4 ++-- emacs/notmuch-parser.el | 2 +- emacs/notmuch-show.el | 3 +-- emacs/notmuch-tag.el| 4 ++-- emacs/notmuch-tree.el

[PATCH v3 00/34] A great number of cosmetic changes

2020-08-08 Thread Jonas Bernoulli
David Bremner writes: > Tomi Ollila writes: >> So we have 3 options: >> >> 1) apply this patch and now drop support for emacs 24 >> >> 2) apply this patch and somehow infor emacs 24 users to install cl-lib from >> ELPA > > I'm fine with either of these options. I'd hope we can specify what >

[PATCH v3 04/34] emacs: Closing parenthesis go on the same line

2020-08-08 Thread Jonas Bernoulli
--- emacs/notmuch-lib.el | 6 ++ emacs/notmuch-show.el | 19 --- emacs/notmuch-tree.el | 4 ++-- emacs/notmuch.el | 6 ++ 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 7994d5ad..f8958a91 100644

[PATCH v3 10/34] emacs: Extend face to window edge again

2020-08-08 Thread Jonas Bernoulli
Since Emacs 27 each face has to be explicitly configured to "extend to the edge of the window". Without doing that the face used for the newline character only has an effect that spans "one character" (i.e. it looks like there is a single trailing space character). We don't want that so extend

[PATCH v3 23/34] .gitignore: Sort using sort-lines

2020-08-08 Thread Jonas Bernoulli
--- .gitignore | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 8f3ebec0..3edd1768 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,20 @@ -/.first-build-message -/Makefile.config -/sh.config -/version.stamp -TAGS

[PATCH v3 14/34] emacs: Use makefile-gmake-mode in Makefile*s

2020-08-08 Thread Jonas Bernoulli
Use `makefile-gmake-mode' instead of `makefile-mode' because the former also highlights ifdef et al. while the latter does not. "./Makefile.global" and one "Makefile.local" failed to specify any major mode at all but doing so is necessary because Emacs does not automatically figure out that these

[PATCH v3 26/34] NEWS: Add stub for 0.31

2020-08-08 Thread Jonas Bernoulli
--- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 9f0db031..3790204b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Notmuch 0.31 (UNRELEASED) += + Notmuch 0.30 (2020-07-10) = -- 2.28.0

[PATCH v3 27/34] NEWS: At least Emacs 25.1 is required now

2020-08-08 Thread Jonas Bernoulli
Some backward incompatible changes follow in the next few commits and going forward contributors don't have to worry about Emacs 24 at all anymore. --- NEWS | 5 + emacs/notmuch-pkg.el.tmpl | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS

[PATCH v3 29/34] emacs: Remove notmuch-setq-local

2020-08-08 Thread Jonas Bernoulli
Just use setq-local, which existed since Emacs 24.3. --- emacs/notmuch-address.el | 4 ++-- emacs/notmuch-company.el | 2 +- emacs/notmuch-compat.el | 8 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index

[PATCH 14/19] WIP: add strsplit_len

2020-08-08 Thread David Bremner
--- 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 --- a/util/string-util.c +++ b/util/string-util.c @@ -24,6 +24,7 @@ #include

[PATCH 04/19] WIP: add notmuch_config_get

2020-08-08 Thread David Bremner
this just accesses the cached config data API is to be decided; maybe we should return a status value. --- lib/config.cc | 6 ++ lib/notmuch.h | 2 ++ test/T590-libconfig.sh | 15 +++ 3 files changed, 23 insertions(+) diff --git a/lib/config.cc

[PATCH 05/19] WIP: add notmuch_config_set

2020-08-08 Thread David Bremner
To be decided: is the write_through paramater a good idea? Should we simplify the API? --- lib/config.cc | 16 lib/notmuch-private.h | 5 + lib/notmuch.h | 5 + lib/string-map.c | 16 test/T590-libconfig.sh | 30

[PATCH 09/19] lib: factor out feature name related code.

2020-08-08 Thread David Bremner
database.cc is uncomfortably large, and some of the static data structures do not need to be shared as much as they are. This is a somewhat small piece to factor out, but it will turn out to be helpful to further refactoring. --- lib/Makefile.local | 3 +- lib/database-private.h | 14

[PATCH 06/19] WIP: initial retrieval of database path from config file

2020-08-08 Thread David Bremner
--- lib/database.cc | 18 ++ 1 file changed, 18 insertions(+) diff --git a/lib/database.cc b/lib/database.cc index 350abb11..2ab9170d 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -935,12 +935,27 @@ notmuch_database_open_with_config (const char *database_path, void

[PATCH 08/19] WIP: add _notmuch_config_load_from_file

2020-08-08 Thread David Bremner
--- lib/config.cc | 34 ++ lib/database.cc| 4 lib/notmuch-private.h | 3 +++ test/T590-libconfig.sh | 23 ++- 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/lib/config.cc b/lib/config.cc index

[PATCH 03/19] lib: cache configuration information from database

2020-08-08 Thread David Bremner
The main goal is to allow configuration information to be temporarily overridden by a separate config file. --- lib/config.cc | 25 + lib/database-private.h | 3 +++ lib/database.cc| 4 lib/notmuch-private.h | 3 +++ 4 files changed, 35

[PATCH 12/19] WIP: adding fallbacks for NULL config_path

2020-08-08 Thread David Bremner
still need to test combinations of NULL and non-NULL arguments --- lib/open.cc| 95 test/T590-libconfig.sh | 138 + 2 files changed, 209 insertions(+), 24 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index

[PATCH 10/19] lib: factor out prefix related code to its own file

2020-08-08 Thread David Bremner
Reduce the size of database.cc, and limit the scope of prefix_table, make sure it's accessed via a well-defined internal API. --- lib/Makefile.local | 4 +- lib/database-private.h | 7 ++ lib/database.cc| 204 ++- lib/prefix.cc | 210

[PATCH 16/19] test: add regression test for searching with alternate config

2020-08-08 Thread David Bremner
Make sure upcoming changes to config handling do not break command line specification. --- test/T140-excludes.sh | 10 ++ 1 file changed, 10 insertions(+) diff --git a/test/T140-excludes.sh b/test/T140-excludes.sh index 0cf69975..cef07095 100755 --- a/test/T140-excludes.sh +++

[PATCH 02/19] lib: add stub for notmuch_database_open_with_config

2020-08-08 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/database.cc | 21 ++-- lib/notmuch.h | 138 ++-- 2 files changed, 127 insertions(+), 32

[PATCH 13/19] lib/config: delay setting talloc destructor

2020-08-08 Thread David Bremner
If Xapian has thrown an exception, it is not safe to invoke the destuctor when freeing the list struct. --- lib/config.cc | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/config.cc b/lib/config.cc index f5def3aa..ca7ac2a8 100644 --- a/lib/config.cc +++

[PATCH 11/19] lib: factor out notmuch_database_open* related code to own file

2020-08-08 Thread David Bremner
Reduce the size of database.cc, and prepare for adding missing features to notmuch_database_open_with_config (to match API documentation already in notmuch.h). --- lib/Makefile.local | 3 +- lib/database.cc| 255 - lib/open.cc| 253

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

2020-08-08 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 19/19] WIP: switch notmuch-show to new config framework

2020-08-08 Thread David Bremner
--- notmuch-show.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index dd836add..094cd689 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1234,6 +1234,7 @@ notmuch_show_command (notmuch_config_t *config, int

[PATCH 01/19] test: use keys with group 'test' in T590-libconfig

2020-08-08 Thread David Bremner
In a future commit we want to interoperate better with glib KeyFiles, which need groups for all keys. --- test/T590-libconfig.sh | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index

Re: [PATCH v2] configure: check for pytest with python -m pytest

2020-08-08 Thread David Bremner
Tomi Ollila writes: > On Mon, Aug 03 2020, Đoàn Trần Công Danh wrote: > >> On different distro, pytest is suffixed with different patterns. >> >> On the other hand, `python3-pytest' could be invoked correctly, >> via `python3 -m pytest', the latter is used by our tests, now. >> >> Switch to

Re: [PATCH v5] Emacs: Ensure left-to-right display for message headers

2020-08-08 Thread David Bremner
Teemu Likonen writes: > In notmuch-show buffer insert invisible U+200E LEFT-TO-RIGHT MARK > character at the beginning of message header paragraph if the From > header contains a right-to-left character. This ensures that the > header paragraph is always rendered in left-to-right mode. > > See