5 months agolib/database: delete stemmer on destroy
David Bremner [Sun, 9 Jan 2022 14:38:05 +0000 (10:38 -0400)]
lib/database: delete stemmer on destroy

Commit [0] left the stemmer object accessible, but did not add
de-allocation code to notmuch_database_destroy. This commit corrects
that oversight.

Leak originally reported by Austin Ray [1].

[0]: 3202e0d1feba1ab955ba1c07098c00208f8f0ada
[1]: id:20220105224538.m36lnjn7rf3ieonc@athena

5 months agolib/config: move g_key_File_get_string before continue
David Bremner [Sun, 9 Jan 2022 14:38:04 +0000 (10:38 -0400)]
lib/config: move g_key_File_get_string before continue

In [1] Austin Ray reported some memory leaks in
notmuch_database_open. One of those leaks is caused by jumping to the
next key without freeing val. This change avoids that leak.

[1]: id:20220105224538.m36lnjn7rf3ieonc@athena

5 months agotest: add known broken test for memory leaks in open
David Bremner [Sun, 9 Jan 2022 14:38:03 +0000 (10:38 -0400)]
test: add known broken test for memory leaks in open

This duplicates the memory leaks reported in [1]

[1]: id:20220105224538.m36lnjn7rf3ieonc@athena

5 months agoconfigure: check for ASAN support
David Bremner [Sun, 9 Jan 2022 14:38:02 +0000 (10:38 -0400)]
configure: check for ASAN support

This will allow conditionally running tests that use the address sanitizer.

5 months agoemacs: use --exclude=false when counting total messages
David Bremner [Wed, 5 Jan 2022 01:06:06 +0000 (21:06 -0400)]
emacs: use --exclude=false when counting total messages

Even if a user excludes a large fraction of their messages, they still
nonetheless exist and are searchable.

5 months agoemacs: use --exclude=false when checking for empty searches
David Bremner [Wed, 5 Jan 2022 01:06:05 +0000 (21:06 -0400)]
emacs: use --exclude=false when checking for empty searches

In particular tags that only occur on otherwise excluded messages do
not show up in "All tags" without this change. The reported numbers
_do_ take excludes into account, so it is possible that
searches (e.g. the aformentioned tags) will show up with a count of

5 months agotest/emacs: add known broken test for hidden tags
David Bremner [Wed, 5 Jan 2022 01:06:04 +0000 (21:06 -0400)]
test/emacs: add known broken test for hidden tags

Gregor Zattler observed that tags could be unintentionally hidden in
the "All tags" view, and Tomi Ollia worked out [2] that the issue was tags
that only occured on excluded messages. This test reproduces that bug.

[1]: id:87wox1vovj.fsf@len.workgroup

5 months agoCLI: print extra headers only for non-replies
David Bremner [Wed, 19 Jan 2022 01:26:45 +0000 (21:26 -0400)]
CLI: print extra headers only for non-replies

If in the future we decide to output extra headers for replies, this
should be controlled by a separate configuration option.

5 months agotest/emacs: known broken test for reply with extra headers set.
David Bremner [Tue, 18 Jan 2022 13:39:05 +0000 (09:39 -0400)]
test/emacs: known broken test for reply with extra headers set.

Although it makes sense for the extra headers to be added to the copy
of the message headers included in the sexp/json, it is a bit
surprising for them to show in the new message constructed for the
reply, especially when, as here, they are always missing/empty.

5 months agoCLI: print extra headers in structured output
David Bremner [Sat, 1 Jan 2022 12:01:36 +0000 (08:01 -0400)]
CLI: print extra headers in structured output

This is based on a patch from Johan Parin [1], which is in turn
responding to a bug report / feature requiest from Jan Malkhovski.

The update to the structured output documented in schemata is intended
to be upward compatible, so the format version stays the same


5 months agolib/config: add known config key "show.extra_headers"
David Bremner [Sat, 1 Jan 2022 12:01:35 +0000 (08:01 -0400)]
lib/config: add known config key "show.extra_headers"

Used in a following commit to enable including extra headers beyond
the default in structured output.

5 months agoCLI: stash pointer to database in sprinter structs
David Bremner [Sat, 1 Jan 2022 12:01:34 +0000 (08:01 -0400)]
CLI: stash pointer to database in sprinter structs

