]> git.notmuchmail.org Git - notmuch/log
notmuch
3 years agopython: convert shebangs to python3
Daniel Kahn Gillmor [Sat, 13 Feb 2021 00:26:22 +0000 (19:26 -0500)]
python: convert shebangs to python3

This is the last bit of "python" left in the notmuch codebase.

https://www.python.org/dev/peps/pep-0394/#recommendation encourages
"third-party distributors" to use more-specific shebang lines.  I'm
not certain that the notmuch project itself is a "third-party
contributor" but I think this is a safe way to encourage people to use
python3 when they're developing notmuch.

We already have python3 explicitly elsewhere in the codebase for
developers (in nmbug).

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 years agolib: use a stricter unused macro
David Bremner [Mon, 15 Feb 2021 02:28:55 +0000 (22:28 -0400)]
lib: use a stricter unused macro

This would have caught bugs like the one corrected in the previous commit.

3 years agolib/open: remove incorrect unused attribute
David Bremner [Mon, 15 Feb 2021 02:27:51 +0000 (22:27 -0400)]
lib/open: remove incorrect unused attribute

With the current unused macro in lib/notmuch-private.h this seems
harmless, but is misleading, since the parameter is in fact used.

3 years agolib: add missing private status values.
David Bremner [Fri, 22 Jan 2021 11:34:51 +0000 (07:34 -0400)]
lib: add missing private status values.

Many public status values have been added without being copied to the
list of private status values.

3 years agodoc: describe new config framework
David Bremner [Sun, 10 Jan 2021 15:54:35 +0000 (11:54 -0400)]
doc: describe new config framework

Remove STORED IN DATABASE discussion, describe search rules.
Currently profiles seem a bit pointless. They will make more sense
when they apply to databases as well.

3 years agoCLI: use configured hook directory
David Bremner [Sun, 10 Jan 2021 11:50:14 +0000 (07:50 -0400)]
CLI: use configured hook directory

This enables support for hooks outside the database directory.
It relies strongly on configuration information being usable between
closing the database and destroying it.

3 years agolib/open: set HOOK_DIR on open
David Bremner [Sat, 9 Jan 2021 19:05:58 +0000 (15:05 -0400)]
lib/open: set HOOK_DIR on open

This is a simple two step path search.  Most error checking is
deferred until running the hooks.

3 years agolib/config: add HOOK_DIR
David Bremner [Sat, 9 Jan 2021 13:19:50 +0000 (09:19 -0400)]
lib/config: add HOOK_DIR

The hook directory configuration needs to be kept in synch with the
other configuration information, so add scaffolding to support this at
database opening time.

3 years agocli/new: convert to new config framework
David Bremner [Sat, 2 Jan 2021 17:10:39 +0000 (13:10 -0400)]
cli/new: convert to new config framework

In addition to the same type of changes as converting other
subcommands, add the possibility of creating a database at the top
level. It would probably make sense to use this for insert as well.

3 years agocli/new: refactor database upgrade code
David Bremner [Sat, 2 Jan 2021 03:19:31 +0000 (23:19 -0400)]
cli/new: refactor database upgrade code

Move to a separate function. This is essentially just code movement.

3 years agolib: introduce notmuch_database_create_with_config
David Bremner [Sat, 2 Jan 2021 00:43:14 +0000 (20:43 -0400)]
lib: introduce notmuch_database_create_with_config

This takes a config path parameter, and can use that to decide the
new database location.

3 years agolib: add NOTMUCH_STATUS_DATABASE_EXISTS
David Bremner [Sun, 3 Jan 2021 12:50:12 +0000 (08:50 -0400)]
lib: add NOTMUCH_STATUS_DATABASE_EXISTS

It is desirable to distinguish between attempting to create a database
that already exists, and more fatal errors like permission problems.

3 years agolib/database: move n_d_create* to open.cc
David Bremner [Sat, 2 Jan 2021 00:22:00 +0000 (20:22 -0400)]
lib/database: move n_d_create* to open.cc

This will help share code with n_d_open_with_config.

3 years agolib: add NOTMUCH_STATUS_NO_CONFIG
David Bremner [Sun, 3 Jan 2021 12:30:46 +0000 (08:30 -0400)]
lib: add NOTMUCH_STATUS_NO_CONFIG

This will allow client code to provide more meaningful diagnostics. In
particular it will enable "notmuch new" to continue suggsting the user
run "notmuch setup" to create a config after "notmuch new" is
transitioned to the new  configuration framework.

