]> git.notmuchmail.org Git - notmuch/log
notmuch
2 years 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

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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years agolib/create: fix memory leak, ensure *database=NULL on error
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.

2 years agolib/create: document expectations for db on error, add tests
David Bremner [Sat, 23 Oct 2021 13:22:35 +0000 (10:22 -0300)]
lib/create: document expectations for db on error, add tests

It seems sensible to harmonize the behaviour with
n_d_open_with_config. In this commit we just assert the desired
behaviour.

2 years agolib/open: fix potential double-free, ensure *database=NULL on error
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.

2 years agotest: add two known broken tests for missing config files
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.

[1]: id:20211021190401.imirxau2ewke6e2m@athena

2 years agolib: document n_o_w_config can return NOTMUCH_STATUS_NO_CONFIG
David Bremner [Thu, 21 Oct 2021 14:42:36 +0000 (11:42 -0300)]
lib: document n_o_w_config can return NOTMUCH_STATUS_NO_CONFIG

This should be treated as fatal by callers, since we didn't succeed in
opening a Xapian database.

2 years agoNEWS: fix typo in 0.34 news.
David Bremner [Sun, 24 Oct 2021 10:07:08 +0000 (07:07 -0300)]
NEWS: fix typo in 0.34 news.

Thanks to jrm on IRC for finding the typo.

2 years agotest/libconfig: use 'export' when restoring NOTMUCH_CONFIG
David Bremner [Wed, 27 Oct 2021 13:20:40 +0000 (10:20 -0300)]
test/libconfig: use 'export' when restoring NOTMUCH_CONFIG

This is required when NOTMUCH_CONFIG has been unset, and is harmless
otherwise.

2 years agoNEWS: set date 0.34 archive/debian/0.34-1 debian/0.34-1
David Bremner [Wed, 20 Oct 2021 14:25:31 +0000 (11:25 -0300)]
NEWS: set date

2 years agodebian: changelog for 0.34
David Bremner [Wed, 20 Oct 2021 14:09:00 +0000 (11:09 -0300)]
debian: changelog for 0.34

2 years agoadd NEWS for remaining changes
David Bremner [Wed, 20 Oct 2021 13:51:06 +0000 (10:51 -0300)]
add NEWS for remaining changes

2 years agoversion: bump to 0.34
David Bremner [Wed, 20 Oct 2021 13:31:26 +0000 (10:31 -0300)]
version: bump to 0.34

2 years agoNEWS: update sexp-query news
David Bremner [Wed, 20 Oct 2021 13:26:36 +0000 (10:26 -0300)]
NEWS: update sexp-query news

2 years agoemacs: fix call to nonexistent notmuch--call-process-shell-command
Doug Woos [Mon, 18 Oct 2021 04:30:02 +0000 (21:30 -0700)]
emacs: fix call to nonexistent notmuch--call-process-shell-command

Looks like a find/replace error in e722b4f4

2 years agodebian: add dependency on libsexp-dev 0.34_rc0 archive/debian/0.34_rc0-1 debian/0.34_rc0-1
David Bremner [Fri, 15 Oct 2021 11:52:32 +0000 (08:52 -0300)]
debian: add dependency on libsexp-dev

Enable the s-expression query parser in Debian.

2 years agodebian: add changelog for 0.34~rc0
David Bremner [Fri, 15 Oct 2021 11:51:55 +0000 (08:51 -0300)]
debian: add changelog for 0.34~rc0

2 years agoINSTALL: document optional dependency on libsfsexp
David Bremner [Fri, 15 Oct 2021 11:49:01 +0000 (08:49 -0300)]
INSTALL: document optional dependency on libsfsexp

For now putting it in the apt-get line will cause complaints about
missing packages for too many people.

2 years agoNEWS: stub news for 0.34~rc0
David Bremner [Fri, 15 Oct 2021 11:42:56 +0000 (08:42 -0300)]
NEWS: stub news for 0.34~rc0

This is mostly to pacify the release checks. NEWS will be filled in
during the release process.

2 years agolib: bump lib minor version to 5
David Bremner [Fri, 15 Oct 2021 11:34:39 +0000 (08:34 -0300)]
lib: bump lib minor version to 5

