]> git.notmuchmail.org Git - notmuch/log
notmuch
2 years agoemacs: remove useless lexically bound variable
David Bremner [Wed, 7 Jul 2021 01:51:08 +0000 (22:51 -0300)]
emacs: remove useless lexically bound variable

A let binding without a value is just an obfuscated way of saying
nil, especially if you are not going to mutate the variable.

2 years agoruby: enable garbage collection using talloc
Felipe Contreras [Mon, 17 May 2021 19:39:15 +0000 (14:39 -0500)]
ruby: enable garbage collection using talloc

We basically steal all the objects from their notmuch parents, therefore
they are completely under Ruby's gc control.

The order at which these objects are freed does not matter any more,
because destroying the database does not destroy all the children
objects, since they belong to Ruby now.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: create an actual wrapper struct
Felipe Contreras [Mon, 17 May 2021 19:39:14 +0000 (14:39 -0500)]
ruby: create an actual wrapper struct

Currently Ruby data points directly to a notmuch object (e.g.
notmuch_database_t), since we don't need any extra data that is fine.

However, in the next commit we will need extra data, therefore we create
a new struct notmuch_rb_object_t wrapper which contains nothing but a
pointer to the current pointer (e.g. notmuch_database_t).

This struct is tied to the Ruby object, and is freed when the Ruby
object is freed by the garbage collector.

We do nothing with this wrapper, so no functionality should be changed.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoperf-test: add ruby test
Felipe Contreras [Sat, 26 Jun 2021 20:07:14 +0000 (15:07 -0500)]
perf-test: add ruby test

Simply list the message-id of all the messages in a loop 100 times.

Suggested-by: David Bremner <david@tethera.net>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoemacs: update declaration of notmuch-tree
David Bremner [Wed, 7 Jul 2021 01:35:30 +0000 (22:35 -0300)]
emacs: update declaration of notmuch-tree

This fixes an a warning from the byte-compiler.  The commit
74ab62a34018b38a40db4d363fff3faae964b47a changed the function
signature but did not update the declaration.

2 years agoemacs: fix typo in variable name
David Bremner [Wed, 7 Jul 2021 01:25:57 +0000 (22:25 -0300)]
emacs: fix typo in variable name

This error crept in during my style rewrite of dkg's proposed change.

2 years agoreplace references to freenode with references to libera
David Bremner [Tue, 6 Jul 2021 20:19:03 +0000 (17:19 -0300)]
replace references to freenode with references to libera

I left the reference to freenode in the test suite data, since it is
historical.

2 years agodoc: new notmuch show --sort and related emacs commands
jao [Fri, 2 Jul 2021 20:44:24 +0000 (21:44 +0100)]
doc: new notmuch show --sort and related emacs commands

New --sort CLI option documented in notmuch-show's man page, and
notmuch-search-toggle-order mentioned in doc/notmuch-emacs.rst and
devel/emacs-keybindings.org (in the latter, there's also some
whitespace changes in a table introduced by org-mode).

2 years agoemacs/tree: command to toggle search sort order in tree mode
jao [Fri, 2 Jul 2021 20:44:23 +0000 (21:44 +0100)]
emacs/tree: command to toggle search sort order in tree mode

New command notmuch-tree-toggle-order for switching the sort order (by
reissuing the search with a different flag) in a notmuch-tree buffer.

2 years agoemacs/hello: honouring :sort-order in threaded queries
jao [Fri, 2 Jul 2021 20:44:22 +0000 (21:44 +0100)]
emacs/hello: honouring :sort-order in threaded queries

Now that notmuch show accepts --sort, we can, on the emacs side, use
it according to the value of :sort-order in the definition of saved
queries.

2 years agoCLI/show: tests for the new --sort option
jao [Fri, 2 Jul 2021 20:44:21 +0000 (21:44 +0100)]
CLI/show: tests for the new --sort option

New unit tests for notmuch show --sort, covering the basic use cases.

2 years agoCLI/show: accept --sort
jao [Fri, 2 Jul 2021 20:44:20 +0000 (21:44 +0100)]
CLI/show: accept --sort

Add the command-line option --sort to the show command of the CLI
notmuch interface, with the same possible values as the same option in
notmuch search.

2 years agotest: deduplicate T590
Michael J Gruber [Tue, 29 Jun 2021 15:29:20 +0000 (17:29 +0200)]
test: deduplicate T590

Test numbers are a concise way to communicate about tests and to remeber
them. Currently, there is one pait of duplicates:

T590-libconfig.sh
T590-thread-breakage.sh

Renumber the latter one to 592 since this keeps the alphabetic order and
leaves room in between.

Signed-off-by: Michael J Gruber <git@grubix.eu>
2 years agoemacs/tree use notmuch-show-single-message
David Bremner [Sat, 26 Jun 2021 12:04:28 +0000 (09:04 -0300)]
emacs/tree use notmuch-show-single-message