3 years agolib/open: factor out choosing database path
David Bremner [Fri, 1 Jan 2021 16:16:25 +0000 (12:16 -0400)]
lib/open: factor out choosing database path

The plan is to share code with a new database creation function that
has a similar API to n_d_open_with_config.

3 years agolib/config: add NOTMUCH_CONFIG_NEW_IGNORE
David Bremner [Fri, 1 Jan 2021 13:01:24 +0000 (09:01 -0400)]
lib/config: add NOTMUCH_CONFIG_NEW_IGNORE

This will be needed by (at least) the conversion of notmuch-new.c to
the new config framework

3 years agobindings/notmuch2: add missing crypto error status codes
David Bremner [Sun, 3 Jan 2021 01:50:24 +0000 (21:50 -0400)]
bindings/notmuch2: add missing crypto error status codes

These are needed so that the later codes line up numerically.

3 years agocli/compact: convert to new configuration framework
David Bremner [Thu, 24 Dec 2020 03:45:23 +0000 (23:45 -0400)]
cli/compact: convert to new configuration framework

Switch to the newly created API function notmuch_database_compact_db,
which takes the database opened in main().

3 years agolib: split notmuch_database_compact
David Bremner [Thu, 24 Dec 2020 03:37:41 +0000 (23:37 -0400)]
lib: split notmuch_database_compact

The "back end" function takes an open notmuch database, which should
know its own path (i.e. the path needs to be cached in the
configuration data).

3 years agolib/config: add _notmuch_config_cache
David Bremner [Thu, 24 Dec 2020 03:35:42 +0000 (23:35 -0400)]
lib/config: add _notmuch_config_cache

This is a simple convenience routine to cache a configuration value
without writing it to the database.

3 years agocli/tag: convert to new config framework.
David Bremner [Mon, 7 Dec 2020 23:48:48 +0000 (19:48 -0400)]
cli/tag: convert to new config framework.

In addition to changing configuration access, change talloc context
for allocation.

3 years agoCLI/show: mostly switch show to new config framework
David Bremner [Sat, 8 Aug 2020 14:16:53 +0000 (11:16 -0300)]
CLI/show: mostly switch show to new config framework

This will need some cleanup when the transition completes, and we stop
passing notmuch_config_t structs to the subcommands.

Unlike the general case, we open the database in the subcommand, since
we don't know whether it should be opened read/write until we parse
the command line arguments.

Add a test to make sure passing config file on the command line is not
broken by these or future config related changes.

3 years agocli/config: add accessor for config file name
David Bremner [Sat, 8 Aug 2020 14:16:51 +0000 (11:16 -0300)]
cli/config: add accessor for config file name

This is intended for use in temporary code transitioning to the new
configuration system. The name is chosen to avoid cluttering the
notmuch_config_* namespace further with non-library functions.

3 years agoCLI/{search,address}: convert to new configuration framework
David Bremner [Sat, 8 Aug 2020 14:16:52 +0000 (11:16 -0300)]
CLI/{search,address}: convert to new configuration framework

Since we are already passing a search context around as a kind of
parameter block, add a new talloc context to that to replace relying
on 'config'.

Convert notmuch-search and notmuch-address at the same time, because
they share some code.

Add a test to make sure we don't break passing configuration as a
command line argument.

3 years agoCLI/reply: convert to new config framework
David Bremner [Sun, 8 Nov 2020 01:58:32 +0000 (21:58 -0400)]
CLI/reply: convert to new config framework

This is messier than some of the other conversions because the
extensive use of 'config' as a talloc context.

3 years agocli/reindex: convert new config framework
David Bremner [Mon, 5 Oct 2020 23:35:26 +0000 (20:35 -0300)]
cli/reindex: convert new config framework

The only non-trivial part is switching the talloc context for
query_string_from args from 'config' to 'notmuch'.

3 years agoCLI/insert: convert to new config framework.
David Bremner [Wed, 26 Aug 2020 11:43:33 +0000 (08:43 -0300)]
CLI/insert: convert to new config framework.

The new talloc context is needed to run the hook at the very end of
the function. That in turn is needed so that this process gives up the
write lock on the database.

3 years agoCLI/restore: convert to new config framework
David Bremner [Mon, 5 Oct 2020 23:28:29 +0000 (20:28 -0300)]
CLI/restore: convert to new config framework

Switch one configuration check to new n_c_get_bool function, and
switch use of config as talloc context to notmuch.

3 years agolib: add notmuch_config_get_bool
David Bremner [Wed, 26 Aug 2020 11:41:48 +0000 (08:41 -0300)]
lib: add notmuch_config_get_bool

