emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive

This patch breaks out much of the functionality of
notmuch-show-advance-and-archive into a new function:
notmuch-show-advance.  This new function does all the advancing
through a show buffer that notmuch-show-advance-and-archive did,
without all the invasive thread archiving.  The return value of
notmuch-show-advance is nil if the bottom of the thread is not
reached, and t if it is.

notmuch-show-advance-and-archive is modified to just call
notmuch-show-advance, and then call notmuch-show-archive-thread if the
return value is true.  In this way the previous functionality of
notmuch-show-advance-and-archive is preserved.

This provides a way for people to rebind the space bar to a more sane
function if they don't like the default behavior.
This commit is contained in:
Jameson Graef Rollins 2011-11-13 13:16:48 -08:00 committed by David Bremner
parent dbceb50f47
commit 53629b5506

View file

@ -1135,26 +1135,18 @@ All currently available key bindings:
;; Commands typically bound to keys.
(defun notmuch-show-advance-and-archive ()
"Advance through thread and archive.
This command is intended to be one of the simplest ways to
process a thread of email. It does the following:
(defun notmuch-show-advance ()
"Advance through thread.
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), advance to the next open 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). Also kill
this buffer, and display the next thread from the search from
which this thread was originally shown."
current window), advance to the next open message."
(interactive)
(let* ((end-of-this-message (notmuch-show-message-bottom))
(visible-end-of-this-message (1- end-of-this-message)))
(visible-end-of-this-message (1- end-of-this-message))
(ret nil))
(while (invisible-p visible-end-of-this-message)
(setq visible-end-of-this-message
(previous-single-char-property-change visible-end-of-this-message
@ -1173,8 +1165,24 @@ which this thread was originally shown."
(notmuch-show-next-open-message))
(t
;; This is the last message - archive the thread.
(notmuch-show-archive-thread)))))
;; This is the last message - change the return value
(setq ret t)))
ret))
(defun notmuch-show-advance-and-archive ()
"Advance through thread and archive.
This command is intended to be one of the simplest ways to
process a thread of email. It works exactly like
notmuch-show-advance, in that it scrolls through messages in a
show buffer, except that when it gets to the end of the buffer it
archives the entire current thread, (remove the \"inbox\" tag
from each message), kills the buffer, and displays the next
thread from the search from which this thread was originally
shown."
(interactive)
(if (notmuch-show-advance)
(notmuch-show-archive-thread)))
(defun notmuch-show-rewind ()
"Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).