We already use an allocated (and presumably open) database as a talloc
context. Keeping the pointer in the allocated struct will allow us to
e.g. interrogate the configuration in a sprinter function without
threading the database all the way through the various levels of function.

5 months agotest: fix deprecation warning in symbol-test
David Bremner [Sat, 1 Jan 2022 12:47:16 +0000 (08:47 -0400)]
test: fix deprecation warning in symbol-test

Reduce the amount of noise in the build log.

5 months agocli/new: only ignore .notmuch at top level
David Bremner [Sun, 26 Dec 2021 12:24:10 +0000 (08:24 -0400)]
cli/new: only ignore .notmuch at top level

Since the bug was first reported in [1], notmuch has gained the
ability to have the database located outside the mail root, hence this
this change differs slightly from Jani's proposed solution [2] in not
using notmuch_database_get_path, but rather the already retrieved


5 months agotest: add known broken test for ignoring non-toplevel .notmuch
David Bremner [Sun, 26 Dec 2021 12:24:09 +0000 (08:24 -0400)]
test: add known broken test for ignoring non-toplevel .notmuch

In [1] Rob observed that notmuch new ignored directories called
.notmuch everywhere in the tree, where they should only (and now, with
split configs, at most) be ignored at the top level. Add a test to
demonstrate the problem.


5 months agolib/open: no default mail root in split configurations
David Bremner [Sat, 25 Dec 2021 13:33:05 +0000 (09:33 -0400)]
lib/open: no default mail root in split configurations

If we know the configuration is split, but there is no mail root
defined, this indicates a (lack of) configuration error. Currently
this can only arise in XDG configurations.

5 months agolib/config: make sure the config map exists when loading defaults
David Bremner [Sat, 25 Dec 2021 13:33:04 +0000 (09:33 -0400)]
lib/config: make sure the config map exists when loading defaults

We should not rely on one of the other "_notmuch_config_load_*"
functions being called before this one.

5 months agolib/open: use notmuch->params to track split status
David Bremner [Sat, 25 Dec 2021 13:33:03 +0000 (09:33 -0400)]
lib/open: use notmuch->params to track split status

Persisting this status will allow us to use the information in other
compilation units, in particular when setting configuration defaults.

5 months agolib/open: use db struct as talloc ctx for choose_database_path
David Bremner [Sat, 25 Dec 2021 13:33:02 +0000 (09:33 -0400)]
lib/open: use db struct as talloc ctx for choose_database_path

The extra talloc struct "local" was left over from before the notmuch
struct was allocated earlier. Having the notmuch struct available in
this function will allow more flexibility to track the configuration
variations (e.g. split vs. non-split).

5 months agotest/libconfig: add two tests for the config = "" case
David Bremner [Sat, 11 Dec 2021 12:49:12 +0000 (08:49 -0400)]
test/libconfig: add two tests for the config = "" case

If notmuch_database_open_with_config finds a database, but that
database is not in a legacy, non-split configuration, then it
currently incorrectly deduces the mail root and returns SUCCESS. Add
to two tests to demonstrate this bug.

5 months agotest/libconfig: save and restore config file
David Bremner [Sat, 11 Dec 2021 12:49:11 +0000 (08:49 -0400)]
test/libconfig: save and restore config file

Currently the config file is unusable for further tests requiring a
valid database path.

5 months agoemacs/notmuch-tag.el: add xmlns attribute to svg icons
LdBeth [Fri, 14 Jan 2022 13:15:00 +0000 (07:15 -0600)]
emacs/notmuch-tag.el: add xmlns attribute to svg icons

emacs-mac that compiled with OS X system API for image display
support cannot correctly render svg without xmlns parameter [1].


5 months agoMerge remote-tracking branch 'origin/release'
David Bremner [Wed, 12 Jan 2022 17:25:29 +0000 (13:25 -0400)]
Merge remote-tracking branch 'origin/release'

5 months agotest/gpgsm: use --with-colons when calculating fingerprint.
David Bremner [Tue, 11 Jan 2022 23:52:30 +0000 (19:52 -0400)]
test/gpgsm: use --with-colons when calculating fingerprint.

As stressed by the gpg documentation, the non-'with-colons' output
format is subject to change, and indeed it did in 2.3.x (x<=3). This
should make the the test suite more robust against such changes.

5 months agoconfigure: Ignore more options that Fedora spec macros expect
Michael J Gruber [Tue, 11 Jan 2022 10:13:34 +0000 (11:13 +0100)]
configure: Ignore more options that Fedora spec macros expect

