+(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:
+
+If the current message in the thread is not yet fully visible,
+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.
+
+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)
+ (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)))))
+