[PATCH 5/6] emacs: add "*" binding for notmuch-show view

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Fri Jan 27 20:41:23 PST 2012


The patch adds `notmuch-show-operate-all' function bound to "*" in
notmuch-show view.  The function is similar to the
`notmuch-search-operate-all' function for the notmuch-search view: it
changes tags for all messages in the current thread.
---
 emacs/notmuch-show.el |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 03eadfb..2ca4d92 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1073,6 +1073,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(define-key map "c" 'notmuch-show-stash-map)
 	(define-key map "=" 'notmuch-show-refresh-view)
 	(define-key map "h" 'notmuch-show-toggle-headers)
+	(define-key map "*" 'notmuch-show-operate-all)
 	(define-key map "-" 'notmuch-show-remove-tag)
 	(define-key map "+" 'notmuch-show-add-tag)
 	(define-key map "x" 'notmuch-show-archive-thread-then-exit)
@@ -1489,6 +1490,21 @@ i.e. a list of tags to change with '+' and '-' prefixes."
 		       initial-input (notmuch-show-get-message-id))))
     (apply 'notmuch-show-tag-message changed-tags)))
 
+(defun notmuch-show-operate-all (&rest changed-tags)
+  "Change tags for all messages in the current thread.
+
+`Changed-tags' is a list of tag operations for \"notmuch tag\",
+i.e. a list of tags to change with '+' and '-' prefixes."
+  (interactive (notmuch-select-tags-with-completion nil notmuch-show-thread-id))
+  (apply 'notmuch-tag notmuch-show-thread-id changed-tags)
+  (save-excursion
+    (goto-char (point-min))
+    (loop do (let* ((current-tags (notmuch-show-get-tags))
+		    (new-tags (notmuch-update-tags current-tags changed-tags)))
+	       (unless (equal current-tags new-tags)
+		 (notmuch-show-set-tags new-tags)))
+	  while (notmuch-show-goto-message-next))))
+
 (defun notmuch-show-add-tag ()
   "Same as `notmuch-show-tag' but sets initial input to '+'."
   (interactive)
-- 
1.7.8.3



More information about the notmuch mailing list