The normal tag commands make in search mode tag the all threads
meeting the region. This makes the tag jump commands do the same.

Since the notmuch-search-tag commands only look at the region when
called interactively we pass the region bounds as explicit arguments.

Also note that tree mode does not have the tag region functionality --
that is an omission but is independent of tag-jump.

This is an alternative to the patch in the parent email. The advantage
is that it doesn't break the api.

Note it would make sense to add tag-region functionality to tree-mode
but that would be a moderately large patch, and is essentially
independent of this change.

Best wishes


emacs/notmuch-tag.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 1b2ce5c..ef99803 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -28,6 +28,7 @@
 (require 'crm)
 (require 'notmuch-lib)
+(declare-function notmuch-search-interactive-region "notmuch" ())
 (declare-function notmuch-search-tag "notmuch" tag-changes)
 (declare-function notmuch-show-tag "notmuch-show" tag-changes)
 (declare-function notmuch-tree-tag "notmuch-tree" tag-changes)
@@ -511,6 +512,8 @@ and vice versa."
                             (notmuch-search-mode #'notmuch-search-tag)
                             (notmuch-show-mode #'notmuch-show-tag)
                             (notmuch-tree-mode #'notmuch-tree-tag)))
+            (extra-args (when (eq major-mode 'notmuch-search-mode)
+                          (notmuch-search-interactive-region)))
             (key (first binding))
             (forward-tag-change (if (symbolp (second binding))
                                     (symbol-value (second binding))
@@ -527,7 +530,7 @@ and vice versa."
                            (mapconcat #'identity tag-change " "))))
        (push (list key name-string
-                    `(lambda () (,tag-function ',tag-change)))
+                    `(lambda () (,tag-function ',tag-change ,@extra-args)))
     (push (list notmuch-tag-jump-reverse-key
                (if reverse

notmuch mailing list

Reply via email to