One new function (and an enum) was added to the API/ABI.

2 years agodebian: add new function to symbols file
David Bremner [Fri, 15 Oct 2021 11:34:09 +0000 (08:34 -0300)]
debian: add new function to symbols file

2 years agoversion: bump to 0.34~0
David Bremner [Fri, 15 Oct 2021 11:28:59 +0000 (08:28 -0300)]
version: bump to 0.34~0

Start release process for 0.34.

2 years agodebian: install notmuch-sexp-queries man page
David Bremner [Tue, 12 Oct 2021 11:20:09 +0000 (08:20 -0300)]
debian: install notmuch-sexp-queries man page

This was missed in the series that added the sexp-query parser and
docs.

2 years agoconfigure: whitespace cleanup
David Bremner [Sat, 9 Oct 2021 20:09:16 +0000 (17:09 -0300)]
configure: whitespace cleanup

In order to make it easier to keep the whitespace consistent in the
configure script, use the same style defined in devel/STYLE for
C/C++.

  Specifically, a line should begin with zero or more tabs followed
  by fewer than eight spaces.

Presumably this will be no more difficult for people editing configure
than for people editing the C and C++ code.

2 years agodevel: script for checking a commit (series)
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.

2 years agoconfigure: check explicitely for python dev (include) files
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

2 years agoMerge tag '0.33.2'
David Bremner [Thu, 30 Sep 2021 11:58:48 +0000 (08:58 -0300)]
Merge tag '0.33.2'

notmuch 0.33.2 release

2 years agoversion: bump to 0.33.2 0.33.2
David Bremner [Thu, 30 Sep 2021 11:28:49 +0000 (08:28 -0300)]
version: bump to 0.33.2

2 years agodebian: changelog for 0.33.2-1
David Bremner [Thu, 30 Sep 2021 11:27:37 +0000 (08:27 -0300)]
debian: changelog for 0.33.2-1

2 years agoNEWS: update for 0.33.2
David Bremner [Thu, 30 Sep 2021 11:25:11 +0000 (08:25 -0300)]
NEWS: update for 0.33.2

2 years agotest/T355-smime: Use key as exported by gpgsm
David Bremner [Tue, 28 Sep 2021 01:30:08 +0000 (22:30 -0300)]
test/T355-smime: Use key as exported by gpgsm

As reported in id:87h7pxiek3.fsf@tethera.net, the previous version of
the test is flaky. There is some so-far undebugged interaction between
openssl and gpgsm that causes the keys to fail to import. As a
potential workaround, use the key as exported by gpgsm, and eliminate
openssl from this particular pipeline.

2 years agoemacs: notmuch-tree: customizable strings for drawing trees
jao [Tue, 31 Aug 2021 01:21:06 +0000 (02:21 +0100)]
emacs: notmuch-tree: customizable strings for drawing trees

New customizable variable, notmuch-tree-thread-symbols, that allows
tweaking of how trees in a forest are represented.  For instance, one
can now choose to use an hyphen rather than a white space as a prefix,
or replace the character(s) used to draw arrows.

Amended-By: db; delete errant '3'
2 years agotest/emacs: tests for notmuch-{tree,unthreaded} with bad CWD
David Bremner [Sun, 29 Aug 2021 19:23:35 +0000 (12:23 -0700)]
test/emacs: tests for notmuch-{tree,unthreaded} with bad CWD

These work thanks to the previous wrapping of process creation
primitives.

2 years agoemacs: wrap call-process
David Bremner [Sat, 11 Sep 2021 14:04:08 +0000 (11:04 -0300)]
emacs: wrap call-process

Provide safe working directory

2 years agotest/emacs: test for notmuch-show with nonexistent CWD
David Bremner [Sun, 29 Aug 2021 19:23:33 +0000 (12:23 -0700)]
test/emacs: test for notmuch-show with nonexistent CWD

Somewhat predictably, the other code path in
notmuch-call-notmuch--helper also needs to be fixed.

2 years agoemacs: wrap make-process
David Bremner [Sun, 29 Aug 2021 19:23:32 +0000 (12:23 -0700)]
emacs: wrap make-process