Signed-off-by: Michael J Gruber <>
5 months agoemacs: make header line in notmuch-show buffers optional
jao [Mon, 10 Jan 2022 03:05:23 +0000 (03:05 +0000)]
emacs: make header line in notmuch-show buffers optional

New notmuch-show-header-line customizable boolean to allow inhibiting
a header line in notmuch-show-mode buffers (for instance, because one
prefers to just include Subject in notmuch-message-headers).

5 months agoMerge tag '0.34.3'
David Bremner [Sun, 9 Jan 2022 23:34:58 +0000 (19:34 -0400)]
Merge tag '0.34.3'

notmuch 0.34.3 release

5 months agodoc: add 2022 to copyright years. 0.34.3 archive/debian/0.34.3-1 debian/0.34.3-1
David Bremner [Sun, 9 Jan 2022 19:35:52 +0000 (15:35 -0400)]
doc: add 2022 to copyright years.

5 months agoversion: bump to 0.34.3
David Bremner [Sun, 9 Jan 2022 19:35:12 +0000 (15:35 -0400)]
version: bump to 0.34.3

5 months agodebian: changelog for 0.34.3-1
David Bremner [Sun, 9 Jan 2022 19:31:03 +0000 (15:31 -0400)]
debian: changelog for 0.34.3-1

5 months agoNEWS: add NEWS for 0.34.3
David Bremner [Sun, 9 Jan 2022 19:29:05 +0000 (15:29 -0400)]
NEWS: add NEWS for 0.34.3

5 months agobindings/python-cffi: search for config by default
David Bremner [Sat, 8 Jan 2022 21:21:43 +0000 (17:21 -0400)]
bindings/python-cffi: search for config by default

The previous (pre-0.34.2) constructor searched for a config file but
only if the database path was not specified, and only to retrieve
database.path. Neither of the available options (CONFIG.SEARCH or
CONFIG.NONE) matches this semantics exactly, but CONFIG.SEARCH causes
less breakage for people who relied on the old behaviour to set their
database.path [1]. Since it also seems like the friendlier option in
the long run, this commit switches to CONFIG.SEARCH as default.

This requires a certain amount of updating the pytest tests, but most
users will actually have a config file, unlike the test environment.


5 months agoMerge branch 'release'
David Bremner [Sun, 9 Jan 2022 13:20:56 +0000 (09:20 -0400)]
Merge branch 'release'

5 months agopython-cffi: returned OwnedMessage objects from Message.replies
David Bremner [Sat, 8 Jan 2022 14:03:16 +0000 (10:03 -0400)]
python-cffi: returned OwnedMessage objects from Message.replies

If we return regular Message objects, python will try to destroy them,
and the underlying notmuch object, causing e.g. the crash [1].


5 months agotest: add known broken tests for recursive traversal of replies.
David Bremner [Sat, 8 Jan 2022 14:03:15 +0000 (10:03 -0400)]
test: add known broken tests for recursive traversal of replies.

This reproduces the bug reported at [1]. The second test hints at the
solution, making reply return OwnedMessage objects.


5 months agocompletion: use mail_root for path completion in bash/zsh
Cédric Hannotier [Thu, 16 Dec 2021 17:40:53 +0000 (18:40 +0100)]
completion: use mail_root for path completion in bash/zsh

Since mail store and database directory can be different,
path and folder completions must use the directory given by
database.mail_root, not by database.path.

5 months agodoc: mail store is given by database.mail_root
Cédric Hannotier [Thu, 16 Dec 2021 17:40:52 +0000 (18:40 +0100)]
doc: mail store is given by database.mail_root

The mail store directory is given by database.mail_root,
which can be different from database.path.

However, notmuch-insert documentation was still referencing the latter
as the provider of the maildir directory instead of the former.

5 months agobindings/python-cffi: add matched property to message objects
David Bremner [Sat, 1 Jan 2022 14:36:43 +0000 (10:36 -0400)]
bindings/python-cffi: add matched property to message objects

Existing users of the legacy python bindings use
message.get_flags(Message.FLAG.MATCH) to determine which messages in a
thread matched. Since the bindings don't provide get_flags anymore,
they should provide a property analogous to the existing "excluded"

