[PATCH 1/4] emacs: Add functions and bindings to archive and mark thread as read
Jani Nikula
jani at nikula.org
Tue Jun 28 00:31:29 PDT 2011
Add "mark as read" versions of the archive thread functions to archive and
and mark each message in thread as read by removing the "inbox" and
"unread" tags from the messages. Also add default keybindings A and X for
them: shifted a and x also mark as read.
---
emacs/notmuch-show.el | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6685717..dbed0a4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -886,7 +886,9 @@ function is used. "
(define-key map "-" 'notmuch-show-remove-tag)
(define-key map "+" 'notmuch-show-add-tag)
(define-key map "x" 'notmuch-show-archive-thread-then-exit)
+ (define-key map "X" 'notmuch-show-archive-and-read-thread-then-exit)
(define-key map "a" 'notmuch-show-archive-thread)
+ (define-key map "A" 'notmuch-show-archive-and-read-thread)
(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)
@@ -1349,10 +1351,12 @@ argument, hide all of the messages."
(interactive)
(backward-button 1))
-(defun notmuch-show-archive-thread-internal (show-next)
+(defun notmuch-show-archive-thread-internal (show-next mark-read)
;; Remove the tag from the current set of messages.
(goto-char (point-min))
(loop do (notmuch-show-remove-tag "inbox")
+ (if mark-read
+ (notmuch-show-remove-tag "unread"))
until (not (notmuch-show-goto-message-next)))
;; Move to the next item in the search results, if any.
(let ((parent-buffer notmuch-show-parent-buffer))
@@ -1376,12 +1380,27 @@ being delivered to the same thread. It does not archive the
entire thread, but only the messages shown in the current
buffer."
(interactive)
- (notmuch-show-archive-thread-internal t))
+ (notmuch-show-archive-thread-internal t nil))
+
+(defun notmuch-show-archive-and-read-thread ()
+ "Archive and read each message in thread, then show next thread from search.
+
+Archive and mark as read each message currently shown by removing
+the \"inbox\" and \"unread\" tags from each. Then kill this
+buffer and show the next thread from the search from which this
+thread was originally shown."
+ (interactive)
+ (notmuch-show-archive-thread-internal t t))
(defun notmuch-show-archive-thread-then-exit ()
"Archive each message in thread, then exit back to search results."
(interactive)
- (notmuch-show-archive-thread-internal nil))
+ (notmuch-show-archive-thread-internal nil nil))
+
+(defun notmuch-show-archive-and-read-thread-then-exit ()
+ "Archive and read each message in thread, then exit back to search results."
+ (interactive)
+ (notmuch-show-archive-thread-internal nil t))
(defun notmuch-show-stash-cc ()
"Copy CC field of current message to kill-ring."
--
1.7.1
More information about the notmuch
mailing list