Commit graph

1075 commits

Author SHA1 Message Date
David Bremner
9b2a548189 emacs/tag: keep tag history
This buffer local list will be used to provide an undo facility for
tagging operations. Keeping history can be disabled with the new
OMIT-HIST option.
2022-02-26 07:57:58 -04:00
David Bremner
d298af9e9d emacs: remove non-batch code path from function notmuch-tag
It is no slower (according to T06-emacs) to use batch for everything,
and it simplifies the code.
2022-02-25 08:39:05 -04:00
David Bremner
6286b76a69 emacs: escape quote in notmuch-search-result-format docstring
Prevent Emacs' mangling of quotes, which breaks the code sample.
2022-02-16 07:56:42 -04:00
David Bremner
e1e1b1176d emacs: remove png logo
Reduce chance of downstream packagers packing the wrong file.
2022-02-12 20:18:44 -04:00
David Bremner
da302e1cba emacs: use cached encoded copy for fcc
This fixes the bug reported by dkg in [1]. The movement of the call to
n-m-setup-message-for-saving is so the cleanup of Fcc headers happens
in the encoded version (otherwise Fcc headers may be saved to disk).

[1]: id:87k1zm225v.fsf@fifthhorseman.net
2022-01-26 07:22:09 -04:00
jao
15207652a1 emacs: customizable names for search buffers
Customizable names for buffers presenting search results, via two
custom variables (notmuch-search-buffer-name-format and
notmuch-saved-search-buffer-name-format), defaulting to values
currently used for plain searches and including too tree and
unthreaded search buffers.

Amended by db: spelling fix.
2022-01-23 20:47:49 -04:00
David Bremner
21cce961b9 emacs: define, use option :disable-excludes for n-h-query-counts
Initially only use in notmuch-hello-insert-alltags. This is a more
narrow resolution of [1], which (unlike [2]) does not disable exclude
processing for regular saved searches.

[1]: id:87wox1vovj.fsf@len.workgroup
[2]: id:20220105010606.2034601-2-david@tethera.net
2022-01-23 14:27:06 -04:00
David Bremner
68640fd967 Revert "emacs: use --exclude=false when checking for empty searches"
Revert commit 8370e3cfe2, and remark the
corresponding test as broken. Also update the expected output of the
broken test to show excludes active in the user defined saved searches.
2022-01-23 14:21:46 -04:00
David Bremner
cc180507b0 emacs: use --exclude=false when counting total messages
Even if a user excludes a large fraction of their messages, they still
nonetheless exist and are searchable.
2022-01-20 15:32:21 -04:00
David Bremner
8370e3cfe2 emacs: use --exclude=false when checking for empty searches
In particular tags that only occur on otherwise excluded messages do
not show up in "All tags" without this change. The reported numbers
_do_ take excludes into account, so it is possible that
searches (e.g. the aformentioned tags) will show up with a count of
zero.
2022-01-20 15:31:36 -04:00
LdBeth
c7c422ded2 emacs/notmuch-tag.el: add xmlns attribute to svg icons
emacs-mac that compiled with OS X system API for image display
support cannot correctly render svg without xmlns parameter [1].

[1]: id:tencent_127AA231767438AC66FEE4DDB4BBF51DF909@qq.com
2022-01-14 17:12:41 -04:00
jao
332b3b639e emacs: make header line in notmuch-show buffers optional
New notmuch-show-header-line customizable boolean to allow inhibiting
a header line in notmuch-show-mode buffers (for instance, because one
prefers to just include Subject in notmuch-message-headers).
2022-01-10 08:03:40 -04:00
David Bremner
6721e2eac5 emacs: update coolj-line-prefix-regexp to make space optional
Jani reported that lines prefixed with '>' (as opposed to '> ') are
not highlighted properly [1]. David E responded with a updated regex
[2]. This change implements David E's suggestion.

[1]: id:87a8b5pcky.fsf@nikula.org
[2]: id:m2pok1e3gv.fsf@dme.org
2021-12-29 14:24:21 -04:00
Tomi Ollila
031f4b4da5 emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays
emacs/notmuch-logo.svg is handcrafted scalable vector graphics version
of the notmuch logo.

Emacs on graphic displays render this image four times in size compared
to the emacs/notmuch-logo.png, and the image is much sharper.

The rendered image size, 100x100 pixels, fits reasonably well with
text shown in various font sizes.

