Commit graph

1113 commits

Author SHA1 Message Date
David Bremner
0646d4855b emacs: save image redisplay data during non-lazy display
This data will eventually be used to redisplay hidden images. A
certain amount of refactoring is done here to avoid code
duplication.
2023-10-01 07:47:16 -03:00
David Bremner
bfcfa947f8 emacs/show: save redisplay redisplay data when showing lazy part.
This data will be used to redisplay an image that is hidden by
deleting it from the buffer.  We cannot easily delay until the image
is hidden, as we won't have the original data at that point.
2023-10-01 07:47:16 -03:00
David Bremner
b1129d905a emacs: save undisplayer function for MIME parts
For some kinds of MIME parts (at least images), our trickery with
overlays will not work, so save the more drastic function created by
Gnus that actually deletes the part from the buffer. In an ideal world
we would return this function as (part of) a value, but here the call
stack is too complicated for anything that simple, so we stash it in
the part plist and rely on that being preserved (unlike the mm handle,
which is transient).
2023-10-01 07:47:16 -03:00
David Bremner
48d774bbf4 emacs/tree: use two argument form of setq-local
Apparently the macro setq-local only takes two arguments in Emacs 26.1
2023-02-21 10:55:42 -04:00
jao
f63d14a8c1 emacs: notmuch-tree-outline-mode
With this mode, one can fold trees in the notmuch-tree buffer as if
they were outlines, using all the commands provided by
outline-minor-mode.  We also define a couple of movement commands
that, optional, will ensure that only the thread around point is
unfolded.

The implementation is based on registering a :level property in the
messages p-list, that is then used by outline-minor-mode to to
recognise headers.

