+ (define-key notmuch-show-mode-map "d"
+ (lambda ()
+ "toggle deleted tag for message"
+ (interactive)
+ (if (member "deleted" (notmuch-show-get-tags))
+ (notmuch-show-remove-tag "deleted")
+ (notmuch-show-add-tag "deleted"))))
+
+And version for notmuch 0.12 (not released yet)
+
+ (define-key notmuch-show-mode-map "d"
+ (lambda ()
+ "toggle deleted tag for message"
+ (interactive)
+ (notmuch-show-tag-message
+ (if (member "deleted" (notmuch-show-get-tags))
+ "-deleted" "+deleted"))))
+
+## Adding many tagging keybindings
+
+If you want to have have many tagging keybindings, you can save the typing
+the few lines of boilerplate for every binding (for versions before 0.12,
+you will need to change notmuch-show-apply-tag-macro).
+
+ (eval-after-load 'notmuch-show
+ '(define-key notmuch-show-mode-map "`" 'notmuch-show-apply-tag-macro))
+
+ (setq notmuch-show-tag-macro-alist
+ (list
+ '("m" "+notmuch::patch" "+notmuch::moreinfo" "-notmuch::needs-review")
+ '("n" "+notmuch::patch" "+notmuch::needs-review" "-notmuch::pushed")
+ '("o" "+notmuch::patch" "+notmuch::obsolete"
+ "-notmuch::needs-review" "-notmuch::moreinfo")
+ '("p" "-notmuch::pushed" "-notmuch::needs-review"
+ "-notmuch::moreinfo" "+pending")
+ '("P" "-pending" "-notmuch::needs-review" "-notmuch::moreinfo" "+notmuch::pushed")
+ '("r" "-notmuch::patch" "+notmuch::review")
+ '("s" "+notmuch::patch" "-notmuch::obsolete" "-notmuch::needs-review" "-notmuch::moreinfo" "+notmuch::stale")
+ '("t" "+notmuch::patch" "-notmuch::needs-review" "+notmuch::trivial")
+ '("w" "+notmuch::patch" "+notmuch::wip" "-notmuch::needs-review")))
+
+ (defun notmuch-show-apply-tag-macro (key)
+ (interactive "k")
+ (let ((macro (assoc key notmuch-show-tag-macro-alist)))
+ (apply 'notmuch-show-tag-message (cdr macro))))