Booleans have no out of band values, so return a status for errors.

3 years agocli/dump: convert to new config framework
David Bremner [Wed, 26 Aug 2020 10:54:10 +0000 (07:54 -0300)]
cli/dump: convert to new config framework

This conversion is trivial because the only configuration information
accessed by dump is that stored in the database (in order to dump
it). We do need to be careful to keep the write lock on the database
to ensure dump consistency.

3 years agoCLI/count: switch to new configuration framework
David Bremner [Tue, 22 Dec 2020 12:13:51 +0000 (08:13 -0400)]
CLI/count: switch to new configuration framework

The main effort is changing from the old argv style config list
iterators to the new more opaque ones provided by the library (and
backed by the database+file config cache).

3 years agolib/config: make values iterators restartable
David Bremner [Fri, 1 Jan 2021 13:28:24 +0000 (09:28 -0400)]
lib/config: make values iterators restartable

This is relatively cheap, and makes it easier to transform existing
code which uses arrays of pointers to store configuration lists.

3 years agolib/config: add config values iterator
David Bremner [Sat, 8 Aug 2020 14:16:49 +0000 (11:16 -0300)]
lib/config: add config values iterator

This is intended to avoid duplicating the string splitting and
traversal code for all clients of the config API.

3 years agoutil: add strsplit_len: simplified strtok with delimiter escaping
David Bremner [Sat, 8 Aug 2020 14:16:48 +0000 (11:16 -0300)]
util: add strsplit_len: simplified strtok with delimiter escaping

This will be used to make iterators for configuration values.

3 years agoCLI: add (unused) database argument to subcommands.
David Bremner [Mon, 21 Dec 2020 12:55:14 +0000 (08:55 -0400)]
CLI: add (unused) database argument to subcommands.

This will allow transitioning individual subcommands to the new
configuration framework. Eventually when they are all converted we can
remove the notmuch_config_t * argument.

For now, live with the parameter shadowing in some some subcommands;
it will go away when they are converted.

3 years agolib/open: load default values for known configuration keys.
David Bremner [Thu, 24 Dec 2020 20:10:05 +0000 (16:10 -0400)]
lib/open: load default values for known configuration keys.

This emulates the behaviour of notmuch_config_open defined in the CLI,
in that it fills in default values if they are not otherwise defined.

3 years agolib/config: add notmuch_config_key_{get,set}
David Bremner [Wed, 26 Aug 2020 01:36:43 +0000 (22:36 -0300)]
lib/config: add notmuch_config_key_{get,set}

By using an enum we can have better error detection than copy pasting
key strings around.

The question of what layer this belongs in is a bit
tricky. Historically most of the keys are defined by the CLI. On the
other hand features like excludes are supported in the
library/bindings, and it makes sense to configure them from the
library as well.

The somewhat long prefix for notmuch_config_t is to avoid collisions
with the existing usage in notmuch-client.h.

3 years agoCLI: generalize notmuch_config_mode_t
David Bremner [Mon, 21 Dec 2020 16:12:09 +0000 (12:12 -0400)]
CLI: generalize notmuch_config_mode_t

The renaming and extra values will make sense when we start to convert
subcommands to the new configuration framework. It will also avoid
collisions with a new enum for configuration keys to be introduced in
a future commit.

3 years agolib/open: add support for config profiles and default locations
David Bremner [Sat, 8 Aug 2020 14:16:46 +0000 (11:16 -0300)]
lib/open: add support for config profiles and default locations

Fill in the remainder of the documented functionality for
n_d_open_with_config with respect to config file location. Similar
searching default locations of the database file still needs to be
added.

3 years agolib: add stub for notmuch_database_open_with_config
David Bremner [Sat, 8 Aug 2020 14:16:36 +0000 (11:16 -0300)]
lib: add stub for notmuch_database_open_with_config

Initially document the intended API and copy the code from
notmuch_database_open_verbose. Most of the documented functionality is
not there yet.

3 years agolib: cache configuration information from database
David Bremner [Sat, 8 Aug 2020 14:16:37 +0000 (11:16 -0300)]
lib: cache configuration information from database

The main goal is to allow configuration information to be temporarily
overridden by a separate config file. That will require further
changes not in this commit.

The performance impact is unclear, and will depend on the balance
between number of queries and number of distinct metadata items read
on the first call to n_d_get_config.

3 years agolib: add _notmuch_string_map_set
David Bremner [Sun, 20 Dec 2020 21:10:53 +0000 (17:10 -0400)]
lib: add _notmuch_string_map_set