This is more efficient than notmuch-show-only-matching-messages, since
we do not parse the potentially large thread structure to find a
single message.

This is only a partial fix for notmuch-tree view, because displaying
the thread structure in the tree-mode window still crashes on long
threads. It is however enough to make unthreaded view handle long
threads.

2 years agoemacs/show: add parameter notmuch-show-single-message
David Bremner [Sat, 26 Jun 2021 12:04:27 +0000 (09:04 -0300)]
emacs/show: add parameter notmuch-show-single-message

This dynamically bound variable can be set when the caller of
notmuch-show guarantees that exactly one message will match the
query. It avoids transporting and parsing the complete thread
structure.

2 years agotest: start test file for emacs unthreaded view.
David Bremner [Sat, 26 Jun 2021 12:04:26 +0000 (09:04 -0300)]
test: start test file for emacs unthreaded view.

Initial focus is on behaviour with large threads.

The second test replicates a bug reported by Alan Schmitt in
id:87lf7sojbq.fsf@m4x.org.

2 years agoemacs: remap send-message and send-message-and-exit
edef [Sun, 13 Jun 2021 08:23:58 +0000 (08:23 +0000)]
emacs: remap send-message and send-message-and-exit

All three of C-c C-c, <menu-bar> <Message> <Send Message>,
and <tool-bar> <Send Message> are bound to message-send-and-exit by
message.el, but notmuch-mua.el only had an explicit override for the
keyboard binding. This mostly manifests as confusing Fcc behaviour for
GUI users.

Patching the bindings for specific keys is rather brittle, since it has
to be aware of every relevant binding. This change switches to instead
using a remap binding, which turns any binding for message-send or
message-send-and-exit into a binding for the corresponding notmuch-mua
command.

2 years agoruby: add keyword arguments to db.query
Felipe Contreras [Mon, 24 May 2021 02:19:09 +0000 (21:19 -0500)]
ruby: add keyword arguments to db.query

That way we don't need pass them to the query object ourselves.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agolib: update transaction documentation
David Bremner [Sat, 22 May 2021 11:07:17 +0000 (08:07 -0300)]
lib: update transaction documentation

Partly this is to recognize the semantics we inherit from Xapian,
partly to mention the new autocommit feature.

2 years agodoc: document database.autocommit variable
David Bremner [Sat, 22 May 2021 01:06:02 +0000 (22:06 -0300)]
doc: document database.autocommit variable

This exposes some database internals that most users will probably not
understand.

2 years agolib: autocommit after some number of completed transactions
David Bremner [Tue, 18 May 2021 02:06:01 +0000 (23:06 -0300)]
lib: autocommit after some number of completed transactions

This change addresses two known issues with large sets of changes to
the database.  The first is that as reported by Steven Allen [1],
notmuch commits are not "flushed" when they complete, which means that
if there is an open transaction when the database closes (or e.g. the
program crashes) then all changes since the last commit will be
discarded (nothing is irrecoverably lost for "notmuch new", as the
indexing process just restarts next time it is run).  This does not
really "fix" the issue reported in [1]; that seems rather difficult
given how transactions work in Xapian. On the other hand, with the
default settings, this should mean one only loses less than a minutes
worth of work.  The second issue is the occasionally reported "storm"
of disk writes when notmuch finishes. I don't yet have a test for
this, but I think committing as we go should reduce the amount of work
when finalizing the database.

[1]: id:20151025210215.GA3754@stebalien.com

2 years agotest: add known broken test for closing with open transaction
David Bremner [Tue, 18 May 2021 10:55:23 +0000 (07:55 -0300)]
test: add known broken test for closing with open transaction

The expected output may need adjusting, but what is clear is that
saving none of the changes is not desirable.

2 years agolib/config: add NOTMUCH_CONFIG_AUTOCOMMIT
David Bremner [Fri, 21 May 2021 15:54:10 +0000 (12:54 -0300)]
lib/config: add NOTMUCH_CONFIG_AUTOCOMMIT

This will be used to control how often atomic transactions are
committed.

2 years agodatabase/close: remove misleading code / comment
David Bremner [Tue, 18 May 2021 11:03:22 +0000 (08:03 -0300)]
database/close: remove misleading code / comment

Unfortunately, it doesn't make a difference if we call
cancel_transaction or not, all uncommited changes are discarded if
there is an open (unflushed) transaction.

2 years agolib/database: fix style mistake.
David Bremner [Sun, 27 Jun 2021 16:52:43 +0000 (13:52 -0300)]
lib/database: fix style mistake.

The spacing of the declaration was wrong in ea30110.

