Commit graph

1045 commits

Author SHA1 Message Date
David Bremner
9c4037ff19 emacs: don't inline message/rfc822 parts without content
This avoids some ugly error messages and exceptions, and hopes that
some gnus method will display message/rfc822 parts that have only a
file, no :content part.
2021-08-30 16:34:09 -07:00
Jonas Bernoulli
dd8c167850 emacs: shorten lines in two doc-strings
The byte-compiler wasn't happy about those.
2021-08-29 17:51:55 -07:00
Jonas Bernoulli
3a6e4f9768 emacs: notmuch-show-pipe-message: cosmetics 2021-08-29 17:51:30 -07:00
Jonas Bernoulli
01298a8437 emacs: fix some option type declarations
Also improve their doc-strings.
2021-08-29 17:45:05 -07:00
Jonas Bernoulli
f01df47ce1 emacs: add some function declarations 2021-08-29 17:42:58 -07:00
Jonas Bernoulli
27c8e377e4 emacs: use closures instead of backquoted lambdas 2021-08-29 17:42:32 -07:00
David Bremner
8c4f38092a emacs/rstdoc: escape '*'
This is just a regular character in docstrings (as it is fairly often
used in lisp identifiers and buffer names) but is the start of
emphasis in rst. This change is needed to quell a noisy warning when
including notmuch-tree.rsti
2021-08-22 07:12:03 -07:00
David Bremner
731697d671 CLI: define and use format version 5
This is a bit of a cheat, since the format does not actually
change. On the other hand it is fairly common to do something like
this to shared libary SONAMEs when the ABI changes in some subtle way.
It does rely on the format-version argument being early enough on the
command line to generate a sensible error message.
2021-08-22 07:05:13 -07:00
jao
357dd488ca emacs: new command notmuch-tree-filter-by-tag
This new command for notmuch-tree-mode is analogous to
notmuch-search-filter-by-tag, bound to "t" in notmuch-search-mode; it
gets therefore the same "t" keybinding in notmuch-tree-mode (replacing
the current assignment to notmuch-search-by-tag).
2021-08-21 19:53:42 -07:00
jao
7857457833 emacs: new command notmuch-tree-filter
This command is analogous to notmuch-filter, but is defined on tree
mode buffers.
2021-08-21 19:48:13 -07:00
Protesilaos Stavrou
c37c99126d emacs: Refine scope of notmuch-jump-key face
The intent of the 'notmuch-jump-key' face is to allow users/themes to
differentiate the text of the minibuffer prompt from the keys that are
associated with jump actions.  Commit 5cc106b0 correctly introduced the
'notmuch-jump-key' face for keys, but mistakenly applied it to the
prompt as well.
2021-08-05 08:58:30 -03:00
jao
c1f542d68a emacs: honour notmuch-show-text/html-blocked-images in w3m messages
When mm-text-html-renderer is set to 'w3m, the variable playing the
role of a regular expression for blocked images is
w3m-ignored-image-url-regexp.  We bind it when the renderer is not
'shr.
2021-08-03 22:55:52 -03:00
Jonas Bernoulli
b649b0c871 emacs: notmuch-tree: mark the initial message at point as read
When moving between message in a tree or show buffer, the message at
point is marked as read.  Likewise when creating such a buffer, then
the message that is initially at point is supposed to be marked as
read as well.

The latter worked for `notmuch-show' but not for `notmuch-tree'.
Press "RET" or "M-RET" in a search buffer to observe these behaviors.

In both cases the marking is supposed to be done by the function
`notmuch-show-command-hook'.  In the case of `notmuch-show' that
function is added directly to `post-command-hook'.

`notmuch-tree' instead adds the function `notmuch-tree-command-hook'
to `post-command-hook' and that calls `notmuch-show-command-hook',
in the respective show buffer, but of course only if that exists.