Scaling the image -- if desired -- may come in the future. For now
this is improvement on how the logo looked in notmuch-hello window.
2021-12-23 08:16:49 -04:00
Kyle Meyer
ed03babd05 emacs/tree: fix docstrings for author faces
The docstrings for notmuch-tree-match-author-face and
notmuch-tree-no-match-author-face incorrectly match the docstring of
notmuch-tree-match-date-face.
2021-12-12 10:14:07 -04:00
David Bremner
20b2150406 emacs: don't add space to tag completion candidates.
Apparently this messes up various third party completion
frameworks. This change does mean that users will have to hit space
after completing a tag change in order to enter another change.

As a bonus, remove the call to #'delete, since
completing-read-multiple already promises to remove empty strings.
2021-12-04 12:56:43 -04:00
David Bremner
eafb033d32 emacs: run notmuch-search-hook lazily
In message id:YT3ueuZHKW931NW3@localhost, Fabio Natali isolated a
visual glitch caused by running notmuch-search-hook too early. This
change moves the running of that hook to
notmuch-search-process-filter, which ensures there is some output in
the buffer before running the hook. Since n-s-p-f can be called many
times for a given buffer, add a buffer local flag to make sure it is
only run once per buffer.
2021-12-04 12:11:52 -04:00
David Bremner
20b2ae1218 emacs: drop C-tab binding in hello mode, document <backtab>.
The <backtab> binding has always been there, but the docs were
apparently mistakenly changed to say <backspace> [1]

Revert to <backtab> in the documentation.

The commit also drops the C-<tab> binding, since it seems redundant
and it interferes with tab-bar-mode.

[1]: 703dec7754.
2021-12-03 20:28:12 -04:00
David Bremner
78416a3e97 emacs: improve notmuch-*-from-current-query docstrings
Err on the side of providing better user documentation, rather than
documentation for developers.
2021-10-30 15:19:10 -03:00
David Bremner
55c6570318 emacs: add minimal docstring for notmuch-unthreaded
The missing docstring causes a blank in the notmuch-help display
[1]. Since the function is a simple wrapper for notmuch-tree, it seems
fair to forward the reader there for more detailed information.

[1]: id:878sape5a9.fsf@disroot.org
2021-10-30 15:18:51 -03:00
Doug Woos
175476d1d1 emacs: fix call to nonexistent notmuch--call-process-shell-command
Looks like a find/replace error in e722b4f4
2021-10-19 08:43:14 -03:00
jao
81cbffa65f emacs: notmuch-tree: customizable strings for drawing trees
New customizable variable, notmuch-tree-thread-symbols, that allows
tweaking of how trees in a forest are represented.  For instance, one
can now choose to use an hyphen rather than a white space as a prefix,
or replace the character(s) used to draw arrows.

Amended-By: db; delete errant '3'
2021-09-20 20:39:28 -03:00
David Bremner
e722b4f48c emacs: wrap call-process
Provide safe working directory
2021-09-11 11:11:29 -03:00
David Bremner
eb226437e1 emacs: wrap make-process
Provide a safe working directory.
2021-09-11 10:27:38 -03:00
David Bremner
5e5f2122f9 emacs: wrap call-process-region
As with notmuch--process-lines, initial purpose is to provide a safe
binding for default-directory. This is enough to make notmuch-hello
robust against non-existent or corrupt values default-directory, but
probably not other views.
2021-09-11 10:19:27 -03:00
David Bremner
a890241138 emacs: wrap process-lines
Initially just set the working directory, to avoid (the implicit)
call-process crashing when the default-directory points to a
non-existent location.

Use of a macro here is over-engineering for this change, but the same
change needs to be applied to several other process creation
primitives.
2021-09-11 10:16:47 -03:00
David Edmondson
17bfc25bb3 emacs: Allow functions in notmuch-{tree,unthreaded}-result-format
If the car of an element in notmuch-tree-result-format or
notmuch-unthreaded-result-format is a function, insert the result of
calling the function into the buffer.
2021-09-08 23:00:45 -03:00
David Edmondson
4f4ec48df2 emacs: Allow functions in notmuch-search-result-format
If the car of an element in notmuch-search-result-format is a
function, insert the result of calling the function into the buffer.

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

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

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

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

The first few characters on each line of the search result are used to
show information about some significant tags associated with the
thread.
2021-09-08 22:59:48 -03:00
David Edmondson
071fb57a35 emacs: Use pcase in notmuch-search-insert-field
Rather than lots of string-equal calls, use the pcase macro.
2021-09-08 22:59:25 -03:00
Jonas Bernoulli
b03b0d4e41 emacs: notmuch-fcc-header-setup: fix regression
With [1: 16b2db09] we lost the (undocumented) option to use no Fcc
header only for From addresses matching a regexp.  This brings back
that feature and documents it.

1: 2021-01-15 16b2db0986
   emacs: various cosmetic improvements
2021-09-08 22:40:53 -03:00
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