2 years agoemacs: use new face for notmuch-jump and related
Protesilaos Stavrou [Fri, 21 May 2021 16:55:31 +0000 (19:55 +0300)]
emacs: use new face for notmuch-jump and related

The minibuffer-prompt face that was used before made it impossible to
differentiate between two distinct UI elements: (i) the prompt's text
which itself cannot be acted upon, (ii) the actionable keys used to
jump to searches/tags.

The use of a named face, notmuch-jump-key, makes it possible for users
or theme developers to apply properties that are specific to each of
those two cases.

In the interest of backward compatibility, the new face inherits from
minibuffer-prompt.

2 years agoMerge tag '0.32.2'
David Bremner [Sun, 27 Jun 2021 12:34:00 +0000 (09:34 -0300)]
Merge tag '0.32.2'

notmuch 0.32.2 release

2 years agoNEWS: finalize for 0.32.2 0.32.2
David Bremner [Sun, 27 Jun 2021 11:56:21 +0000 (08:56 -0300)]
NEWS: finalize for 0.32.2

2 years agodebian: changelog for 0.32.2-1
David Bremner [Sun, 27 Jun 2021 01:34:30 +0000 (22:34 -0300)]
debian: changelog for 0.32.2-1

2 years agoNEWS: mention fix for memory leak.
David Bremner [Sun, 27 Jun 2021 01:26:09 +0000 (22:26 -0300)]
NEWS: mention fix for memory leak.

2 years agoemacs: Prefer email address over User ID when showing valid signature
Daniel Kahn Gillmor [Thu, 27 May 2021 01:44:59 +0000 (21:44 -0400)]
emacs: Prefer email address over User ID when showing valid signature

Most concrete verification steps are likely only taken on the e-mail
address in the first place, and e-mail addresses render more
intelligibly than arbitrary User IDs in the first place.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Amended-by: db, apply dme restructuring suggestions.
2 years agocli/show: produce "email" element in sigstatus
Daniel Kahn Gillmor [Thu, 27 May 2021 01:44:58 +0000 (21:44 -0400)]
cli/show: produce "email" element in sigstatus

When the certificate that signs a message is known to be valid, GMime
is capable of reporting on the e-mail address embedded in the
certificate.

We pass this information along to the caller of "notmuch show", as
often only the e-mail address of the certificate has actually been
checked/verified.

Furthermore, signature verification should probably at some point
compare the e-mail address of the caller against the sender address of
the message itself.  Having to parse what gmime thinks is a "userid"
to extract an e-mail address seems clunky and unnecessary if gmime
already thinks it knows what the e-mail address is.

See id:878s41ax6t.fsf@fifthhorseman.net for more motivation and discussion.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 years agoMerge branch 'release'
David Bremner [Fri, 25 Jun 2021 12:34:29 +0000 (09:34 -0300)]
Merge branch 'release'

2 years agolib: write talloc report in notmuch_database_destroy
David Bremner [Sat, 19 Jun 2021 00:59:43 +0000 (21:59 -0300)]
lib: write talloc report in notmuch_database_destroy

Since most memory allocation is (ultimately) in the talloc context
defined by a notmuch_database_t pointer, this gives a more complete
view of memory still allocated at program shutdown.

We also change the talloc report in notmuch.c to mode "a" to avoid
clobbering the newly reported log.

2 years agolib/config: fix memory leak
David Bremner [Sat, 19 Jun 2021 00:59:44 +0000 (21:59 -0300)]
lib/config: fix memory leak

This commit fixes a small memory leak (per iterator restart) by
actually using the talloc context intended to be blown away on
restart.

2 years agoversion: bump to 0.32.2
David Bremner [Fri, 25 Jun 2021 12:02:54 +0000 (09:02 -0300)]
version: bump to 0.32.2

2 years agoemacs: Add compatibility for org-msg.el
Ori [Thu, 24 Jun 2021 19:43:58 +0000 (15:43 -0400)]
emacs: Add compatibility for org-msg.el

Enable `notmuch-company` with `org-msg`, which does not derive from
`message-mode` in composing. This change was first proposed in the
discussion here:
https://github.com/jeremy-compostella/org-msg/issues/53

2 years agodoc: tweak hook configuration documentation.
David Bremner [Tue, 22 Jun 2021 23:08:13 +0000 (20:08 -0300)]
doc: tweak hook configuration documentation.

Add a historical note, and hint to look below for more about hooks.
Capitalized the heading for consistency, removed blank line.

2 years agotest/libconfig: make indexing more consistent
David Bremner [Sat, 19 Jun 2021 13:31:16 +0000 (10:31 -0300)]
test/libconfig: make indexing more consistent

The other tests have converted to two digit decimal, the commit does
the same to the remaining test that was printing out indices in hex.

