summaryrefslogtreecommitdiff
path: root/notmuch.el
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-11-04 08:48:57 -0800
committerCarl Worth <cworth@cworth.org>2009-11-04 08:50:44 -0800
commit446459a5eab3d5a085950a25476079d5188c7528 (patch)
treefbf6cb226083b96c9185be8e7525eea5000ee8bd /notmuch.el
parent253c11b675d1be745be806f345632020e903309c (diff)
notmuch.el: Redefine behavior of notmuch-show-previous-message
Now, if the user has manually moved point to somewhere within a message, executing the previous-message command onece will rewind point only to the beginning of the current message. Previously this would go back to the previous message, (which the user can now do easily and naturally by simply executing the command one more time).
Diffstat (limited to 'notmuch.el')
-rw-r--r--notmuch.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/notmuch.el b/notmuch.el
index 667fd6f..5f394cd 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -147,15 +147,19 @@ last message in the buffer."
(defun notmuch-show-previous-message ()
"Backup to the beginning of the previous message in the buffer.
-Moves to the beginning of the current message if already on the
-first message in the buffer."
+If within a message rather than at the beginning of it, then
+simply move to the beginning of the current message."
(interactive)
- (notmuch-show-move-to-current-message-summary-line)
- ; Go backward twice to skip the current message's marker
- (re-search-backward notmuch-show-message-begin-regexp nil t)
- (re-search-backward notmuch-show-message-begin-regexp nil t)
- (notmuch-show-move-to-current-message-summary-line)
- (recenter 0))
+ (let ((start (point)))
+ (notmuch-show-move-to-current-message-summary-line)
+ (if (not (< (point) start))
+ ; Go backward twice to skip the current message's marker
+ (progn
+ (re-search-backward notmuch-show-message-begin-regexp nil t)
+ (re-search-backward notmuch-show-message-begin-regexp nil t)
+ (notmuch-show-move-to-current-message-summary-line)
+ ))
+ (recenter 0)))
(defun notmuch-show-mark-read-then-next-message ()
"Remove uread tag from current message, then advance to next message."