5 months agobuild: move {C,CXX}FLAGS to the end of FINAL_{C,CXX}FLAGS
David Bremner [Fri, 24 Dec 2021 18:29:05 +0000 (14:29 -0400)]
build: move {C,CXX}FLAGS to the end of FINAL_{C,CXX}FLAGS

In addition to avoiding problems with user specified include paths
picking up an installed version of notmuch.h, this should also enable
users to override more options (in particular they could override
warning options since the last one takes effect).


5 months agobuild: move CPPFLAGS after source directory includes.
David Bremner [Fri, 24 Dec 2021 18:29:04 +0000 (14:29 -0400)]
build: move CPPFLAGS after source directory includes.

In [1] Ryan Schmidt reported a problem on macports [2] with notmuch
finding an existing installed version of notmuch.h during the build.

This is a partial fix; the user might also specify -I in CFLAGS.


[2]: The problem does not arise when notmuch.h is installed into a
"system" include path that the compiler searches by default.

5 months agobuild: move LDFLAGS after notmuch libraries.
David Bremner [Fri, 24 Dec 2021 18:29:03 +0000 (14:29 -0400)]
build: move LDFLAGS after notmuch libraries.

In [1] Ryan Schmidt reported a problem on macports [2] with notmuch
finding an existing installed version of libnotmuch during the build
when the user specified LDFLAGS including the libnotmuch install

This change should prevent that.

LDFLAGS also occurs in FINAL_LIBNOTMUCH_LDFLAGS. The only built
library linked to that is util/libtnotmuch_util.a, and that passed as
explicit (relative) path, and is thus not affected by -L.


[2]: The problem does not arise when libnotmuch is installed into a
"system" library path that the compiler/linker searches by default.

5 months agoemacs: update coolj-line-prefix-regexp to make space optional
David Bremner [Sat, 25 Dec 2021 23:31:12 +0000 (19:31 -0400)]
emacs: update coolj-line-prefix-regexp to make space optional

Jani reported that lines prefixed with '>' (as opposed to '> ') are
not highlighted properly [1]. David E responded with a updated regex
[2]. This change implements David E's suggestion.


5 months agoMerge branch 'release'
David Bremner [Wed, 29 Dec 2021 18:20:49 +0000 (14:20 -0400)]
Merge branch 'release'

5 months agoconfigure: calculate NOTMUCH_BUILDDIR, write to Makefile.config
David Bremner [Thu, 23 Dec 2021 01:44:45 +0000 (21:44 -0400)]
configure: calculate NOTMUCH_BUILDDIR, write to Makefile.config

This will correct the current use of an undefined variable when
setting LD_LIBRARY_PATH in doc/Makefile.local

It is tempting to try to replace the use of test/, but
this is not as simple as it looks, as NOTMUCH_BUILDDIR is used to
locate sh.config, so probably cannot also sensibly be used to define

5 months agolib/open: do not consider .notmuch alone as an existing database.
David Bremner [Sat, 25 Dec 2021 21:22:56 +0000 (17:22 -0400)]
lib/open: do not consider .notmuch alone as an existing database.

It makes perfect sense for users to want to pre-create .notmuch,
e.g. to install hooks, so we should handle the case of a .notmuch
directory without an actual xapian database more gracefully.

5 months agotest/new: add known broken test for missing xapian directory.
David Bremner [Sat, 25 Dec 2021 21:22:55 +0000 (17:22 -0400)]
test/new: add known broken test for missing xapian directory.

`notmuch new' should go ahead and create the xapian database if it is
missing, even in the case where the parent .notmuch (or equivalent)
directory exists.

5 months agotest: test folder renames
David Bremner [Sun, 26 Dec 2021 16:20:44 +0000 (12:20 -0400)]
test: test folder renames

In [1] Mark Walters reported a problem with messages being removed
from the database when the parent directory was renamed. Jani Nikula
proposed [2] these tests but observed

   This test is not suitable for merging since it's not deterministic.

After applying Jani's patch [3], the tests now pass deterministically,
and could usefully act as regression tests.


5 months agodoc: add dep. on stamp file for rebuilding gzipped man pages.
David Bremner [Fri, 24 Dec 2021 16:20:31 +0000 (12:20 -0400)]
doc: add dep. on stamp file for rebuilding gzipped man pages.

In [1] Daniel observed that the gzipped man pages were only being
rebuild every second time when building with `make -j4'. This may be
caused by a race condition between sphinx-build rebuilding the roff
files and the recipe to gzip them. This commit sequentializes these
two steps by making the stamp file a prerequisite for (all of) the
gzip files.


