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.
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"
property.
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).
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
directory.
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.
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.
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/export-dirs.sh, 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
it.
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.
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.
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.
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.
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
notmuch-tree-match-date-face.
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.
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 setup.py until the
shared library is rebuilt. This is a partial fix for [1].
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].
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
David Bremner [Sat, 23 Oct 2021 13:22:36 +0000 (10:22 -0300)]
lib/create: fix memory leak, ensure *database=NULL on error
This code previously relied on _finish_open to free the notmuch struct
on errors (except for the case of database == NULL, which was a
potential double free). When we removed those frees from _finish_open,
we introduced a (small) memory leak.
In this commit, fix the memory leak, and harmonize the on-error
behaviour with n_d_open_with_config.
David Bremner [Sat, 23 Oct 2021 13:22:34 +0000 (10:22 -0300)]
lib/open: fix potential double-free, ensure *database=NULL on error
During refactoring for 0.32, the code that set notmuch=NULL on various
errors was moved into _finish_open. This meant that the the code which
relied on that to set *database to NULL on error was no longer
correct. It also introduced a potential double free, since the notmuch
struct was deallocated inside _finish_open (via n_d_destroy).
In this commit we revert to "allocator frees", and leave any cleanup
to the caller of _finish_open. This allows us to get back the
behaviour of setting *database to NULL with a small change. Other
callers of _finish_open will need free notmuch on errors.
David Bremner [Sat, 23 Oct 2021 13:22:33 +0000 (10:22 -0300)]
test: add two known broken tests for missing config files
The documentation claims that the database will be set to NULL in this
case, but it is currently not happening. Based on a reproducer [1]
from Austin Ray.
David Bremner [Mon, 11 Oct 2021 12:56:15 +0000 (09:56 -0300)]
doc/sexp-queries: replace definition lists with block quotes.
This document contains meaningful markup in the terms, which makeinfo
complains about. Replace the use of definition lists with regular
paragraphs containing quote blocks. This is accomplished by splitting
the "term" from the definition with a blank line.
David Bremner [Mon, 11 Oct 2021 12:56:14 +0000 (09:56 -0300)]
doc: remove explicit formatting of terms in definition lists
Sphinx-doc already formats the terms appropriately for a given
backend (bold in html and man). `makeinfo` complains noisily about
formatting inside a @item if we add our own explicit formatting.
This change may change the formatting in the info output. On the other
hand, the existing use of quotes for bold is not that great anyway.
In some places blank lines were removed to preserve the logical
structure of a definition list.
David Bremner [Sat, 12 Jun 2021 13:26:17 +0000 (10:26 -0300)]
CLI: move indexopts variable out of shared options block
This reduces the amount of global state. Furthermore, index options
can be set (in principle) in several ways, not just in the one
function for processing indexing command line options.
Jani Nikula [Wed, 13 Oct 2021 14:02:17 +0000 (17:02 +0300)]
cli: remove enum names from typedefs
There are some enum typedefs with the enum name:
typedef enum _name_t { ... } name_t;
We don't need or use the enum names _name_t for anything, and not all
of the enum typedefs have them. We have the typedefs specifically to
use the typedef name.
Jani Nikula [Wed, 13 Oct 2021 14:02:16 +0000 (17:02 +0300)]
lib: remove enum names from typedefs
There are some enum typedefs with the enum name:
typedef enum _name_t { ... } name_t;
We don't need or use the enum names _name_t for anything, and not all
of the enum typedefs have them. We have the typedefs specifically to
use the typedef name.
Jani Nikula [Wed, 13 Oct 2021 14:03:10 +0000 (17:03 +0300)]
lib: fix commented out NOTMUCH_DEPRECATED()
Remove the comment markers from the placeholder NOTMUCH_DEPRECATED(),
added in commit e5f3c3ed5024 ("lib: add stub for
notmuch_database_open_with_config").
David Bremner [Sun, 10 Oct 2021 11:47:58 +0000 (08:47 -0300)]
devel: script for checking a commit (series)
'check-notmuch-commit' is an updated version of a script I have been
using (although not always as consistently as I should) before sending
patches to the list.
Although it requires a bit more tooling, encouraging people to use
check-notmuch-commit might reduce the number of round trips to the
list for style nitpicks.
David Bremner [Thu, 7 Oct 2021 11:59:06 +0000 (08:59 -0300)]
configure: check explicitely for python dev (include) files
As discussed at [1] we have received reports that the implicit check
using cffi.FFI().verify() is not reliable in all environments. Since
we already use pkg-config, and the python dev package should include a
.pc file [2], add an extra check using pkg-config. On at least
Debian, we have to know which version of python dev files with are
looking for, so calculate that first.
[1]: id:87im1g35ey.fsf@tethera.netid:87im1g35ey.fsf@tethera.net,
[2]: checked on Debian and Fedora