Because the tree buffer is created asynchronously, the show buffer
doesn't exist yet by the time the `post-command-hook' is run, so
we have to explicitly run `notmuch-tree-command-hook' once the
show buffer exists.

The show buffer is created when `notmuch-tree-goto-and-insert-msg'
calls `notmuch-tree-show-message-in'.  `notmuch-tree-process-filter'
is what finally brings us here.
2021-07-25 15:15:33 -03:00
David Bremner
bed62eb8be 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.
2021-07-19 08:32:49 -03:00
David Bremner
d8a5fba4fe emacs: update declaration of notmuch-tree
This fixes an a warning from the byte-compiler.  The commit
74ab62a340 changed the function
signature but did not update the declaration.
2021-07-13 09:55:00 -03:00
David Bremner
04f378e673 emacs: fix typo in variable name
This error crept in during my style rewrite of dkg's proposed change.
2021-07-06 22:25:57 -03:00
jao
e333debbd8 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.
2021-07-03 20:36:37 -03:00
jao
74ab62a340 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.
2021-07-03 20:28:48 -03:00
David Bremner
37f84d6d21 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.
2021-06-27 14:41:23 -03:00
David Bremner
563b2a0032 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.
2021-06-27 14:37:45 -03:00
edef
fb4b45062f 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.
2021-06-27 14:22:35 -03:00
Protesilaos Stavrou
5cc106b0e3 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.
2021-06-27 12:28:54 -03:00
Daniel Kahn Gillmor
29d43b7f44 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.
2021-06-26 13:34:54 -03:00
Ori
2c96956b3b 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
2021-06-24 17:26:43 -03:00
David Bremner
8dbd5deb8d Merge branch 'release' 2021-06-20 17:15:20 -03:00
David Bremner
dda50ede05 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
2021-06-08 20:12:33 -03:00
Jani Nikula
87234a8ef3 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.
2021-06-05 15:39:53 -03:00
Tomi Ollila
03366a3c5a 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
2021-06-05 08:24:51 -03:00
David Bremner
d7ddfa0d0e 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
2021-06-04 20:05:31 -03:00
Kyle Meyer
319dcfb50e 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.
2021-05-15 08:34:28 -03:00
David Edmondson
8b7c09c66b 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.
2021-02-05 10:12:53 -04:00
Jonas Bernoulli
1f14dbfbd7 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.
2021-01-15 07:30:33 -04:00
Jonas Bernoulli
f1ae9addc6 emacs: notmuch-show--get-cid-content: cosmetics 2021-01-15 07:30:14 -04:00
Jonas Bernoulli
99bf983d8c emacs: notmuch-show--register-cids: fix names of bindings 2021-01-15 07:30:00 -04:00
Jonas Bernoulli
6cae6f32b1 emacs: notmuch-mua-add-more-hidden-headers: use local binding 2021-01-15 07:29:09 -04:00
Jonas Bernoulli
a2bf29ad35 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".
2021-01-15 06:49:07 -04:00
Jonas Bernoulli
055294454f 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.
2021-01-15 06:48:24 -04:00
Jonas Bernoulli
9b5fd49ab2 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.
2021-01-15 06:47:48 -04:00
Jonas Bernoulli
371f481d93 emacs: use string-empty-p 2021-01-15 06:47:28 -04:00
Jonas Bernoulli
f3d6fa2e40 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.
2021-01-15 06:47:10 -04:00
Jonas Bernoulli
9ca1f945d9 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.)
2021-01-15 06:46:38 -04:00
Jonas Bernoulli
f47e3333b5 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)?
2021-01-15 06:45:30 -04:00
Jonas Bernoulli
25a8873c68 emacs: reorder notmuch.el a bit 2021-01-15 06:45:20 -04:00
Jonas Bernoulli
c6ac1121d4 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: f47eeac0b0
   emacs: set default in notmuch-read-query
2021-01-15 06:45:09 -04:00
Jonas Bernoulli
42d32713be 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.
2021-01-15 06:44:01 -04:00
Jonas Bernoulli
b614ea7563 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.
2021-01-15 06:43:13 -04:00
Jonas Bernoulli
692acdf9da emacs: various doc-string improvements 2021-01-15 06:40:58 -04:00
Jonas Bernoulli
65fc5ea758 emacs: various comment improvements 2021-01-15 06:38:43 -04:00
Jonas Bernoulli
16b2db0986 emacs: various cosmetic improvements 2021-01-15 06:38:00 -04:00
Jonas Bernoulli
1bbbde4a0c 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.
2021-01-13 07:23:11 -04:00