The previous version of
notmuch-show-imenu-prev-index-position-function was calling
notmuch-show-previous-message which was recentering the window. This
is a problem when which-func-mode is active because which-func-mode is
called each time the user moves point around.
Because this function is only meant to be executed by imenu, there is
no reason to recenter the window. For the same reason, the new
implementation doesn't have to follow strictly how
notmuch-show-previous-message is implemented because imenu only places
point at very specific locations before calling
notmuch-show-imenu-prev-index-position-function.
Lars Kotthoff [Thu, 6 Feb 2025 02:52:51 +0000 (19:52 -0700)]
fix segfaults in Python cFFI API and add tests
Several iterators in the Python cFFI API destroyed the objects they iterated
over too early (when the iterator was exhausted), causing subsequent segfaults
in common cases like creating a list from the iterator. This patch fixes the
segfaults and add tests to ensure that they don't happen again.
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.
David Bremner [Thu, 21 Dec 2023 17:04:00 +0000 (09:04 -0800)]
CLI/show: warn if crypto options are used with mbox format
This limitation seems somewhat hard to fix, but at least try to warn
users when combining crypto operations with mbox output format.
Because the default is --decrypt=auto, the warning is omitted if
--decrypt=auto is specified. While this is not great, it seems more
wrong to always warn, or to change the default because of this.
James McCoy [Sat, 3 Aug 2024 18:56:06 +0000 (14:56 -0400)]
Convert notmuch-vim to Vim addon policy 2.0
The new Vim addon policy relies on Vim's native package functionality,
rather than the Debian-specific vim-addons tool. This allows the addon
to be immediately available when the package is installed, rather than
requiring extra setup by the user.
* Install notmuch-vim to its own /usr/share/notmuch-vim directory, so
the files are self-contained.
* Remove vim-addon-manager from notmuch-vim Depends
* Add ${vim-addon:Depends} to notmuch-vim Depends to ensure it has the
required relationships on Vim/Neovim.
* Build-Depend on dh-sequence-vim-addon to automatically setup the
required symlinks for Vim and Neovim to see the addon.
Tony Zorman [Sun, 29 Oct 2023 07:26:32 +0000 (08:26 +0100)]
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.
David Bremner [Thu, 21 Sep 2023 19:50:02 +0000 (16:50 -0300)]
CLI: update commentary in config file to better match code
This comment has been out of date since notmuch 0.32. Although it
isn't really possible to explain all the options here, explain both
one new "split" way of doing things and the traditional one with
database inside $MAIL_ROOT/.notmuch.
David Bremner [Sat, 22 Jul 2023 12:15:56 +0000 (09:15 -0300)]
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.
David Bremner [Mon, 3 Apr 2023 10:22:48 +0000 (07:22 -0300)]
CLI/git: add reset command
Sometimes merging is not what we want with tags; in particular it
tends to keep tags in the local repo that have been removed elsewhere.
This commit provides a new reset command; the reset itself is trivial,
but the work is to provide a safety check that uses the existing
--force and git.safe_fraction machinery.
Michael J Gruber [Mon, 17 Jun 2024 19:28:25 +0000 (21:28 +0200)]
Replace `delete-line` with its definition
37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
introduced `delete-line` in a test, but this is Emacs 29 and above only.
Replace it with its (almost) definition.
Michael J Gruber [Mon, 17 Jun 2024 19:28:24 +0000 (21:28 +0200)]
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.
Marc Fargas [Thu, 14 Mar 2024 14:56:49 +0000 (15:56 +0100)]
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.
David Bremner [Sun, 26 May 2024 12:52:32 +0000 (09:52 -0300)]
test/cli: Add known broken test for (missing) quoting in From
In [1], Jakub Wilk observes that the current behaviour is confusing
since it looks like there are two mailboxes in From, while in fact
there is only one. It seems to me that notmuch should at least quote
the display-name part of a mailbox if it has "funny" characters in it,
and perhaps always quote it. Either way will require changing the
indexing code, since the structure is lost when writing the headers to
the database.
Mohsin Kaleem [Sun, 10 Mar 2024 18:57:41 +0000 (18:57 +0000)]
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
David Bremner [Sat, 30 Sep 2023 11:40:50 +0000 (08:40 -0300)]
perf-test/tag: add maildir sync tests
Today someone asked me the (reasonable) question of how much
performance impact there is from synching tags to maildir flags. It
turns out it is noticeable, about a 50% overhead compared to
non-synched tags (according to these tests). In practice I don't know
if it's a big problem for users, since I don't know what fraction of
tagging operations involve "special" tags.
Jakub Wilk [Fri, 12 Jan 2024 16:27:48 +0000 (17:27 +0100)]
CLI/git: remove unused import
shutil was used only for the tempfile.TemporaryDirectory backport,
which was removed in commit b7c31f658121a0cf ("CLI/git: drop support for
python < 3.2").
David Bremner [Sun, 3 Dec 2023 18:56:44 +0000 (14:56 -0400)]
lib: clear error message on success in _choose_database_path
Previously we both found a database and returned a message saying that
the database could not be found (along with a success code). This
change should prevent spurious error output.
Jani Nikula [Thu, 30 Nov 2023 16:13:19 +0000 (18:13 +0200)]
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.
David Bremner [Sat, 25 Nov 2023 12:33:52 +0000 (08:33 -0400)]
lib/string_map: simulate stable sorting
qsort(3) does not promise stability, and recent versions of glibc have
been showing more unstable behaviour [2]. Michael Gruber observed [1] test
breakage due to changing output order for message properties.
We provide a sorting order of (key,value) pairs that _looks_ stable by
breaking ties based on value if keys are equal. Internally there may
be some instability in the case of duplicate (key,value) pairs, but it
should not be observable via the iterator API.
David Bremner [Sun, 24 Sep 2023 09:51:52 +0000 (06:51 -0300)]
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.
David Bremner [Sun, 24 Sep 2023 09:51:50 +0000 (06:51 -0300)]
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.
David Bremner [Sun, 24 Sep 2023 09:51:49 +0000 (06:51 -0300)]
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).
David Bremner [Fri, 15 Sep 2023 12:50:04 +0000 (09:50 -0300)]
Pass error message from GLib ini parser to CLI
The function _notmuch_config_load_from_file is only called in two
places in open.cc. Update internal API to match the idiom in open.cc.
Adding a newline is needed for consistency with other status strings.
David Bremner [Fri, 15 Sep 2023 12:50:03 +0000 (09:50 -0300)]
test: add known broken subtest for the bad config error message
This is a bit fragile w.r.t. glib changing their error message, but it
already helped me find one formatting bug, so for now I think it's
worth it, instead of just grepping for "UTF-8".
David Bremner [Fri, 15 Sep 2023 12:50:02 +0000 (09:50 -0300)]
CLI: exit with error when load_config returns an error.
For now print a generic error message and exit with error on any
non-success code. Previously the code exited, but with exit code zero,
leading users / scripts to think the command had succeeded.