6 months agotest: remove directory names from paths in exceptions
David Bremner [Sun, 5 Dec 2021 13:56:03 +0000 (09:56 -0400)]
test: remove directory names from paths in exceptions

These cause failures when building out of tree.

6 months agoemacs: add notmuch-logo.svg and use it in emacs mua on graphic displays
Tomi Ollila [Tue, 21 Dec 2021 23:10:39 +0000 (01:10 +0200)]
emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays

emacs/notmuch-logo.svg is handcrafted scalable vector graphics version
of the notmuch logo.

Emacs on graphic displays render this image four times in size compared
to the emacs/notmuch-logo.png, and the image is much sharper.

The rendered image size, 100x100 pixels, fits reasonably well with
text shown in various font sizes.

Scaling the image -- if desired -- may come in the future. For now
this is improvement on how the logo looked in notmuch-hello window.

6 months agodoc: introduce stamp file for info build
David Bremner [Sat, 4 Dec 2021 23:47:51 +0000 (19:47 -0400)]
doc: introduce stamp file for info build

This partially fixes (i.e. just for sphinx) the problem reported by
Daniel in

6 months agodoc: replace phony target with variable
David Bremner [Sat, 4 Dec 2021 23:47:50 +0000 (19:47 -0400)]
doc: replace phony target with variable

Depending on a phony target seems like a good way to always trigger a

6 months agoemacs/tree: fix docstrings for author faces
Kyle Meyer [Sun, 5 Dec 2021 20:48:36 +0000 (15:48 -0500)]
emacs/tree: fix docstrings for author faces

The docstrings for notmuch-tree-match-author-face and
notmuch-tree-no-match-author-face incorrectly match the docstring of

6 months agoconfigure: have bash_absolute and perl_absolute always defined
Tomi Ollila [Tue, 7 Dec 2021 19:11:41 +0000 (21:11 +0200)]
configure: have bash_absolute and perl_absolute always defined

Since set -u is used, without bash or perl, configure would fail.

This has gone unnoticed as (almost) everyone always had both
bash and perl installed (and in $PATH).

Thanks to FreeBSD ports this bug became visible; this change is
verbatim copy of `patch-configure` in FreeBSD ports tree.

6 months agoMerge tag 'debian/0.34.2-1'
David Bremner [Fri, 10 Dec 2021 22:53:57 +0000 (18:53 -0400)]
Merge tag 'debian/0.34.2-1'

notmuch release 0.34.2-1 for unstable (sid) [dgit]

[dgit distro=debian no-split --quilt=linear]

6 months agodebian: build only against default python version archive/debian/0.34.2-1 debian/0.34.2-1
David Bremner [Fri, 10 Dec 2021 01:26:39 +0000 (21:26 -0400)]
debian: build only against default python version

This problem will will be solved in the next release of dh-python, but
the crude solution is needed for backports anyway.

6 months agoNEWS: mention fix for unprintable python exception 0.34.2
David Bremner [Thu, 9 Dec 2021 12:54:15 +0000 (08:54 -0400)]
NEWS: mention fix for unprintable python exception

6 months agodebian: changelog for 0.34.2-1
David Bremner [Thu, 9 Dec 2021 12:49:46 +0000 (08:49 -0400)]
debian: changelog for 0.34.2-1

6 months agoversion: bump to 0.34.2
David Bremner [Thu, 9 Dec 2021 12:47:15 +0000 (08:47 -0400)]
version: bump to 0.34.2

6 months agoNEWS: add NEWS for 0.34.2
David Bremner [Thu, 9 Dec 2021 12:44:22 +0000 (08:44 -0400)]
NEWS: add NEWS for 0.34.2

6 months agotest/emacs: mark one test as fixed in newer emacs.
David Bremner [Sun, 5 Dec 2021 14:40:07 +0000 (10:40 -0400)]
test/emacs: mark one test as fixed in newer emacs.

The remaining problem in this test is fixed upstream in Emacs
28. While most people are using earlier versions of emacs, the test
still provides some documentation of a known bug.

6 months agopython-cffi: fix out-of-tree build
David Bremner [Sun, 31 Oct 2021 10:03:54 +0000 (07:03 -0300)]
python-cffi: fix out-of-tree build

The main idea is to replace the hack of copying version.txt into the
bindings source with a generated file.