This will be used (and tested) by the configuration caching code to be
added in the next commit.

3 years agoemacs: When completing tags, offer each tag once
David Edmondson [Wed, 3 Feb 2021 09:10:20 +0000 (09:10 +0000)]
emacs: When completing tags, offer each tag once

When prompting for one or more tags to add or remove to/from one or
more threads, ensure that the set of tags offered for completion
contains no duplicates.

Some completion packages (e.g. selectrum) will include every member of
the offered list, resulting in the same tag being indicated as a
possibility several times.

3 years agonotmuch-show: use correct format specifier for ssize_t
Đoàn Trần Công Danh [Sun, 24 Jan 2021 16:07:57 +0000 (23:07 +0700)]
notmuch-show: use correct format specifier for ssize_t

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
3 years agotest: add (back) upgrade tests
David Bremner [Sun, 17 Jan 2021 12:35:38 +0000 (08:35 -0400)]
test: add (back) upgrade tests

In ee897cab8b721 the upgrade tests from pre v3 databases were
removed. The reasons for that are still valid, but we should still
test the code paths that do the upgrade, and it is relatively
straightforward to do that for v3 to v3 upgrades.

3 years agotest/T391-python-cffi
David Bremner [Sun, 3 Jan 2021 23:35:13 +0000 (19:35 -0400)]
test/T391-python-cffi

Make bindings test verbose. This helps in debugging.

3 years agotest/T750-gzip: don't compress the xapian database
David Bremner [Sun, 3 Jan 2021 23:35:12 +0000 (19:35 -0400)]
test/T750-gzip: don't compress the xapian database

This causes mysterious failures in trying to detect if a database
exists.

3 years agoemacs: avoid type errors due to nil as content-type
Jonas Bernoulli [Sun, 10 Jan 2021 18:47:22 +0000 (19:47 +0100)]
emacs: avoid type errors due to nil as content-type

The output of "notmuch show --format=sexp --format-version=4"
may contain `:content-type' entries with `nil' as the value,
when it fails to detect the correct value.  Account for that
in a few places where we would otherwise risk a type error.

Note that `string=' does not choke on `nil' because it uses
the `symbol-name' when encountering a symbol.

3 years agoemacs: notmuch-show--get-cid-content: cosmetics
Jonas Bernoulli [Sun, 10 Jan 2021 18:47:21 +0000 (19:47 +0100)]
emacs: notmuch-show--get-cid-content: cosmetics

3 years agoemacs: notmuch-show--register-cids: fix names of bindings
Jonas Bernoulli [Sun, 10 Jan 2021 18:47:20 +0000 (19:47 +0100)]
emacs: notmuch-show--register-cids: fix names of bindings

3 years agoemacs: notmuch-mua-add-more-hidden-headers: use local binding
Jonas Bernoulli [Sun, 10 Jan 2021 18:47:19 +0000 (19:47 +0100)]
emacs: notmuch-mua-add-more-hidden-headers: use local binding

3 years agoemacs: notmuch-address-expand-name: use the actual initial-input
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:12 +0000 (15:01 +0100)]
emacs: notmuch-address-expand-name: use the actual initial-input

Users may type some text into the buffer on an address line, before
actually invoking address completion.  We now use that text as the
initial input when we begin address completion.

Previously we did knowingly replace the actual initial input with some
completion candidate that happens to match. Which candidate is used is
essentially random, at least when the actual initial input is short.
As a result users very often had to begin completion by deleting the
less than helpful "initial input".

3 years agoemacs: allow opting out of notmuch's address completion
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:11 +0000 (15:01 +0100)]
emacs: allow opting out of notmuch's address completion

IMO Notmuch should not override the default completion mechanism by
default, at least not globally. But since users are already used to
this behavior it is probably too late to change it. Do the next best
thing and at least allow users to opt out.

3 years agoemacs: notmuch-tree-get-match: No longer define as command
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:10 +0000 (15:01 +0100)]
emacs: notmuch-tree-get-match: No longer define as command

When called from code, then this function returns non-nil when the
message at point is a matched message.  However it does nothing at all
to present that information to the user when it called interactively.
It is therefore safe to conclude that nobody is using this as a
command.

3 years agoemacs: use string-empty-p
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:09 +0000 (15:01 +0100)]
emacs: use string-empty-p

3 years agoemacs: make subr-x available in all libraries
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:08 +0000 (15:01 +0100)]
emacs: make subr-x available in all libraries

Like `cl-lib' and `pcase', which are already available in all
libraries, `subr-x' also provided many useful functions that
we would like to use.

Making `subr-x' available in every library from the get-go means
that we can use the functions it defines without having to double
check every single time, whether the feature is already available
in the current library.