Amended by db: Copy docstring to manual and edit for presentation. Add
two tests. Fix typo "wether".
2023-02-20 08:58:32 -04:00
David Bremner
5ba7684445 emacs/show: use n-s-i-headerline to update tags
Although this has more steps than the previous regular expression
search and replace, it should be more robust against changes in the
headerline format, such as the inclusion of duplicate numbers (which
broke the previous version).
2022-11-15 07:34:25 -04:00
David Bremner
056249627a emacs/show: add optional orig-tags argument to n-s-i-headerline
This will support use of this function in notmuch-show-update-tags.
2022-11-15 07:28:29 -04:00
David Bremner
2b842a1d8c emacs/show: use plist to pass message info to n-s-insert-headerline
This should allow calling notmuch-show-insert-headerline from other
places without duplicating the set of plist accesses.
2022-11-15 07:28:02 -04:00
Russell Sim
82aa1acc0c emacs: move From header addition to after header intern
OTHER-HEADERS are expected to be passed as strings, to match the
implementation of `compose-mail'.  But the "From" header is currently
expected to be passed as a symbol.  Instead the "From" header can be
safely added after converting all the headers to symbols.
2022-11-05 13:30:50 -04:00
Matt Armstrong
b6565c1c54 emacs: fix dangling overlays in notmuch-search
notmuch-search-insert-authors now sets the evaporate property on the
ellipsis overlays.  Emacs will delete them when the buffer contents
are zeroed out, which happens with `notmuch-refresh-buffer`.  This
prevents them from being collapsed to zero-width overlays in position
1.  See Emacs bug#58479.  An upcoming change in Emacs will make these
dangling overlays visible to the user.
2022-11-05 13:13:43 -04:00
Tomi Ollila
3db892f43b emacs: add notmuch-search-edit-search and notmuch-tree-edit-search
...and bind these to "E" in their respective keymaps.

Expected to be called interactively, then using read-from-minibuffer
with current search string as initial contents for editing.
(Noninteractive use makes little sense, but is supported.)

With this one can expand (as an opposite to limit) their
query and have e.g. (some of their) saved searches as search
"templates".

While at it, removed `(defvar notmuch-search-query-string)` from
notmuch-tree.el; it is unused (`notmuch-tree-basic-query` is used
instead).

Thanks to Jose Antonio Ortega Ruiz for his example for notmuch-tree
code, and better interactive use.
2022-09-23 20:23:58 -03:00
Antoine Beaupré
a3b46fa8bb emacs/show: use read-shell-command instead of read-string
This enables auto-completion of commands, something which plain
read-string does not do. It's otherwise a drop-in
replacement. According to `C-h f`, read-shell-command was introduced
in Emacs 23.1 or earlier.
2022-09-03 08:12:16 -03:00
jao
684eeb65c7 emacs: new notmuch-tree-process-exit-functions
Hook run when the tree insertion process finishes its job.

--
This patch supersedes <id:20220816214023.1523322-1-jao@gnu.org>, but
changing the new variable name.

Right now, it can be used for silly things like removing or changing
the the "End of search." hardcoded message in the tree buffer.  But
also for more sophisticated things like folding all threads in add-ons
like my outline mode for tree buffers (to be submitted).

Signed-off-by: jao <jao@gnu.org>
2022-09-03 08:11:37 -03:00
David Bremner
5a47b5a884 emacs: add docstring for notmuch-show-choose-duplicate
It should have one in any case, but in particular it is needed for the
manual.
2022-08-11 07:25:28 -03:00
David Bremner
d273263d16 emacs/show: restrict inlined mimetypes on refresh.
This fixes the bug reported by Al [1]. Essentially apply the same fix
as [2] in a different place.

[1]: id:877d41nmr1.fsf@gmail.com
[2]: 90a7c1af36
2022-08-11 07:17:17 -03:00
David Bremner
6d6d2a5fe7 emacs: add duplicate support to notmuch-show-view-raw-message
This fixes one of the bugs reported by Gregor in [1]

[1]: id:87edxw8jp4.fsf@no.workgroup
2022-08-07 07:05:49 -03:00
David Bremner
05c85290ca emacs/show: provide a more friendly function to get duplicate num
There is not much code here, but at least we can fix the indexing as 1
based.
2022-08-07 07:05:49 -03:00
David Bremner
1849c68d0f emacs: update notmuch-show-get-filename to handle duplicates
This fixes one of the bugs reported by Gregor in [1].

[1]: id:87edxw8jp4.fsf@no.workgroup
2022-08-07 07:05:49 -03:00
David Bremner
9d013801bb emacs: update defcustom for notmuch-unthreaded-result-format
This is essentially a copy of that for notmuch-tree-result-format,
aside from the default value.
2022-07-30 08:53:25 -03:00
David Bremner
25ebb9e7d3 emacs: update defcustom for notmuch-search-result-format.
It seems redundant to have the previous example, since the default
value is always show by describe variable.

Enforce more restrictions on the keys in the alist, since arbitrary
strings don't work as field names.

Document that functions can be used in lieu of field names.
2022-07-30 08:52:47 -03:00
David Bremner
4237409faf emacs: update defcustom for notmuch-search-result-format.
It seems redundant to have the previous example, since the default
value is always show by describe variable.

Enforce more restrictions on the keys in the alist, since arbitrary
strings don't work as field names.

Document that functions can be used in lieu of field names.
2022-07-30 08:52:26 -03:00
David Bremner
1ef7c75111 emacs/reply: reply to correct duplicate
Essentially we just need to arrange to pass the right --duplicate
argument to notmuch reply.

As a side-effect, correct the previously unused value of EXPECTED in
T453-emacs-reply.sh.
2022-07-30 08:46:22 -03:00
David Bremner
24decfc1dd CLI/reply: support --duplicate argument
We want the reply used to match that shown e.g. in the emacs
interface. As a first step provide that functionality on the command
line.

Schema does not need updating as the duplicate key was already
present (with a constant value of 1).
2022-07-30 08:45:15 -03:00
David Bremner
5ea5a5557d emacs/show: display count of duplicates in headerline
There is no real cost here, except screen real estate. Some people
might prefer hiding the duplicate count, but we leave that for a
future commit.
2022-07-30 08:44:14 -03:00
David Bremner
b3d466bf39 emacs/show: provide notmuch-show-choose-duplicate
This new command allows the user to interactively choose a different
duplicate (file) to display for a given message in
notmuch-show-mode. Since both tree and unthreaded view use
notmuch-show-mode, this provides the same facility there.
2022-07-30 08:42:12 -03:00
David Bremner
bde8ea5d1d emacs/show: introduce notmuch-show-height-limit
Analogous to notmuch-show-depth-limit, it requires a bit more
calculation, but that cost seems dominated by the rendering cost.
2022-07-14 11:51:01 -04:00
David Bremner
e580ce0058 emacs/show: obey notmuch-show-max-text-part-size for part 0
This parameter was originally introduced to hide large attachements
that happened to be text/plain. From a performance point of view,
there is no reason not to also hide large message bodies.
2022-07-14 11:48:30 -04:00
David Bremner
1d254bd35e emacs/show: optionally insert bodies of "deep messages" lazily
This leverages the machinery already there to insert buttons for
attachments.

A potential use-case is browsing the top layers of the tree to decide
which of the lower subtrees to read.
2022-07-14 11:47:49 -04:00
David Bremner
5500868bd9 emacs: mark notmuch-query.el as obsolete
The only functionality actually used by notmuch is the base function
notmuch-query-get-threads; the other functions in this file have
nothing to do with that (single) use.  Move that function into
notmuch-lib.el and rename to reflect use. Deprecate the other
functions in notmuch-query.el.
2022-07-03 17:08:08 -03:00
jao
9695e4c38d emacs: use message-dont-reply-to-names when composing replies
notmuch-mua functions for replies now use the built-in customizable
variable message-dont-reply-to-names with the same semantics as
message-mode.
2022-06-16 08:51:19 -03:00
Leo Okawa Ericson
fb4a0967ca emacs: Make notmuch-show-next-thread return nil on failure
Having notmuch-show-next-thread return non-nil on success and nil on
failure makes it easier for users to interact with notmuch via elisp.

This commit changes notmuch-search-show-thread too since the return
value of notmuch-show-next-thread depends on notmuch-search-show-thread.

Amended by db: fix whitespace in T450-emacs-show
2022-06-13 08:06:51 -03:00
Damien Cassou
3a6b479a73 emacs: change where notmuch-mua-mail moves point
Move point to the position that makes the most sense instead of always
moving point to the TO.  This is useful when TO/SUBJECT are passed as
argument.

Amended by db: move news item to UNRELEASED.
2022-06-02 08:21:56 -03:00
jao
66369ddf1c emacs: notmuch-show-header-line: allow format strings and functions
If a string value is assigned to notmuch-show-header-line, it's used
as a format string to be passed passed to format-spec with `%s`
substituted by the message's subject.  If a function is given, it's
called with the subject as argument, and its return value used as
header line.

As before, t means displaying the subject and nil not using any header
line.

Signed-off-by: jao <jao@gnu.org>
Amended-by: db, docstring spelling fix
2022-06-01 08:36:20 -03:00
David Bremner
fd46fc1977 emacs: document/defcustom notmuch-multipart/alternative-discouraged
This variable is important for people who want to change the default
behaviour when displaying multipart/alternative messages.  Previously
it was undocumented.  Add a defcustom to help users and copy some
documentation from the wiki. The usual machinery of re-using
docstrings is a bit tricky to use here because it mangles the example
lisp code, and the link to the info node should not be in e.g. the
html page.

Add a simple test to make sure the switch from defvar to defcustom did
not break something obvious.
2022-05-20 22:40:32 -03:00
David Bremner
90a7c1af36 emacs/reply: restrict what mime types are inlined by default
Apply the previously factored-out function used by notmuch-show.
2022-05-16 07:12:47 -03:00
David Bremner
817e53f4db emacs: factor out calculation of mm-inline-override-types
The intended use case of this new function is to make reply behaviour
track that of show with respect to attachments.

Also fix the glob (which worked by fluke) into the documented regexp.
2022-05-16 07:12:28 -03:00
David Bremner
19cf3910a5 emacs: redirect undo to notmuch-tag-undo
The double remap is a bit ugly, but it seems better than adding
another layer of keymaps for those modes where notmuch-tag-undo makes
sense.
2022-02-26 08:00:11 -04:00
David Bremner
cc2c3a383d emacs: add notmuch-tag-undo
Keybindings are deferred to a future commit.
2022-02-26 07:58:14 -04:00
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