[PATCH 1/2] add notmuch keybinding 'd'
Antoine Beaupré
anarcat at koumbit.org
Sat Jul 16 11:39:59 PDT 2011
It adds a tag 'deleted' and removes the tags 'inbox' and 'unread'. It
works in show as well as in search mode
Based on previous work by: Sebastian Spaeth <Sebastian at SSpaeth.de>
Signed-off-by: Antoine Beaupré <anarcat at koumbit.org>
---
emacs/notmuch-show.el | 8 ++++++++
emacs/notmuch.el | 11 +++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f96743b..c83b992 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -875,6 +875,7 @@ function is used. "
(define-key map "+" 'notmuch-show-add-tag)
(define-key map "x" 'notmuch-show-archive-thread-then-exit)
(define-key map "a" 'notmuch-show-archive-thread)
+ (define-key map "d" 'notmuch-show-delete)
(define-key map "N" 'notmuch-show-next-message)
(define-key map "P" 'notmuch-show-previous-message)
(define-key map "n" 'notmuch-show-next-open-message)
@@ -1297,6 +1298,13 @@ the result."
(mapcar (lambda (s) (concat "-" s)) toremove))
(notmuch-show-set-tags new-tags))))
+(defun notmuch-show-delete ()
+ "Delete current mail (tag +deleted -unread -inbox)."
+ (interactive)
+ (notmuch-show-add-tag "deleted")
+ (notmuch-show-remove-tag "unread")
+ (notmuch-show-remove-tag "inbox"))
+
(defun notmuch-show-toggle-headers ()
"Toggle the visibility of the current message headers."
(interactive)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f11ec24..f6fb07b 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -215,6 +215,7 @@ For a mouse binding, return nil."
(define-key map [mouse-1] 'notmuch-search-show-thread)
(define-key map "*" 'notmuch-search-operate-all)
(define-key map "a" 'notmuch-search-archive-thread)
+ (define-key map "d" 'notmuch-search-delete-thread-or-region)
(define-key map "-" 'notmuch-search-remove-tag)
(define-key map "+" 'notmuch-search-add-tag)
(define-key map (kbd "RET") 'notmuch-search-show-thread)
@@ -611,6 +612,16 @@ This function advances the next thread when finished."
"Data that has not yet been processed.")
(make-variable-buffer-local 'notmuch-search-process-filter-data)
+(defun notmuch-search-delete-thread-or-region ()
+ "Delete the currently selected thread (tag \"+deleted -inbox -unread\").
+
+This function advances the next thread when finished."
+ (interactive)
+ (notmuch-search-add-tag "deleted")
+ (notmuch-search-remove-tag "inbox")
+ (notmuch-search-remove-tag "unread")
+ (forward-line))
+
(defun notmuch-search-process-sentinel (proc msg)
"Add a message to let user know when \"notmuch search\" exits"
(let ((buffer (process-buffer proc))
--
1.7.5.4
More information about the notmuch
mailing list