This will mean that the bindings only build after configuring and
building notmuch itself. Given those constraints, "pip install ."
should work.

6 months agoMerge branch 'release'
David Bremner [Sun, 5 Dec 2021 13:02:50 +0000 (09:02 -0400)]
Merge branch 'release'

6 months agoFix error message when using notmuch_status_to_string
Floris Bruynooghe [Sat, 6 Nov 2021 11:02:37 +0000 (12:02 +0100)]
Fix error message when using notmuch_status_to_string

The python exception class was incorrectly loading the error message
which resulted in unprintable exception objects.

6 months agopython-cffi: introduce stamp file
David Bremner [Sat, 30 Oct 2021 20:48:55 +0000 (17:48 -0300)]
python-cffi: introduce stamp file

Although the rebuild does not take long, it is a bit noisy, so assume
if it succeeds once, it doesn't need to re-invoke until the
shared library is rebuilt. This is a partial fix for [1].


6 months agoruby: don't use a directory as a target.
David Bremner [Sat, 30 Oct 2021 20:48:54 +0000 (17:48 -0300)]
ruby: don't use a directory as a target.

The directory is (neccesarily) not updated by the build, so it keeps
trying to build. The proposed fix is to use the name of the dynamic
library containing the extension.  This is a partial fix for the
rebuilding reported at [1].


6 months agoemacs: don't add space to tag completion candidates.
David Bremner [Sat, 23 Oct 2021 17:05:24 +0000 (14:05 -0300)]
emacs: don't add space to tag completion candidates.

Apparently this messes up various third party completion
frameworks. This change does mean that users will have to hit space
after completing a tag change in order to enter another change.

As a bonus, remove the call to #'delete, since
completing-read-multiple already promises to remove empty strings.

6 months agotest/new: replace use of gdb in vanishing file test
David Bremner [Mon, 25 Oct 2021 01:15:15 +0000 (22:15 -0300)]
test/new: replace use of gdb in vanishing file test

Unlike the similar change in T060-new, no symlink creation is needed

6 months agotest/count: replace use of gdb with a LD_PRELOAD shim
David Bremner [Mon, 25 Oct 2021 01:15:14 +0000 (22:15 -0300)]
test/count: replace use of gdb with a LD_PRELOAD shim

There is a certain amount of boilerplate to pass the call on the
original function, so abstract it out as a C preprocessor macro, plus
some extra includes in notmuch-test.h

6 months agotest: move system includes to notmuch-test.h
David Bremner [Thu, 28 Oct 2021 12:32:34 +0000 (09:32 -0300)]
test: move system includes to notmuch-test.h

This removes some redudant includes, and will also make it easier to
introduce "#define _GNU_SOURCE", which must come before all system

6 months agolib/config: use g_key_file_get_string to read config values
David Bremner [Thu, 30 Sep 2021 18:59:54 +0000 (15:59 -0300)]
lib/config: use g_key_file_get_string to read config values

Unlike the previous g_key_file_get_value, this version processes
escape codes for whitespace and \. The remaining two broken tests from
the last commit are because "notmuch config get" treats every value as
a list, and thus the previously introduces stripping of leading
whitespace applies.

6 months agotest: known broken tests for escape characters in config files.
David Bremner [Thu, 30 Sep 2021 18:28:34 +0000 (15:28 -0300)]
test: known broken tests for escape characters in config files.

glib generates the following escape characters with their usual
meanings: \n, \t, \r, and \\, along with \s for _leading_
spaces. Currently notmuch fails to unescape these on reading the
config files. These tests demonstrate this bug; the one new test that
passes is because apparently glib only escapes tabs at the beginning
of a key.

6 months agoconfig: ignore leading/trailing spaces in ';'-delimited lists
David Bremner [Thu, 30 Sep 2021 17:17:48 +0000 (14:17 -0300)]
config: ignore leading/trailing spaces in ';'-delimited lists

In [1] Ciprian observed that it was easy for users to mistakenly
introduce leading and trailing space to new.tags when editing a
notmuch config file. This commit strips spaces on either side of the
';' delimiter when splitting.

In principle it would be possible to support tags (or other config
values) with leading or trailing spaces by processing '\s' escapes in
the input string. Currently such processing is not done.


6 months agotest: known broken tests for leading/trailing ws in config
David Bremner [Thu, 30 Sep 2021 17:17:47 +0000 (14:17 -0300)]
test: known broken tests for leading/trailing ws in config