Provide a safe working directory.

2 years agotest/emacs: test for notmuch-search with nonexistent CWD
David Bremner [Sun, 29 Aug 2021 19:23:31 +0000 (12:23 -0700)]
test/emacs: test for notmuch-search with nonexistent CWD

(At least) notmuch-start-notmuch needs to be updated to set a safe
working directory.

2 years agoemacs: wrap call-process-region
David Bremner [Sun, 29 Aug 2021 19:23:30 +0000 (12:23 -0700)]
emacs: wrap call-process-region

As with notmuch--process-lines, initial purpose is to provide a safe
binding for default-directory. This is enough to make notmuch-hello
robust against non-existent or corrupt values default-directory, but
probably not other views.

2 years agoemacs: wrap process-lines
David Bremner [Sun, 29 Aug 2021 19:23:29 +0000 (12:23 -0700)]
emacs: wrap process-lines

Initially just set the working directory, to avoid (the implicit)
call-process crashing when the default-directory points to a
non-existent location.

Use of a macro here is over-engineering for this change, but the same
change needs to be applied to several other process creation
primitives.

2 years agotest/emacs: run notmuch-hello with a nonexisting default dir
David Bremner [Sun, 29 Aug 2021 19:23:28 +0000 (12:23 -0700)]
test/emacs: run notmuch-hello with a nonexisting default dir

This replicates the problem reported in Debian bug #922536.

2 years agotest/emacs: provide macro test-log-error
David Bremner [Sun, 29 Aug 2021 19:23:27 +0000 (12:23 -0700)]
test/emacs: provide macro test-log-error

Because of the way emacs reports errors, a test form can crash and not
change the main buffer. To work around this, capture both signalled
errors and any other messages.

2 years agoMerge tag '0.33.1'
David Bremner [Sat, 11 Sep 2021 00:02:10 +0000 (21:02 -0300)]
Merge tag '0.33.1'

notmuch 0.33.1 release

2 years agodebian: drop debian specific test exclusion 0.33.1 archive/debian/0.33.1-1 debian/0.33.1-1
David Bremner [Fri, 10 Sep 2021 11:30:24 +0000 (08:30 -0300)]
debian: drop debian specific test exclusion

In principle these tests should pass now.

2 years agodebian: changelog for 0.33.1-1
David Bremner [Fri, 10 Sep 2021 11:30:07 +0000 (08:30 -0300)]
debian: changelog for 0.33.1-1

2 years agoNEWS: update for 0.33.1
David Bremner [Fri, 10 Sep 2021 11:28:04 +0000 (08:28 -0300)]
NEWS: update for 0.33.1

2 years agoversion: bump to 0.33.1
David Bremner [Fri, 10 Sep 2021 11:21:28 +0000 (08:21 -0300)]
version: bump to 0.33.1

2 years agolib: use 'localhost' rather than fqdn for default mail address.
David Bremner [Thu, 9 Sep 2021 12:51:03 +0000 (09:51 -0300)]
lib: use 'localhost' rather than fqdn for default mail address.

As discussed in the thread starting at [1], the fully qualified domain
name is a bit tricky to get reproducibly, might reveal information
people prefer to keep private, and somewhat unlikely to provide
reliable mail routing.

The new approach of $current_username@localhost is better for the
first two considerations, and probably at least as good as a test mail
address.

[1]: id:87sfyibqhj.fsf@tethera.net

2 years agotest/emacs: test for functions in notmuch-search-result-format.
David Bremner [Mon, 30 Aug 2021 19:49:06 +0000 (12:49 -0700)]
test/emacs: test for functions in notmuch-search-result-format.

Based on the commit message in id:20210221151902.2301690-3-dme@dme.org

Add the function notmuch-test-result-flags to test-lib.el to avoid
repeating it in 3 T*.sh files.

2 years agoemacs: Allow functions in notmuch-{tree,unthreaded}-result-format
David Edmondson [Sun, 21 Feb 2021 15:19:02 +0000 (15:19 +0000)]
emacs: Allow functions in notmuch-{tree,unthreaded}-result-format

