Commit graph

1132 commits

Author SHA1 Message Date
David Bremner
4e85abda15 Revert "emacs: Fix saved-search buffer titles"
This reverts commit bc98920917.

This was applied unintentionally to master while still under discussion.
2024-08-09 10:18:54 -03:00
David Bremner
bf9b9fe046 emacs/tree: sanitize subjects when drawing tree
This fixes the bug reported in

     id:6F2EF901-8B4B-44FF-83C5-22F732BA95A6@gmail.com

Unfortunately it turns out our test data has several tabs in the
subject lines. The expected output was updated to reflect their
removal and the ripple effect of several more subjects matching the
previous ones.
2024-08-06 08:29:40 -03:00
Rudolf Adamkovič
bc98920917 emacs: Fix saved-search buffer titles
REPRODUCTION STEPS:

  (let ((notmuch-saved-searches
         (list (list :name "Emacs List"
                     :query "query:lists-emacs")
               (list :name "All Lists"
                     :query "query:lists"))))
    (notmuch-search-buffer-title "query:lists-emacs" ))

ACTUAL:

  "*notmuch-saved-search-[ All Lists ]-emacs*"

EXPECTED:

   "*notmuch-saved-search-Emacs List*"
2024-08-06 06:25:07 -03:00
Tony Zorman
fefc7a9474 emacs/mua: optionally check for erroneous subjects
This works much like notmuch-mua-attachment-regexp, but for the
subject instead. By default, check for empty subjects, as that seems a
reasonable thing to safeguard against.
2024-07-25 19:37:08 +09:00
David Bremner
b8fe20f339 emacs/hello: refresh hello directly
According to the now deleted commentary, the hack of using run-at-time
was needed for Emacs 24. It seems to be no longer needed for Emacs
28.2, and removing it makes further changes to the code simpler.
2024-07-25 17:43:43 +09:00
Michael J Gruber
b526c5ef0e Replace without-restriction with save-restriction
37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
introduced a fix for draft saving in a way which is supported on Emacs
29 and above only. Replace this with a construct which we have used
before, so that we keep the same compatibility level.
2024-06-19 07:38:23 -03:00
Marc Fargas
37c022aea0 Use without-restriction in with-temporary-notmuch-message-buffer
This ensures that the temporary copy of the current message-mode
buffer is whole and not limited by a current restriction.

An example of such restriction is the default one established by
message-mode when composing a reply, that hides the References,
In-Reply-To and similar headers.
2024-06-15 14:54:04 -03:00
David Bremner
b02a53a5cc emacs/show: fix for text/calendar display
In certain scenarios involving symlinks and setting
find-file-visit-truename, text/calendar parts were not displayed
properly.

Following a suggestion of Al Haji-Ali [1], replace the use of
get-file-buffer with find-buffer-visiting.

[1]: id:m2wmneguh8.fsf@gmail.com
2024-06-15 14:40:01 -03:00
Mohsin Kaleem
e8e2d5247e emacs: Allow customizing :excluded in notmuch-saved-searches
Provide customize support for the new feature introduced in
cd89065d.

Commit message expanded by: db
2024-05-29 07:54:50 -03:00
Mohsin Kaleem
cd89065dc3 emacs: Add new option notmuch-search-hide-excluded
The new notmuch-search-hide-excluded option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local notmuch config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-hide-excluded and
notmuch-tree-toggle-exclude have also been added. They toggle the value
of notmuch-search-hide-excluded for the search in the current search or
tree buffer. It's bound to "i" in the respective keymaps for these
modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this include:
  + notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

A new test file for Emacs has been added which covers the usage of the
new `notmuch-search-hide-excluded' option and interactively hiding or
showing mail with excluded tags. These test cover the basic usage of
the `notmuch-search-toggle-hide-excluded' command in notmuch-search,
notmuch-tree and notmuch-unthreaded searches. These tests also cover
the persistence of the current value of the hide-excluded mail option
as a user switches from between these different search commands.

[1]: id:87ilxlxsng.fsf@kisara.moe

Amended-by: db, fix indentation in T461-emacs-search-exclude.sh
2024-04-06 15:03:45 -03:00
Jelle Licht
8d06dfce17 emacs: Autoload notmuch-user-agent related functions
With this change, users with mail-user-agent set to
'notmuch-user-agent can start composing emails without having to
require 'notmuch-mua first.
2024-04-04 08:20:51 -03:00
Dmitry Bogatov
d1ba5d6342 emacs: Mark "notmuch-tree" command for autoloading
Some people (e.g: me) prefer to read their email with threaded
representation by default.

Without this commit, I have to run "notmuch-search" (autoloaded)
first to get "notmuch-tree" loaded.
2024-04-04 08:16:36 -03:00
David Bremner
b49377e509 Merge branch 'release' 2023-12-01 08:11:39 -04:00
Jani Nikula
67990376b7 notmuch-emacs-mua: avoid extra separators at the end of the line
Currently the --to/--cc/--bcc options add "user@example.com, " to the
message headers, with the the unnecessary ", " separator after the
last address, regardless of how many addresses are being added.

This used to be fine, but with recent emacs mm, trying to send the
email with the trailing commas leads to prompt:

  Email address  looks invalid; send anyway? (y or n)

Fix this by only adding the commas between addresses, avoiding the
trailing commas.
2023-12-01 07:22:26 -04:00
David Bremner
e4ead7656c emacs/mua: change name of ignored parameter
Suppress compiler warning.
2023-10-06 20:37:16 -03:00
David Bremner
5de7beec16 emacs/address: rewrite docstring for n-a-selection-function
The previous version essentially repeated the source code, and
generated a compiler warning.
2023-10-06 20:37:16 -03:00
David Bremner
c273266503 emacs: wrap docstrings
Suppress byte-compiler warnings about >80 character docstrings.
2023-10-06 20:37:11 -03:00
David Bremner
fc1c81c378 emacs: update quoting in docstrings
The complicated looking escapes are needed to avoid compile time
warnings.  (info "(elisp) Text Quoting Style") for details.
2023-10-06 20:36:56 -03:00
David Bremner
a064a25427 emacs/show: special case toggling display of images
According to emacs upstream [1], we can't expect overlay invisibility
and images to get along. This commit uses the previously stashed
undisplayer functions to actually remove the images from the buffer.
When the image is toggled, it is essentially redisplayed from scratch,
using the previously stashed redisplay data.

[1]: https://lists.gnu.org/archive/html/emacs-devel/2023-08/msg00593.html
2023-10-01 07:47:16 -03:00
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