The normal tag commands in search mode tag the all threads meeting the
region when called interactively. This makes them do the same when
called non-interactively. This is a change in the api.
Previously calling notmuch-search-tag non-interactively meant it just
acted on the current thread, unless BEG and END were both
specified. This was true even when the region was active. This changes
it so that the non-interactive use matches the interactive use, and
uses the region when active. The caller can obtain the old behaviour
by passing (point) for both BEG and END.
This change has the side effect of fixing a bug aidecoe pointed out on
irc -- that tag-jump only tags single messages, not the whole
region. I think this is a genuine bug as it makes tag-jump
inconsistent with "+" and "a" for example.
The reason for this bug is that it calls notmuch-search-tag
non-interactively but doesn't specify BEG and END.
(Note that notmuch-search-archive-thread explicitly passes BEG and END
of the region to notmuch-search-tag -- this would not be necessary
with this patch).
Since this is a genuine bug in tag-jump it should be fixed -- if we
prefer not to break/change the api then the alternative is to pass the
region start and end explicitly. I will post a reply to this email
which does that for comparison.
emacs/notmuch.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6c36ad8..8bb6706 100644
@@ -562,12 +562,15 @@ Returns (TAG-CHANGES REGION-BEGIN REGION-END)."
See `notmuch-tag' for information on the format of TAG-CHANGES.
When called interactively, this uses the region if the region is
active. When called directly, BEG and END provide the region.
-If these are nil or not provided, this applies to the thread at
+If these are nil or not provided, then, if the region is active
+this applied to all threads meeting the region, and if the region
+is inactive this applies to the thread at point.
If ONLY-MATCHED is non-nil, only tag matched messages."
- (unless (and beg end) (setq beg (point) end (point)))
+ (unless (and beg end)
+ (setq beg (car (notmuch-search-interactive-region))
+ end (cadr (notmuch-search-interactive-region))))
(let ((search-string (notmuch-search-find-stable-query-region
beg end only-matched)))
(notmuch-tag search-string tag-changes)
notmuch mailing list