If the car of an element in notmuch-tree-result-format or
notmuch-unthreaded-result-format is a function, insert the result of
calling the function into the buffer.

2 years agoemacs: Allow functions in notmuch-search-result-format
David Edmondson [Sun, 21 Feb 2021 15:19:01 +0000 (15:19 +0000)]
emacs: Allow functions in notmuch-search-result-format

If the car of an element in notmuch-search-result-format is a
function, insert the result of calling the function into the buffer.

This allows a user to generate custom fields in the output of a search
result. For example, with:

(defun -notmuch-result-flags (format-string result)
  (let ((tags-to-letters '(("flagged" . "!")
   ("unread" . "u")
   ("mine" . "m")
   ("sent" . "s")
   ("replied" . "r")))
(tags (plist-get result :tags)))

    (format format-string
    (mapconcat (lambda (t2l)
 (if (member (car t2l) tags)
     (cdr t2l)
   " "))
       tags-to-letters ""))))

(setq notmuch-search-result-format '((-notmuch-result-flags . "%s ")
     ("date" . "%12s ")
     ("count" . "%9s ")
     ("authors" . "%-30s ")
     ("subject" . "%s ")
     ("tags" . "(%s)")))

The first few characters on each line of the search result are used to
show information about some significant tags associated with the
thread.

2 years agoemacs: Use pcase in notmuch-search-insert-field
David Edmondson [Sun, 21 Feb 2021 15:19:00 +0000 (15:19 +0000)]
emacs: Use pcase in notmuch-search-insert-field

Rather than lots of string-equal calls, use the pcase macro.

2 years agoemacs: notmuch-fcc-header-setup: fix regression
Jonas Bernoulli [Mon, 2 Aug 2021 22:10:08 +0000 (00:10 +0200)]
emacs: notmuch-fcc-header-setup: fix regression

With [1: 16b2db09] we lost the (undocumented) option to use no Fcc
header only for From addresses matching a regexp.  This brings back
that feature and documents it.

1: 2021-01-15 16b2db0986ce0ed7c420a69d0a98bb41e9ca4bd8
   emacs: various cosmetic improvements

2 years agoNEWS: typo fix; some trailing periods
Tomi Ollila [Mon, 6 Sep 2021 21:07:11 +0000 (00:07 +0300)]
NEWS: typo fix; some trailing periods

The trailing periods to smaller diff between devel/news2wiki.pl
output and what has been pushed to notmuch-wiki.

2 years agodoc/sexp-queries: update synopsis and description
David Bremner [Tue, 24 Aug 2021 15:17:45 +0000 (08:17 -0700)]
doc/sexp-queries: update synopsis and description

I chose to go with a somewhat terse synopsis to try to keep the length
of the page down.

2 years agoCLI/tag: enable sexp queries
David Bremner [Tue, 24 Aug 2021 15:17:44 +0000 (08:17 -0700)]
CLI/tag: enable sexp queries

We have to rewrite _optimize_tag_query here because it is generating
a query string in the infix Xapian syntax. Luckily this is easy to do
with the sexp query syntax.

2 years agoCLI/{count, dump, reindex, reply, show}: enable sexp queries
David Bremner [Tue, 24 Aug 2021 15:17:43 +0000 (08:17 -0700)]
CLI/{count, dump, reindex, reply, show}: enable sexp queries

The change in each case is to call notmuch_query_create_with_syntax,
relying on the already inherited shared options.  As a bonus we get
improved error handling from the new query creation API.

The remaining subcommand is 'tag', which is a bit trickier.

2 years agoCLI: move query syntax to shared option
David Bremner [Tue, 24 Aug 2021 15:17:42 +0000 (08:17 -0700)]
CLI: move query syntax to shared option

This will allow easy addition of a query syntax option to other subcommands.

2 years agolib/parse-sexp: apply macros
David Bremner [Tue, 24 Aug 2021 15:17:41 +0000 (08:17 -0700)]
lib/parse-sexp: apply macros

Macros implement lazy evaluation and lexical scope.  The former is
needed to make certain natural constructs work sensibly (e.g. (tag
,param)) but the latter is mainly future-proofing in case the DSL is
is extended to allow local bindings.