3 years agoemacs: improve how cl-lib and pcase are required
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:07 +0000 (15:01 +0100)]
emacs: improve how cl-lib and pcase are required

We need to load `cl-lib' at run-time because we use more from it than
just macros.  Never-the-less many, but not all libraries required it
only at compile-time, which we got away with because at least some
libraries already required it at run-time as well.

We use `cl-lib' and (currently to a lesser extend) `pcase' throughout
the code-base, which means that we should require these features in
most libraries.

In the past we tried to only require these features in just the
libraries that actually need them, without fully succeeding.  We did
not succeed in doing so because that means we would have to check
every time that we use a function from these features whether they
are already being required in the current library.

An alternative would be to add the `require' forms at the top of every
library but that is a bit annoying too.

In order to make sure that these features are loaded when needed but
also to keep the noise down we only require them in "notmuch-lib.el",
which most other libraries require, and in most of the few libraries
that do not do so, namely "notmuch-draft.el", "notmuch-message.el" and
"notmuch-parser.el".  ("coolj.el", "make-deps.el", various generated
libraries, and "notmuch-compat.el" are left touched.)

3 years agoemacs: avoid unnecessary let-bindings
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:06 +0000 (15:01 +0100)]
emacs: avoid unnecessary let-bindings

To some extend this is a personal preference, but the preference is
strongly dependent on whether one is used to a language that makes it
necessary to use variables like this.

This makes it perfectly clear that we are first getting and then using
a "foo":

  (use-foo (get-foo))

Sure this has to be read "inside out", but that's something one better
gets used to quickly when dealing with lisp.  I don't understand why
one would want to write this instead:

  (let ((the-foo (get-foo)))
    (use-foo the-foo))

Both `get-foo' and `use-foo' are named in a way that make it very
clear that we are dealing with a "foo".  Storing the value in an
additional variable `the-foo' does not make this any more clear.

On the contrary I makes the reader wonder why the author choose to
use a variable.  Is the value used more than once?  Is the value
being retrieved in one context and then used in another (e.g. when
the current buffer changes)?

3 years agoemacs: reorder notmuch.el a bit
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:05 +0000 (15:01 +0100)]
emacs: reorder notmuch.el a bit

3 years agoemacs: notmuch-search-stash-thread-id: use notmuch-search-query-string
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:04 +0000 (15:01 +0100)]
emacs: notmuch-search-stash-thread-id: use notmuch-search-query-string

No longer use the function `notmuch-search-get-query', which does
nothing but return the value of that variable.  That function was
added in [1: f47eeac0] for use in `notmuch-read-query' along-side
related `notmuch-show-get-query' and `notmuch-tree-get-query' but
using it here makes little sense.

1: f47eeac0b0186c3559eb559c4f0bee0e1fac1961
   emacs: set default in notmuch-read-query

3 years agoemacs: define a few variables as automatically buffer-local
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:03 +0000 (15:01 +0100)]
emacs: define a few variables as automatically buffer-local

Define these variables as automatically buffer-local, meaning that
they always become buffer-local when set unless explicitly told
otherwise using `setq-default' or when using the Custom interface.

Previously they were declared, which keeps the byte-compiler quiet but
is not actually the same as being defined.  `notmuch-search-mode' then
made them buffer-local in the current buffer and then set the local
values.  This works but is not kosher.

The definitions of the three non-option variables have to be moved up
a bit to enable the change in the next commit, which see.

3 years agoemacs: remove variable notmuch-search-disjunctive-regexp
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:02 +0000 (15:01 +0100)]
emacs: remove variable notmuch-search-disjunctive-regexp

The value is the only possible value, it is only used in one
place, and using a global variable serves no purpose but to
make things more complicated.

3 years agoemacs: various doc-string improvements
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:01 +0000 (15:01 +0100)]
emacs: various doc-string improvements

3 years agoemacs: various comment improvements
Jonas Bernoulli [Sun, 10 Jan 2021 14:01:00 +0000 (15:01 +0100)]
emacs: various comment improvements

3 years agoemacs: various cosmetic improvements
Jonas Bernoulli [Wed, 13 Jan 2021 17:37:50 +0000 (18:37 +0100)]
emacs: various cosmetic improvements

3 years agoemacs: notmuch-crypto-status-button-type: fix potential bug
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:58 +0000 (15:00 +0100)]
emacs: notmuch-crypto-status-button-type: fix potential bug

