aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.el
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-11-04 09:21:09 -0800
committerGravatar Carl Worth <cworth@cworth.org>2009-11-04 09:21:09 -0800
commit278ae86f64a58bd9265441d858916f6f0a22ed18 (patch)
tree8b867a0133f7ff963721f46c93c7bebc262f062e /notmuch.el
parentaab9b5cf471e20531f09f9619c542f7cad7fbe62 (diff)
notmuch.el: Make the magic spacebar archive a thread in the end.
Next all it needs to do is kill the buffer and show the next thread.
Diffstat (limited to 'notmuch.el')
-rw-r--r--notmuch.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/notmuch.el b/notmuch.el
index 062beafc..07f54779 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -39,7 +39,7 @@
(define-key map "x" 'kill-this-buffer)
(define-key map "+" 'notmuch-show-add-tag)
(define-key map "-" 'notmuch-show-remove-tag)
- (define-key map " " 'notmuch-show-advance-marking-read)
+ (define-key map " " 'notmuch-show-advance-marking-read-and-archiving)
map)
"Keymap for \"notmuch show\" buffers.")
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -182,8 +182,8 @@ simply move to the beginning of the current message."
(notmuch-show-remove-tag "unread"))
(notmuch-show-next-message))
-(defun notmuch-show-advance-marking-read ()
- "Advance through buffer, marking messages as read.
+(defun notmuch-show-advance-marking-read-and-archiving ()
+ "Advance through buffer, marking read and archiving.
This command is intended to be one of the simplest ways to
process a thread of email. It does the following:
@@ -193,11 +193,20 @@ scroll by a near screenful to read more of the message.
Otherwise, (the end of the current message is already within the
current window), remove the \"unread\" tag from the current
-message and advance to the next message."
+message and advance to the next message.
+
+Finally, if there is no further message to advance to, and this
+last message is already read, then archive the entire current
+thread, (remove the \"inbox\" tag from each message)."
(interactive)
- (if (< (notmuch-show-find-next-message) (window-end))
- (notmuch-show-mark-read-then-next-message)
- (scroll-up nil)))
+ (let ((next (notmuch-show-find-next-message))
+ (unread (member "unread" (notmuch-show-get-tags))))
+ (if (and (not unread)
+ (equal next (point)))
+ (notmuch-show-archive-thread)
+ (if (< (notmuch-show-find-next-message) (window-end))
+ (notmuch-show-mark-read-then-next-message)
+ (scroll-up nil)))))
(defun notmuch-show-markup-citations-region (beg end)
(goto-char beg)