For technical background, see chapters 6 and 17 of [1] (or some other
intermediate programming languages textbook).

[1] http://cs.brown.edu/courses/cs173/2012/book/

2 years agolib/parse-sexp: thread environment argument through parser
David Bremner [Tue, 24 Aug 2021 15:17:40 +0000 (08:17 -0700)]
lib/parse-sexp: thread environment argument through parser

No functionality change, just an extra argument carried everywhere.

2 years agolib/parse-sexp: support saved s-expression queries
David Bremner [Tue, 24 Aug 2021 15:17:39 +0000 (08:17 -0700)]
lib/parse-sexp: support saved s-expression queries

It turns out there is not really much code in query-fp.cc useful for
supporting the new syntax. The code we could potentially factor out
amounts to calling notmuch_database_get_config; both the key
construction and the parsing of the results are specific to the query
syntax involved.

2 years agoCLI/config support saving s-expression queries
David Bremner [Tue, 24 Aug 2021 15:17:38 +0000 (08:17 -0700)]
CLI/config support saving s-expression queries

This commit does not enable using saved s-expression queries, only
saving and retrieving them from the config file or the database. Use
in queries will be enabled in a following commit.

2 years agolib/parse-sexp: handle saved queries
David Bremner [Tue, 24 Aug 2021 15:17:37 +0000 (08:17 -0700)]
lib/parse-sexp: handle saved queries

This provides functionality analogous to query: in the Xapian
QueryParser based parser. Perhaps counterintuitively, the saved
queries currently have to be in the original query syntax (i.e. not
s-expressions).

2 years agolib: factor out expansion of saved queries.
David Bremner [Tue, 24 Aug 2021 15:17:36 +0000 (08:17 -0700)]
lib: factor out expansion of saved queries.

This is intended to allow use outside of the Xapian query parser.

2 years agolib/parse-sexp: parse user headers
David Bremner [Tue, 24 Aug 2021 15:17:35 +0000 (08:17 -0700)]
lib/parse-sexp: parse user headers

One subtle aspect is the replacement of _find_prefix with
_notmuch_database_prefix, which understands user headers. Otherwise
the code mainly consists of creating a fake prefix record (since the
user prefixes are not in the prefix table) and error handling.

2 years agolib/parse-sexp: support infix subqueries
David Bremner [Tue, 24 Aug 2021 15:17:34 +0000 (08:17 -0700)]
lib/parse-sexp: support infix subqueries

This is necessary so that programs can take infix syntax queries from
a user and use the sexp query syntax to construct e.g. a refinement of
that query.

2 years agolib/parse-sexp: expand queries
David Bremner [Tue, 24 Aug 2021 15:17:33 +0000 (08:17 -0700)]
lib/parse-sexp: expand queries

The code here is just gluing together _notmuch_query_expand with the
existing sexp parser infrastructure.

2 years agolib/thread-fp: factor out query expansion, rewrite in Xapian
David Bremner [Tue, 24 Aug 2021 15:17:32 +0000 (08:17 -0700)]
lib/thread-fp: factor out query expansion, rewrite in Xapian

It will be convenient not to have to construct a notmuch query object
when parsing subqueries, so the commit rewrites the query
expansion (currently only used for thread:{} queries) using only
Xapian. As a bonus it seems about 15% faster in initial experiments.

2 years agolib/query: factor out _notmuch_query_string_to_xapian_query
David Bremner [Tue, 24 Aug 2021 15:17:31 +0000 (08:17 -0700)]
lib/query: factor out _notmuch_query_string_to_xapian_query

When dealing with recursive queries (i.e. thread:{foo}) it turns out
to be useful just to deal with the underlying Xapian objects, and not
wrap them in notmuch objects.

2 years agolib: generate actual Xapian query for "*" and ""
David Bremner [Tue, 24 Aug 2021 15:17:30 +0000 (08:17 -0700)]
lib: generate actual Xapian query for "*" and ""

The previous code had the somewhat bizarre effect that the (notmuch
specific) query string was "*" (interpreted as MatchAll) and the
allegedly parsed xapian_query was "MatchNothing".

This commit also reduces code duplication.

