[PATCH v2 07/13] emacs: add "*" binding for notmuch-show view
Dmitry Kurochkin
dmitry.kurochkin at gmail.com
Sun Jan 29 18:26:16 PST 2012
The patch adds `notmuch-show-tag-all' function bound to "*" in
notmuch-show view. The function is similar to the
`notmuch-search-tag-all' function for the notmuch-search view: it
changes tags for all messages in the current thread.
---
emacs/notmuch-show.el | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 11dab2d..0d90c1e 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-tag-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)
@@ -1488,6 +1489,20 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."
initial-input (notmuch-show-get-message-id))))
(apply 'notmuch-show-tag-message tag-changes)))
+(defun notmuch-show-tag-all (&rest tag-changes)
+ "Change tags for all messages in the current thread.
+
+TAG-CHANGES is a list of tag operations for `notmuch-tag'."
+ (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
+ (apply 'notmuch-tag notmuch-show-thread-id tag-changes)
+ (save-excursion
+ (goto-char (point-min))
+ (loop do (let* ((current-tags (notmuch-show-get-tags))
+ (new-tags (notmuch-update-tags current-tags tag-changes)))
+ (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