These tests duplicate the bug/misfeature reported in

6 months agoemacs: run notmuch-search-hook lazily
David Bremner [Mon, 13 Sep 2021 01:03:50 +0000 (22:03 -0300)]
emacs: run notmuch-search-hook lazily

In message id:YT3ueuZHKW931NW3@localhost, Fabio Natali isolated a
visual glitch caused by running notmuch-search-hook too early. This
change moves the running of that hook to
notmuch-search-process-filter, which ensures there is some output in
the buffer before running the hook. Since n-s-p-f can be called many
times for a given buffer, add a buffer local flag to make sure it is
only run once per buffer.

6 months agoMerge branch 'release'
David Bremner [Sat, 4 Dec 2021 13:27:30 +0000 (09:27 -0400)]
Merge branch 'release'

6 months agopython-cffi: switch to notmuch_database_{open,create}_with_config
David Bremner [Sat, 30 Oct 2021 16:22:35 +0000 (13:22 -0300)]
python-cffi: switch to notmuch_database_{open,create}_with_config

Since release 0.32, libnotmuch provides searching for database and
configuration paths. This commit changes the python module notmuch2 to
use those facilities.

This fixes the bug reported in [1], along with a couple of the
deprecation warnings in the python bindings.

Database.default_path is deprecated, since it no longer faithfully
reflects what libnotmuch is doing, and it is also no longer used in
the bindings themselves.

This commit choose the default of config=CONFIG.EMPTY (equivalent to
passing "" to notmuch_database_open_with_config).  This makes the
change upward compatible API-wise (at least as far as the test suite
verifies), but changing the default to CONFIG.SEARCH would probably be
more convenient for bindings users.


6 months agotest: add known broken tests for python bindings in split configs
David Bremner [Sat, 30 Oct 2021 16:22:34 +0000 (13:22 -0300)]
test: add known broken tests for python bindings in split configs

This reproduces the bug(s) reported in

6 months agotest: add python-cffi bindings to path for test_python
David Bremner [Sat, 30 Oct 2021 16:22:33 +0000 (13:22 -0300)]
test: add python-cffi bindings to path for test_python

This will allow testing the new python bindings using test_python, in
addition to the current invocation of pytest.

6 months agopython-cffi: fix typos in docstring for Database.default_path
David Bremner [Sat, 30 Oct 2021 16:22:32 +0000 (13:22 -0300)]
python-cffi: fix typos in docstring for Database.default_path

These generate warnings from sphinx doc, which makes it harder to
debug documentation changes. They also corrupt the output.

6 months agolib/config: don't overwrite database.path if the caller passed it
David Bremner [Thu, 28 Oct 2021 01:34:19 +0000 (22:34 -0300)]
lib/config: don't overwrite database.path if the caller passed it

If the user passed a path, and we opened it, then we consider that
definitive definition of "database.path". This makes libnotmuch
respond more gracefully to certain erroneous combinations of
NOTMUCH_CONFIG settings and config file contents.

6 months agolib/open: track which parameters are passed
David Bremner [Thu, 28 Oct 2021 01:34:18 +0000 (22:34 -0300)]
lib/open: track which parameters are passed

This will be used to fine tune the loading of configuration for
certain special configuration items (initially just "database.path").

6 months agotest: add known broken test for conflict with database parameter
David Bremner [Thu, 28 Oct 2021 01:34:17 +0000 (22:34 -0300)]
test: add known broken test for conflict with database parameter

This is arguably user error: having configuration file with bad
settings in it (and/or having a bad NOTMUCH_CONFIG environment
variable).  On the other hand returning a different path than was
actually opened is definitely a bug.

6 months agotest/libconfig: use 'export' for remaining sets of NOTMUCH_CONFIG
David Bremner [Sat, 4 Dec 2021 00:47:05 +0000 (20:47 -0400)]
test/libconfig: use 'export' for remaining sets of NOTMUCH_CONFIG

It makes the tests easier to understand if we always use export for
environment variables.

6 months agoemacs: drop C-tab binding in hello mode, document <backtab>.
David Bremner [Sat, 30 Oct 2021 18:58:16 +0000 (15:58 -0300)]
emacs: drop C-tab binding in hello mode, document <backtab>.

The <backtab> binding has always been there, but the docs were
apparently mistakenly changed to say <backspace> [1]

Revert to <backtab> in the documentation.