2 years agolib/parse-sexp: support regular expressions
David Bremner [Tue, 24 Aug 2021 15:17:29 +0000 (08:17 -0700)]
lib/parse-sexp: support regular expressions

At least to the degree that the Xapian QueryParser based parser
also supports them. Support short alias 'rx' as it seems to make more
complex queries nicer to read.

2 years agolib: factor out query construction from regexp
David Bremner [Tue, 24 Aug 2021 15:17:28 +0000 (08:17 -0700)]
lib: factor out query construction from regexp

This will allow re-use of this code outside of the Xapian query parser.

2 years agolib/query: generalize exclude handling to s-expression queries
David Bremner [Tue, 24 Aug 2021 15:17:27 +0000 (08:17 -0700)]
lib/query: generalize exclude handling to s-expression queries

In fact most of the code path is in common, only the caching of terms
in the query needs to be added for s-expression queries.

2 years agolib/parse-sexp: handle unprefixed terms.
David Bremner [Tue, 24 Aug 2021 15:17:26 +0000 (08:17 -0700)]
lib/parse-sexp: handle unprefixed terms.

This is equivalent to adding the same field name "" for multiple
prefixes in the Xapian query parser, but we have to explicitely
construct the resulting query.

2 years agolib/parse-sexp: add '*' as syntactic sugar for '(starts-with "")'
David Bremner [Tue, 24 Aug 2021 15:17:25 +0000 (08:17 -0700)]
lib/parse-sexp: add '*' as syntactic sugar for '(starts-with "")'

Users that insist on using a literal '*' as a tag, can continue to do
so by quoting it when searching.

2 years agolib/parse-sexp: 'starts-with' wildcard searches
David Bremner [Tue, 24 Aug 2021 15:17:24 +0000 (08:17 -0700)]
lib/parse-sexp: 'starts-with' wildcard searches

The many tests potentially overkill, but they could catch typos in the
prefixes table. As a simplifying assumption, for now we assume a
single argument to the wildcard operator, as this matches the Xapian
semantics. The name 'starts-with' is chosen to emphasize the supported
case of wildcards in currrent (1.4.x) Xapian.

2 years agolib/parse-sexp: add term prefix backed fields
David Bremner [Tue, 24 Aug 2021 15:17:23 +0000 (08:17 -0700)]
lib/parse-sexp: add term prefix backed fields

We use "boolean" to describe fields that should generate terms
literally without stemming or phrase splitting.  This terminology
might not be ideal but it is already enshrined in
notmuch-search-terms(7).

2 years agolib/parse-sexp: support phrase queries.
David Bremner [Tue, 24 Aug 2021 15:17:22 +0000 (08:17 -0700)]
lib/parse-sexp: support phrase queries.

Anything that is quoted or not purely word characters is considered a
phrase.  Phrases are not stemmed, because the stems do not have
positional information in the database. It is less efficient to scan
the term twice, but it avoids a second pass to add prefixes, so maybe
it balances out. In any case, it seems unlikely query parsing is very
often a bottleneck.

2 years agoutil/unicode: allow calling from C++
David Bremner [Tue, 24 Aug 2021 15:17:21 +0000 (08:17 -0700)]
util/unicode: allow calling from C++

The omission of the 'extern "C"' machinery seems like an oversight.

2 years agolib/parse-sexp: support subject field
David Bremner [Tue, 24 Aug 2021 15:17:20 +0000 (08:17 -0700)]
lib/parse-sexp: support subject field

The broken tests are because we do not yet handle phrase searches.

2 years agolib/parse-sexp: support and, not, and or.
David Bremner [Tue, 24 Aug 2021 15:17:19 +0000 (08:17 -0700)]
lib/parse-sexp: support and, not, and or.

All operations and (Xapian) fields will eventually have an entry in
the prefixes table. The flags field is just a placeholder for now, but
will eventually distinguish between various kinds of prefixes.

2 years agolib/parse-sexp: stem unquoted atoms
David Bremner [Tue, 24 Aug 2021 15:17:18 +0000 (08:17 -0700)]
lib/parse-sexp: stem unquoted atoms