2 years agoMerge branch 'release'
David Bremner [Sun, 20 Jun 2021 20:15:20 +0000 (17:15 -0300)]
Merge branch 'release'

2 years agoNEWS: fix typo
David Bremner [Sun, 20 Jun 2021 19:59:30 +0000 (16:59 -0300)]
NEWS: fix typo

Oops. Apparently our release checks do not check the spelling of
UNRELEASED (although Tomi's wiki conversion script does).

2 years agoNEWS: start NEWS for 0.32.2
David Bremner [Sun, 20 Jun 2021 19:41:03 +0000 (16:41 -0300)]
NEWS: start NEWS for 0.32.2

2 years agoemacs: require seq for seq-some
David Bremner [Tue, 8 Jun 2021 23:12:33 +0000 (20:12 -0300)]
emacs: require seq for seq-some

Although the function dates from 2015, the autoload is newer. In
particular [1] it is not found in Emacs 25.3.

[1]: id:874ke85tqx.fsf@cgc-instruments.com

2 years agotest: check openssl prequisite for add_gpgsm_home
David Bremner [Tue, 8 Jun 2021 19:39:10 +0000 (16:39 -0300)]
test: check openssl prequisite for add_gpgsm_home

This is a fix for the test failures reported by Dan Čermák [1].

It is more robust to check for the prerequisite inside the function
that uses it, rather than in every test file that calls the function.

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

2 years agotest: aggregate-results updates
Tomi Ollila [Mon, 17 May 2021 08:11:09 +0000 (11:11 +0300)]
test: aggregate-results updates

notmuch-test will now call aggregate-results.sh with file list
that it compiles based on the test ran, and aggregate-results
will report failure is any of the test files are missing.

With this notmuch-test no longer has to exit in non-parallel
run if some test fail to write its report file -- so it works
as parallel tests in this sense.

Changed test_done() in test-lib.sh write report file in one write(2),
so there is (even) less chance it being partially written. Also,
now it writes 'total' last and aggregate-results.sh expects this
line to exist in all report files for reporting to be successful.

Added 'set -eu' to notmuch-test and modified code to work with
these settings. That makes it harder to get mistakes slipped
into committed code.

2 years agolib/message: use passed database for error handling
David Bremner [Mon, 24 May 2021 00:08:29 +0000 (21:08 -0300)]
lib/message: use passed database for error handling

'message' should always be initialized if we reach here, but in case it
is not, we still want to be able to log an error message.

2 years agolib/{open,message}: make some internal functions static
David Bremner [Mon, 24 May 2021 00:08:28 +0000 (21:08 -0300)]
lib/{open,message}: make some internal functions static

They are not used outside their file, so being extern seems like an oversight

2 years agoemacs: update default mailing list archives for stashing links
Jani Nikula [Fri, 21 May 2021 12:51:26 +0000 (15:51 +0300)]
emacs: update default mailing list archives for stashing links

Gmane web interface is long gone, remove it. Make MARC the new
default. Update LKML to Lore, where it already redirects anyway. Also
add Notmuch web archive.

2 years agotest: add known broken test for indexing RFC822 group names
David Bremner [Wed, 24 Mar 2021 00:24:05 +0000 (21:24 -0300)]
test: add known broken test for indexing RFC822 group names

Austin Clements diagnosed this indexing problem in [1].

[1]: id:20130711215207.GR2214@mit.edu

2 years agoemacs: fix declare-function definitions with related line breaks
Tomi Ollila [Sat, 16 Jan 2021 17:17:09 +0000 (19:17 +0200)]
emacs: fix declare-function definitions with related line breaks

- declare-function notmuch-unthreaded lacked file name
- declare-function notmuch-search had differently named last arg
  - note: check-declare-directory did not complain about that
- declare-function notmuch-search-show-thread without nil
- some functions declared to be in different file than those
  existed ("notmuch" -> "notmuch-lib")

- some related function/declare lines were (/are now) wider than
  80-columns; added line breaks (and proper indentation) there

2 years agoemacs: drop setting mail-user-agent, and document how to set it
David Bremner [Fri, 4 Jun 2021 23:05:31 +0000 (20:05 -0300)]
emacs: drop setting mail-user-agent, and document how to set it

After some discussion [1], I decided it is better to make notmuch users
who rely on this behaviour customize mail-user-agent. This is
consistent with the behaviour of other emacs mail packages.

[1]: id:87k0nuhfrk.fsf@toryanderson.com

2 years agotest: source $NOTMUCH_SRCDIR/test/test-lib-emacs.sh
Tomi Ollila [Sun, 23 May 2021 07:34:43 +0000 (10:34 +0300)]
test: source $NOTMUCH_SRCDIR/test/test-lib-emacs.sh

Sourcing test-lib.sh will cd to TMP_DIRECTORY, so
relative path in $0 will not work in previous version
 . $(dirname "$0")/test-lib-emacs.sh

Now individual test scripts -- e.g. ./test/T310-emacs.sh
will work.

2 years agoMerge remote-tracking branch 'origin/release'
David Bremner [Mon, 31 May 2021 23:26:31 +0000 (20:26 -0300)]
Merge remote-tracking branch 'origin/release'

2 years agoNEWS/emacs: document changes in 0.32 that affect keybindings.
Daniel Kahn Gillmor [Thu, 27 May 2021 16:58:37 +0000 (12:58 -0400)]
NEWS/emacs: document changes in 0.32 that affect keybindings.

See list discussion in thread starting with
id:87h7ip2baq.fsf@fifthhorseman.net for more details.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Amended-by: David Bremner (s/.emacs/Emacs configuration/)
2 years agoruby: use notmuch_exclude_t enum
Felipe Contreras [Sat, 1 May 2021 12:04:46 +0000 (07:04 -0500)]
ruby: use notmuch_exclude_t enum

It exists since 2013, let's allow it to be used in Ruby.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agotest: add regression test for large number of deletions
David Bremner [Sat, 24 Apr 2021 23:02:43 +0000 (20:02 -0300)]
test: add regression test for large number of deletions

Prior to 9ad19e4454f there was an unhandled Xapian exception when
reindexing after a large number of deletes.  This test was used for
bisection, and will subsequently serve as a regression test.

2 years agoperf-test: add test for reindexing after removal/renaming msgs
David Bremner [Sat, 24 Apr 2021 17:46:18 +0000 (14:46 -0300)]
perf-test: add test for reindexing after removal/renaming msgs

At this point it is a bit tricky to measure the performance increase
from the new message deletion code, since the same commit (9ad19e4)
that improved the performance also seems to have fixed a bug with an
uncaught Xapian exception triggered by this test.

2 years agotest: say_color() in one write(2)
Tomi Ollila [Thu, 6 May 2021 14:12:32 +0000 (17:12 +0300)]
test: say_color() in one write(2)

say_color() used to call (builtin) printf (and tput(1) to stdout)
several times, which caused attempts to write messages with color
to have partial content (e.g. escape sequences) often intermixed
with other tests when parallel tests were run.

Now, with all output collected, then written out using one
printf, all strings with color print out correctly
((at least short) write(2)'s appear to write out "atomically").

While at it, used only one tput(1) execution to determine whether
color output works, and made bold/colors/sgr0 to tput(1) their
values once per test.

2 years agotest: quiet some extra debugging output
David Bremner [Sun, 16 May 2021 14:10:15 +0000 (11:10 -0300)]
test: quiet some extra debugging output

This output does not cause test failures, but may make it harder to
interpret the output.

2 years agotest: ignore debugging messages
David Bremner [Sun, 16 May 2021 12:37:40 +0000 (09:37 -0300)]
test: ignore debugging messages

Previously building with "-DDEBUG" broke the test suite in several places.

2 years agolib/thread: add common prefix to debug messages, join lines
David Bremner [Sun, 16 May 2021 14:10:13 +0000 (11:10 -0300)]
lib/thread: add common prefix to debug messages, join lines

This will simplify filtering these message, e.g. in the test suite.

2 years agodoc: example command-line option reference
Jani Nikula [Fri, 21 May 2021 20:44:13 +0000 (23:44 +0300)]
doc: example command-line option reference

Example reference to a command-line option using the option role
reference. This creates a hyperlink in html, and the usual boldface
style in man page. This could be used throughout the man pages.

2 years agodoc: use program and option directives to document options
Jani Nikula [Fri, 21 May 2021 20:44:12 +0000 (23:44 +0300)]
doc: use program and option directives to document options

Use the program and option directives to document the subcommand
options. This unifies a lot of option documentation throughout.

This also makes it possible to reference options with :option:`--foo`
(within .. program::) or :option:`subcommand --foo` (globally). This
is left for later work.

See https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-program

Note: There is a lot of indentation change, but intentionally there is
no reflow. Using 'git diff -w' or 'git show -w' to ignore white space
changes makes this a very easy change to review.

2 years agodoc: use envvar directive and role for environment variables
Jani Nikula [Fri, 21 May 2021 20:44:11 +0000 (23:44 +0300)]
doc: use envvar directive and role for environment variables

Make man1/notmuch.rst the single point of truth for describing notmuch
environment variables. Use the envvar directive for that, and
reference them with the envvar role.

Drive-by cleanup configuration file and hook directory search order
documentation.

2 years agodoc: cross-reference notmuch man pages with actual links
Jani Nikula [Fri, 21 May 2021 20:44:10 +0000 (23:44 +0300)]
doc: cross-reference notmuch man pages with actual links

Add internal hyperlink targets for man pages and cross-reference them
using the any role reference. There are a number of alternatives to
accomplish this, but this seems like the combination that retains the
man page section number and the same boldface style in the man pages.

As a bonus, we get sanity checking on the links; for example
notmuch-search-terms.rst had a reference to notmuch-properties(1)
i.e. the wrong section.

The obvious semantic follow-up change would be to only have meaningful
"see also" references instead of having them all everywhere.

2 years agotest: replace notmuch_passwd_sanitize() with _libconfig_sanitize()
Tomi Ollila [Sat, 22 May 2021 13:39:57 +0000 (16:39 +0300)]
test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()

notmuch_passwd_sanitize() in test-lib.sh is too generic, it cannot
work in many cases...

The more specific version _libconfig_sanitize() replaces it in
T590-libconfig.sh and the code that uses it is modified to output
the keys (ascending numbers printed in hex) so the sanitizer knows
what to sanitize in which lines...

"@" + fqdn -> "@FQDN" replacement is used as fqdn could
-- in theory -- be substring of 'USERNAME'.

'user -> 'USER_FULL_NAME replacement to work in cases where user
is empty -- as only first ' is replaced that works as expected.

In addition to ".(none)" now also ".localdomain" is filtered from
USERNAME@FQDN.

/dev/fd/{n} is not defined in posix, but it is portable enough
(if it weren't it is easy to fix -- now code looks clearer).

2 years agodoc: use manpage role references to external man pages
Jani Nikula [Fri, 21 May 2021 20:44:09 +0000 (23:44 +0300)]
doc: use manpage role references to external man pages

Using manpage role references generates helpful links in html
documentation, while retaining the same boldface style in the man
pages.

The external man page site is configurable. The Debian manpage site
seems like a good fit for Notmuch.

2 years agoMerge branch 'release'
David Bremner [Sat, 22 May 2021 12:34:55 +0000 (09:34 -0300)]
Merge branch 'release'

2 years agoruby: improve compilation with CFLAGS
Felipe Contreras [Mon, 17 May 2021 05:47:46 +0000 (00:47 -0500)]
ruby: improve compilation with CFLAGS

The ruby MakeMakefile generates a makefile that is suboptimal, which has
CFLAGS like this:

  CFLAGS   = $(CCDLFLAGS) -march=x86-64 -mtune=generic \
    -O2 -pipe -fno-plt -fPIC $(ARCH_FLAG)

This works as long as the user doesn't modify the Makefile.

Certain flags (namely -fPIC) need to be present regardless of what
CFLAGS are specified.

The Makefile should have done this instead:

  CFLAGS = -march=x86-64 -mtune=generic -O2
  override CFLAGS += $(CCDLFLAGS) -pipe -fno-plt -fPIC $(ARCH_FLAG)

Unfortunately they didn't, so we need to workaround their lack of
foresight.

We can simply add the necessary flags in the parent Makefile so everyone
is happy.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agolib/n_d_index_file: re-use thread-id of existing message
David Bremner [Sat, 15 May 2021 18:40:22 +0000 (15:40 -0300)]
lib/n_d_index_file: re-use thread-id of existing message

This prevents the message document getting multiple thread-id terms
when there are multiple files with the same message-id.

This change shifts some thread ids, requiring adjustments to other tests.

2 years agotest: add known broken test for duplicate thread-id terms
David Bremner [Sat, 15 May 2021 13:05:07 +0000 (10:05 -0300)]
test: add known broken test for duplicate thread-id terms

According to my bijection, this bug has been present since commit
411675a6ce in 2017. It is not completely clear what harm it causes in
regulary use, but it (at least) makes notmuch crash when compiled with
-DDEBUG_DATABASE_SANITY.

2 years agoCLI/new: check status of notmuch_message_maildir_flags_to_tags
David Bremner [Sat, 8 May 2021 23:03:28 +0000 (20:03 -0300)]
CLI/new: check status of notmuch_message_maildir_flags_to_tags

This improves error reporting since it prints the specifics of the exception.

2 years agoperf-test/T00-new: fix backup creation.
David Bremner [Sat, 8 May 2021 13:57:35 +0000 (10:57 -0300)]
perf-test/T00-new: fix backup creation.

"xargs tar cf backup.tar < $manifest" recreates the tar file with each
"batch" execed by xargs. In general this results in only a fraction of
the desired files being backed up.

2 years agodoc: fix variable name in documentation
Luis Henriques [Wed, 19 May 2021 11:08:18 +0000 (12:08 +0100)]
doc: fix variable name in documentation

Variable 'notmuch-saved-searches-sort-function' does not exist;
'notmuch-saved-search-sort-function' is the correct name.

Signed-off-by: Luis Henriques <henrix@camandro.org>
2 years agodoc: fix man page build for Sphinx 4.x
Jani Nikula [Tue, 18 May 2021 21:40:44 +0000 (00:40 +0300)]
doc: fix man page build for Sphinx 4.x

Sphinx 4.0 changed the default value of man_make_section_directory
from False to True. We create the section directories and move the
files manually, so fix the immediate man build failure by disabling
the feature.

The Sphinx documentation on this [1] is confusing, and has the change
backwards. Git history says the default changed from False to True.

[1] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-man_make_section_directory

2 years agoperf-test/T00-new: fix backup creation.
David Bremner [Sat, 8 May 2021 13:57:35 +0000 (10:57 -0300)]
perf-test/T00-new: fix backup creation.

"xargs tar cf backup.tar < $manifest" recreates the tar file with each
"batch" execed by xargs. In general this results in only a fraction of
the desired files being backed up.

2 years agodoc: fix variable name in documentation
Luis Henriques [Wed, 19 May 2021 11:08:18 +0000 (12:08 +0100)]
doc: fix variable name in documentation

Variable 'notmuch-saved-searches-sort-function' does not exist;
'notmuch-saved-search-sort-function' is the correct name.

Signed-off-by: Luis Henriques <henrix@camandro.org>
2 years agodoc: fix man page build for Sphinx 4.x
Jani Nikula [Tue, 18 May 2021 21:40:44 +0000 (00:40 +0300)]
doc: fix man page build for Sphinx 4.x

Sphinx 4.0 changed the default value of man_make_section_directory
from False to True. We create the section directories and move the
files manually, so fix the immediate man build failure by disabling
the feature.

The Sphinx documentation on this [1] is confusing, and has the change
backwards. Git history says the default changed from False to True.

[1] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-man_make_section_directory

2 years agotest: split emacs functionality to its own file
Felipe Contreras [Sat, 15 May 2021 20:47:44 +0000 (15:47 -0500)]
test: split emacs functionality to its own file

This way it's easier to identify the tests that do require emacs stuff.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agotest: emacs: fix a couple of shellcheck complaints
Felipe Contreras [Sat, 15 May 2021 20:47:43 +0000 (15:47 -0500)]
test: emacs: fix a couple of shellcheck complaints

In test-lib-emacs.sh line 20:
    test_require_external_prereq ${TEST_EMACS} || ret=1
                                 ^-----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    test_require_external_prereq "${TEST_EMACS}" || ret=1

In test-lib-emacs.sh line 21:
    test_require_external_prereq ${TEST_EMACSCLIENT} || ret=1
                                 ^-----------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    test_require_external_prereq "${TEST_EMACSCLIENT}" || ret=1

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agotest: emacs: check for configured emacs
Felipe Contreras [Sat, 15 May 2021 20:47:42 +0000 (15:47 -0500)]
test: emacs: check for configured emacs

Commit d59d9c81 (test: Make the emacsclient binary user-configurable,
2012-11-27) modified the prereq check for the configured emacsclient,
but we probably want to do the same for emacs itself.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agotest: emacs: simplify missing dependencies check
Felipe Contreras [Sat, 15 May 2021 20:47:41 +0000 (15:47 -0500)]
test: emacs: simplify missing dependencies check

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agotest: more style fixes
Felipe Contreras [Sat, 15 May 2021 20:47:40 +0000 (15:47 -0500)]
test: more style fixes

In order to fit the git coding style.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agotest: trivial style cleanups
Felipe Contreras [Sat, 15 May 2021 20:47:39 +0000 (15:47 -0500)]
test: trivial style cleanups

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: new notmuch_rb_object_destroy() helper
Felipe Contreras [Sat, 15 May 2021 21:21:03 +0000 (16:21 -0500)]
ruby: new notmuch_rb_object_destroy() helper

The struct used to store the types (rb_data_type_t) contains a "data"
field where we can store whatever we want. I use that field to store a
pointer to the corresponding destroy function. For example
notmuch_rb_database_type contains a pointer to notmuch_database_destroy.

I cast that pointer as a notmuch_status_t (func*)(void *) and call
that function passing the internal object (e.g. notmuch_database_t).

Using the rb_data_type_t data we can call the correct notmuch destroy
function.

Therefore this:

  ret = ((notmuch_status_t (*)(void *)) type->data) (nm_object);

Is effectively the same as this:

  ret = notmuch_database_destroy (database);

The advantage of doing it this way is that much less code is necesary
since each rb_data_type_t has the corresponding destroy function stored
in it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: add all data types
Felipe Contreras [Sat, 15 May 2021 21:21:02 +0000 (16:21 -0500)]
ruby: add all data types

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: move towards more modern RTypedData
Felipe Contreras [Sat, 15 May 2021 21:21:01 +0000 (16:21 -0500)]
ruby: move towards more modern RTypedData

Virtually the whole ruby core moved from RData to RTypeData, let's do so
ourselves too.

Basically the information typically passed through Data_Wrap_Struct is
now stored in a struct rb_data_type_t (mark and free functions). This
has the advantage that more information can be easily added, like the
name of the type, a custom data ponter, and more.

Data_Wrap_Struct is replaced with TypedData_Wrap_Struct, and the
information is stored in a struct rb_data_type_t, rather than passed
as arguments.

Check_Type is replaced with Check_TypedStruct, which is a wrapper for
rb_check_typeddata (with casts).

        #define Check_TypedStruct(v, t)      \
            rb_check_typeddata(RBIMPL_CAST((VALUE)(v)), (t))

We can use rb_check_typeddata directly, just like we use rb_data_object_get
directly.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: create Data_Wrap_Notmuch_Object helper
Felipe Contreras [Sat, 15 May 2021 21:21:00 +0000 (16:21 -0500)]
ruby: create Data_Wrap_Notmuch_Object helper

This makes the code more maintainable and will help in further patches.

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: add unlikely hint
Felipe Contreras [Sat, 15 May 2021 21:20:59 +0000 (16:20 -0500)]
ruby: add unlikely hint

The error path is very unlikely.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: fetch class name in case of error
Felipe Contreras [Sat, 15 May 2021 21:20:58 +0000 (16:20 -0500)]
ruby: fetch class name in case of error

There is not much point in complicating the code for error messages that
can be easily constructed.

Before:

  database closed (RuntimeError)

After:

  Notmuch::Database object destroyed (RuntimeError)

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoruby: simplify data get helper
Felipe Contreras [Sat, 15 May 2021 21:20:57 +0000 (16:20 -0500)]
ruby: simplify data get helper

Data_Get_Struct is nothing but a macro that calls
rb_data_object_get with a cast (unnecessary in C).

        #define Data_Get_Struct(obj, type, sval) \
            ((sval) = RBIMPL_CAST((type*)rb_data_object_get(obj)))

We can use rb_data_object_get directly, and this way we don't need to
pass the type, which is unnecessary information.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2 years agoMerge branch 'release'
David Bremner [Sat, 15 May 2021 12:10:58 +0000 (09:10 -0300)]
Merge branch 'release'

2 years agoNEWS: finalize release date 0.32.1 archive/debian/0.32.1-1 debian/0.32.1-1
David Bremner [Sat, 15 May 2021 12:04:20 +0000 (09:04 -0300)]
NEWS: finalize release date

2 years agodebian: changelog for 0.32.1-1
David Bremner [Sat, 15 May 2021 12:03:19 +0000 (09:03 -0300)]
debian: changelog for 0.32.1-1

2 years agoversion: bump to 0.32.1
David Bremner [Sat, 15 May 2021 11:59:01 +0000 (08:59 -0300)]
version: bump to 0.32.1

2 years agoNEWS: add news for $HOME/mail fix
David Bremner [Sat, 15 May 2021 11:52:47 +0000 (08:52 -0300)]
NEWS: add news for $HOME/mail fix

2 years agolib/open: restore default database path of $HOME/mail
David Bremner [Mon, 10 May 2021 10:39:18 +0000 (07:39 -0300)]
lib/open: restore default database path of $HOME/mail

Although this default worked for "notmuch config get", it didn't work
most other places. Restore the previous functionality, with the
wrinkle that XDG locations will shadow $HOME/mail if they exist.

This fixes a bug reported by Jack Kamm in id:87eeefdc8b.fsf@gmail.com

2 years agoNEWS: add NEWS for notmuch-{before,after}-tag-hook fixes
David Bremner [Sat, 8 May 2021 12:11:13 +0000 (09:11 -0300)]
NEWS: add NEWS for notmuch-{before,after}-tag-hook fixes

2 years agoemacs: restore tag-changes and query bindings for tag hooks
Kyle Meyer [Sat, 8 May 2021 12:11:12 +0000 (09:11 -0300)]
emacs: restore tag-changes and query bindings for tag hooks

notmuch-before-tag-hook and notmuch-after-tag-hook are supposed to
have access to two dynamic variables, tag-changes and query, but these
were lost with the switch to lexical binding in fc4cda07 (emacs: use
lexical-bindings in all libraries, 2021-01-13).

Add a variant of Emacs's dlet (not available until Emacs 28) and use
it in notmuch-tag to expose tag-changes and query to the hooks.

2 years agotest: add known broken tests for notuch-{before,after}-tag-hook
David Bremner [Sat, 8 May 2021 12:11:11 +0000 (09:11 -0300)]
test: add known broken tests for notuch-{before,after}-tag-hook

These tests illustrate the bug reported in id:87v97ytd2s.fsf@fastmail.fm