The "help-echo" can potentially contain an unintended %-spec
so we have to make sure it would not be treated as such.

3 years agoemacs: notmuch-mua.el: move all options into "Options" section
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:57 +0000 (15:00 +0100)]
emacs: notmuch-mua.el: move all options into "Options" section

This is how we do it in other libraries.

3 years agoemacs: notmuch-mua-prompt-for-sender: don't force Ido on users
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:56 +0000 (15:00 +0100)]
emacs: notmuch-mua-prompt-for-sender: don't force Ido on users

We shouldn't force `ido-completion-read' on users who do not otherwise
use Ido.  Unfortunately simply turning on `ido-mode' does not change
every `completing-read' into a `ido-completing-read', instead it only
changes file and buffer completion.

I do realize that existing Ido users will initially dislike this
change, but I would like to encourage them to see this as an
opportunity to learn about Fido.

Unlike `ido-mode', build-in `fido-mode' confirms to the standard
completion API, so turning it on causes every `completing-read' to
use the Fido completion mechanism and which is similar to the Ido
mechanism:

> An enhanced `icomplete-mode' that emulates `ido-mode'.  This global
> minor mode makes minibuffer completion behave more like `ido-mode'
> than regular `icomplete-mode'."

3 years agoemacs: notmuch-wash.el: require diff-mode at beginning of code
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:55 +0000 (15:00 +0100)]
emacs: notmuch-wash.el: require diff-mode at beginning of code

That's what we usually do.  Also do not declare variable
`diff-file-header-re' because it is defined in `diff-mode.el',
which we always require.

3 years agoemacs: notmuch-message-apply-queued-tag-changes: cosmetics
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:54 +0000 (15:00 +0100)]
emacs: notmuch-message-apply-queued-tag-changes: cosmetics

3 years agoemacs: define notmuch-message-queued-tag-changes as buffer-local
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:53 +0000 (15:00 +0100)]
emacs: define notmuch-message-queued-tag-changes as buffer-local

Also improve the doc-string.

3 years agoemacs: silence compiler wrt notmuch-show-insert-part-text/plain
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:52 +0000 (15:00 +0100)]
emacs: silence compiler wrt notmuch-show-insert-part-text/plain

`notmuch-show-insert-part-text/plain' calls
`notmuch-show-insert-text/plain-hook' with two arguments
MSG and DEPTH. Currently all hook functions ignore MSG but
third-party functions may not.  One hook function uses DEPTH.

3 years agoemacs: notmuch-wash-region-to-button: remove unused MSG argument
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:51 +0000 (15:00 +0100)]
emacs: notmuch-wash-region-to-button: remove unused MSG argument

3 years agoemacs: inline notmuch-sexp-eof into only caller
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:50 +0000 (15:00 +0100)]
emacs: inline notmuch-sexp-eof into only caller

This function had a few issues.
- Neither its name nor the old comment before it is called made it
  clear what it does.
- It took one argument but didn't do anything with it.
- It's doc-string made a few claims, which are untrue and generally
  focused on details instead of that its purpose is.

3 years agoemacs: notmuch-tag--get-formats: silence byte-compiler
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:49 +0000 (15:00 +0100)]
emacs: notmuch-tag--get-formats: silence byte-compiler

`format-alist' is a global variable and the byte-compiler is unhappy
when a lexical function argument shadows a global (dynamic) binding.

3 years agoemacs: deal with unused lexical arguments and variables
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:48 +0000 (15:00 +0100)]
emacs: deal with unused lexical arguments and variables

The previous commit switched to lexical-binding but without dealing
with the new warnings about unused lexical arguments and variables.

This commit deals with most of them, in most cases by either removing
leftover bindings that are actually unnecessary, or by marking certain
arguments as "known to be unused" by prefixing their names with "_".

In the case of the functions named `notmuch-show-insert-...' the
amount of silencing that is required is a bit extreme and we might
want to investigate if there is a better way.

In the case of `notmuch-mua-mail', ignoring CONTINUE means that we do
not fully follow the intended behavior described in `compose-mail's
doc-string.

3 years agoemacs: use lexical-bindings in all libraries
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:47 +0000 (15:00 +0100)]
emacs: use lexical-bindings in all libraries

Doing so causes many new compile warnings.  Some of these warnings
concern genuine changes in behavior that have to be addressed right
away.

Many other warnings are due to unused variables.  Nothing has changed
here, except that the byte-compiler can now detect these pre-existing
and harmless issues.  We delay addressing these issues so that we can
focus on the important ones here.