This is somewhat less DWIM than the Xapian query parser, but it has
the advantage of simplicity.

2 years agolib: leave stemmer object accessible
David Bremner [Tue, 24 Aug 2021 15:17:17 +0000 (08:17 -0700)]
lib: leave stemmer object accessible

This enables using the same stemmer in both query parsers.

2 years agolib/parse-sexp: parse single terms and the empty list.
David Bremner [Tue, 24 Aug 2021 15:17:16 +0000 (08:17 -0700)]
lib/parse-sexp: parse single terms and the empty list.

There is not much of a parser here yet, but it already does some
useful error reporting. Most functionality sketched in the
documentation is not implemented yet; detailed documentation will
follow with the implementation.

2 years agolib: add new status code for query syntax errors.
David Bremner [Tue, 24 Aug 2021 15:17:15 +0000 (08:17 -0700)]
lib: add new status code for query syntax errors.

This will help provide more meaningful error messages without special
casing on the client side.

2 years agoCLI/search+address: support sexpr queries
David Bremner [Tue, 24 Aug 2021 15:17:14 +0000 (08:17 -0700)]
CLI/search+address: support sexpr queries

Initially support selection of query syntax in two subcommands to
enable testing.

2 years agolib: define notmuch_query_create_with_syntax
David Bremner [Tue, 24 Aug 2021 15:17:13 +0000 (08:17 -0700)]
lib: define notmuch_query_create_with_syntax

Set the parsing syntax when the (notmuch) query object is
created. Initially the library always returns a trivial query that
matches all messages when using s-expression syntax.

It seems better to select the syntax at query creation time because
the lazy parsing is an implementation detail.

2 years agolib: split notmuch_query_create
David Bremner [Tue, 24 Aug 2021 15:17:12 +0000 (08:17 -0700)]
lib: split notmuch_query_create

Most of the function will be re-usable when creating a query from an
s-expression.

2 years agoconfigure: optional library sfsexp
David Bremner [Tue, 24 Aug 2021 15:17:11 +0000 (08:17 -0700)]
configure: optional library sfsexp

The configure part is essentially the same as the other checks using
pkg-config. Since the optional inclusion of this feature changes what
options are available to the user, include it in the "built_with"
pseudo-configuration keys.

2 years agoCLI: make variable n_requested_db_uuid file scope.
David Bremner [Tue, 24 Aug 2021 15:17:10 +0000 (08:17 -0700)]
CLI: make variable n_requested_db_uuid file scope.

It turns out that now that we pass an open database into the
subcommands, it is easy to check any requested uuid against the
database at the same time as we process the other shared
arguments. This results in overall less boilerplate code, as well as
making a CLI scope function and variable file scope in notmuch.c.

2 years agoMerge branch 'release'
David Bremner [Sat, 4 Sep 2021 18:51:21 +0000 (11:51 -0700)]
Merge branch 'release'

2 years agodebian: changelog for 0.33-2 archive/debian/0.33-2 debian/0.33-2
David Bremner [Sat, 4 Sep 2021 18:30:00 +0000 (11:30 -0700)]
debian: changelog for 0.33-2

2 years agodebian: temporarily disable two subtests
David Bremner [Sat, 4 Sep 2021 18:26:48 +0000 (11:26 -0700)]
debian: temporarily disable two subtests

These are failing on (surprisingly) the Debian amd64
autobuilder. There were also previous reports of failures on Ubuntu
s390x. Fixing this may require changing the way the default is
calculated.

2 years agoMerge branch 'release'
David Bremner [Sat, 4 Sep 2021 15:05:32 +0000 (08:05 -0700)]
Merge branch 'release'

2 years agodebian: add priorversion to removal of obsolete conffile 0.33 archive/debian/0.33-1 debian/0.33-1
David Bremner [Fri, 3 Sep 2021 19:51:39 +0000 (12:51 -0700)]
debian: add priorversion to removal of obsolete conffile

The conffile in question is long gone, no need to retry removing it
forever.

2 years agodebian: changelog for 0.33-1
David Bremner [Fri, 3 Sep 2021 19:26:24 +0000 (12:26 -0700)]
debian: changelog for 0.33-1