The commit also drops the C-<tab> binding, since it seems redundant
and it interferes with tab-bar-mode.

[1]: 703dec7754da477b5683867c88cb940b8553be91.

6 months agodoc/python-cffi: import from built bindings, not installed module
David Bremner [Fri, 29 Oct 2021 14:54:59 +0000 (11:54 -0300)]
doc/python-cffi: import from built bindings, not installed module

Previously the python-cffi bindings either failed to build, or built
for the wrong module by using the installed module.

The fix requires correction the module path, building the bindings
before docs, and helping python find the built libnotmuch.

Based on patch / discussion from Micheal Gruber [1]


6 months agorename built_with.sexpr_query to built_with.sexp_queries
David Bremner [Sat, 30 Oct 2021 18:49:20 +0000 (15:49 -0300)]
rename built_with.sexpr_query to built_with.sexp_queries

It is confusing to use two different names (sexp vs sexpr) when
compared with the command line option --query=sexp and (furthermore)
singular vs plural when compared with the man page title.

7 months agoMerge tag '0.34.1'
David Bremner [Thu, 4 Nov 2021 19:28:03 +0000 (16:28 -0300)]
Merge tag '0.34.1'

notmuch 0.34.1 release

7 months agodebian: refinalize changelog 0.34.1 archive/debian/0.34.1-1 debian/0.34.1-1
David Bremner [Wed, 3 Nov 2021 13:20:49 +0000 (10:20 -0300)]
debian: refinalize changelog

7 months agoNEWS: finalize release date
David Bremner [Wed, 3 Nov 2021 13:20:08 +0000 (10:20 -0300)]
NEWS: finalize release date

7 months agodebian: changelog for 0.34.1-1
David Bremner [Sun, 31 Oct 2021 11:25:25 +0000 (08:25 -0300)]
debian: changelog for 0.34.1-1

7 months agoNEWS: start news for 0.34.1
David Bremner [Sun, 31 Oct 2021 11:18:38 +0000 (08:18 -0300)]
NEWS: start news for 0.34.1

7 months agoversion: bump to 0.34.1
David Bremner [Sun, 31 Oct 2021 11:11:25 +0000 (08:11 -0300)]
version: bump to 0.34.1

7 months agoemacs: improve notmuch-*-from-current-query docstrings
David Bremner [Sat, 23 Oct 2021 13:12:58 +0000 (10:12 -0300)]
emacs: improve notmuch-*-from-current-query docstrings

Err on the side of providing better user documentation, rather than
documentation for developers.

7 months agoemacs: add minimal docstring for notmuch-unthreaded
David Bremner [Mon, 11 Oct 2021 11:19:21 +0000 (08:19 -0300)]
emacs: add minimal docstring for notmuch-unthreaded

The missing docstring causes a blank in the notmuch-help display
[1]. Since the function is a simple wrapper for notmuch-tree, it seems
fair to forward the reader there for more detailed information.


7 months agolib/open: replace call to deprecated notmuch_database_open_verbose
David Bremner [Sat, 23 Oct 2021 12:27:02 +0000 (09:27 -0300)]
lib/open: replace call to deprecated notmuch_database_open_verbose

Essentially inline the existing shim definition of

7 months agolib/compact: replace deprecated notmuch_database_open_verbose
David Bremner [Sat, 23 Oct 2021 12:27:01 +0000 (09:27 -0300)]
lib/compact: replace deprecated notmuch_database_open_verbose

It should not be necesary to have any config information here, hence
passing "" to n_d_open_with_config.

7 months agoMerge branch 'release'
David Bremner [Sat, 30 Oct 2021 18:01:01 +0000 (15:01 -0300)]
Merge branch 'release'

7 months agolib/load_config: deallocate / NULL database on fatal error
David Bremner [Sat, 23 Oct 2021 13:22:38 +0000 (10:22 -0300)]
lib/load_config: deallocate / NULL database on fatal error

This fixes a potential memory leak, and makes the behaviour of
notmuch_database_load_config (somewhat) consistent with
n_d_{open,create} with config.

7 months agolib/load_config: document expectations for db on error, add tests
David Bremner [Sat, 23 Oct 2021 13:22:37 +0000 (10:22 -0300)]
lib/load_config: document expectations for db on error, add tests

This is a bit different than n_d_{open,create}_with_config, since
there are several non-zero status codes where we do want to return a
non-NULL database structure.