A third group of warnings concern arguments that are not actually used
inside the function but which cannot be removed because the functions
signature is dictated by some outside convention.  Silencing these
warning is also delayed until subsequent commits.

3 years agoemacs: make headings outline-minor-mode compatible
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:46 +0000 (15:00 +0100)]
emacs: make headings outline-minor-mode compatible

`outline-minor-mode' treats comments that begin with three or more
semicolons as headings.  That makes it very convenient to navigate
code and to show/hide parts of a file.

Elips libraries typically have four top-level sections, e.g.:

;;; notmuch.el --- run notmuch within emacs...
;;; Commentary:...
;;; Code:...
;;; notmuch.el ends here

In this package many libraries lack a "Commentary:" section, which is
not optimal but okay for most libraries, except major entry points.

Depending on how one chooses to look at it, the "... ends here" line
is not really a heading that begins a section, because it should never
have a "section" body (after all it marks eof).

If the file is rather short, then I left "Code:" as the only section
that contains code.  Otherwise I split the file into multiple sibling
sections.  The "Code:" section continues to contain `require' and
`declare-function' forms and other such "front matter".

If and only if I have split the code into multiple sections anyway,
then I also added an additional section named just "_" before the
`provide' form and shortly before the "...end here" line.  This
section could also be called "Back matter", but I feel it would be
distracting to be that explicit about it.  (The IMO unnecessary but
unfortunately still obligatory "... ends here" line is already
distracting enough as far as I am concerned.)

Before this commit some libraries already uses section headings, some
of them consistently.  When a library already had some headings, then
this commit often sticks to that style, even at the cost inconsistent
styling across all libraries.

A very limited number of variable and function definitions have to be
moved around because they would otherwise end up in sections they do
not belong into.

Sections, including but not limited to their heading, can and should
be further improved in the future.

3 years agoemacs: avoid killing process buffer when process is still alive
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:45 +0000 (15:00 +0100)]
emacs: avoid killing process buffer when process is still alive

In practice this probably does not make a difference or we would
have heard about it many times, but better be safe than sorry.

Process sentinels are called not only when the process has finished
but also on other state changes.

3 years agoemacs: avoid passing around some redundant information
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:44 +0000 (15:00 +0100)]
emacs: avoid passing around some redundant information

When running "notmuch" we use its full path but when displaying the
command to the user we show just its name for readability reasons.
Avoid passing around both representations because it is very easy
to get the name from the path.

Notmuch itself uses the involved functions just for "notmuch" but
there might be extensions that use them for other executable so we
forgo other potential simplifications.

3 years agoemacs: notmuch-start-notmuch: avoid storing process buffer twice
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:43 +0000 (15:00 +0100)]
emacs: notmuch-start-notmuch: avoid storing process buffer twice

The buffer of the error process is accessible using `process-buffer'.
We still have to store the error-buffer in the non-error process
because for that process `process-buffer' obviously returns its own
buffer.

3 years agoemacs: notmuch-start-notmuch-sentinel: assert buffer is alive
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:42 +0000 (15:00 +0100)]
emacs: notmuch-start-notmuch-sentinel: assert buffer is alive

3 years agoemacs: notmuch-start-notmuch-error-sentinel: assert buffer is alive
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:41 +0000 (15:00 +0100)]
emacs: notmuch-start-notmuch-error-sentinel: assert buffer is alive

3 years agoemacs: notmuch-start-notmuch: remove backward compatibility code
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:40 +0000 (15:00 +0100)]
emacs: notmuch-start-notmuch: remove backward compatibility code

We no longer support Emacs releases before version 25.1.

Also adjust the sentinels which only had to deal with
an error file when using an older Emacs release was used.

3 years agoemacs: define new notmuch-search-item widget type
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:39 +0000 (15:00 +0100)]
emacs: define new notmuch-search-item widget type

This is complex enough to warrant a dedicated widget type,
which will make future improvements less messy to implement.

3 years agoemacs: sanitize dedicated widget action/notify functions
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:38 +0000 (15:00 +0100)]
emacs: sanitize dedicated widget action/notify functions

These functions are used as action/notify functions.  That dictates
the appropriate function signatures but even though these functions
are not used for anything else they use incompatible signatures,
forcing the callers to use lambda expressions to deal with these
incompatibilities.

Fix that by adjusting the function signatures to the needs of the
only intended callers.

Two of these functions were defined as commands but because the
interactive form did not return the mandatory arguments, we know
that nobody (successfully) used these as commands.

In one case we move the location of a y-or-n-p prompt.

3 years agoemacs: use setq instead of set
Jonas Bernoulli [Sun, 10 Jan 2021 14:00:37 +0000 (15:00 +0100)]
emacs: use setq instead of set

Commonly `set' is only used if there is no way around it;
i.e. when the variable cannot be known until runtime.

3 years agonmbug: notmuch-report: set both background and foreground colors
Tomi Ollila [Sun, 20 Dec 2020 20:04:23 +0000 (22:04 +0200)]
nmbug: notmuch-report: set both background and foreground colors

Whenever setting background color, set also corresponding
foreground color. Don't expect default foreground color to
be #000 (or something close); user may have changed it.

3 years agodocs: drop deprecated doxygen TCL_SUBST flag
Daniel Kahn Gillmor [Thu, 31 Dec 2020 23:00:37 +0000 (18:00 -0500)]
docs: drop deprecated doxygen TCL_SUBST flag

notmuch has no tcl code, and doxygen upstream is deprecating/removing
tcl support anyway:
https://github.com/doxygen/doxygen/commit/48a7afc0caf69857a42b0fe1963db3440cb4000f

3 years agoMerge branch 'release'
David Bremner [Sat, 26 Dec 2020 19:20:32 +0000 (15:20 -0400)]
Merge branch 'release'

3 years agodebian: skip gdb based tests on hppa archive/debian/0.31.3-2 debian/0.31.3-2
David Bremner [Sat, 26 Dec 2020 19:14:27 +0000 (15:14 -0400)]
debian: skip gdb based tests on hppa

3 years agoRevert "emacs: notmuch-search: avoid wiping out buffer-local variables"
Jonas Bernoulli [Sun, 8 Nov 2020 17:49:29 +0000 (18:49 +0100)]
Revert "emacs: notmuch-search: avoid wiping out buffer-local variables"

This reverts commit f9fbd1ee3bfd679175d88af403752d87a730349f.

Emacs provides a mechanism for avoiding wiping out buffer-local
variables: marking them as "permanent local", which essentially
means "don't wip out the local value when enabling major-mode".

  (put 'the-variable 'permanent-local t)

See (info "(elisp)Creating Buffer-Local").

Whether refreshing the buffer contents should involve re-enable the
mode is a different question, which should not be decided based on
the fact that we want keep the value of some random variable, not
least because some other (e.g. cache) variables are likely expected
to be wiped.

3 years agoMerge branch 'release'
David Bremner [Fri, 25 Dec 2020 16:56:57 +0000 (12:56 -0400)]
Merge branch 'release'

3 years agoCommit Debian 3.0 (quilt) metadata archive/debian/0.31.3-1 debian/0.31.3-1
David Bremner [Fri, 25 Dec 2020 16:39:26 +0000 (12:39 -0400)]
Commit Debian 3.0 (quilt) metadata

[dgit (9.12) quilt-fixup]

3 years agodebian: drop debian/patches
David Bremner [Fri, 25 Dec 2020 16:37:18 +0000 (12:37 -0400)]
debian: drop debian/patches

These were originally committed by git-debrebase. Unfortunately git
debrebase does not seem to like the notmuch git workflow, so giving up
on it for now.

3 years agodebian: don't tag debian tag at release is made. 0.31.3
David Bremner [Fri, 25 Dec 2020 16:26:35 +0000 (12:26 -0400)]
debian: don't tag debian tag at release is made.

This reflects a change in the debian workflow to use dgit, which does
the tagging for us.  It also leaves room for debian specific fixups.

3 years agoNEWS: add news for 0.31.3
David Bremner [Fri, 25 Dec 2020 15:52:29 +0000 (11:52 -0400)]
NEWS: add news for 0.31.3

3 years agodebian: changelog for 0.31.3-1
David Bremner [Fri, 25 Dec 2020 15:49:32 +0000 (11:49 -0400)]
debian: changelog for 0.31.3-1

3 years agoversion: bump 0.31.3
David Bremner [Fri, 25 Dec 2020 15:42:12 +0000 (11:42 -0400)]
version: bump 0.31.3

3 years agotest/T360-symbol-hiding.sh: trim extra output from readelf
David Bremner [Tue, 15 Dec 2020 20:45:09 +0000 (16:45 -0400)]
test/T360-symbol-hiding.sh: trim extra output from readelf

readelf on (at least) ppc64le sometimes generates some extension to
the Ndx name inside '[]'. Remove this output to allow our simple
column based parsing to work.