This will allow for keybindings that achieve a smoother message
processing flow by reducing the number of key presses needed for most
common operations.
---
 emacs/notmuch-show.el |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8bb052e..e7bb958 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1264,17 +1264,23 @@ any effects from previous calls to
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))

-(defun notmuch-show-next-open-message ()
+(defun notmuch-show-next-open-message (&optional pop-at-end)
   "Show the next message."
   (interactive)
-  (let (r)
+  (let ((r)
+       (parent-buffer notmuch-show-parent-buffer))
     (while (and (setq r (notmuch-show-goto-message-next))
                (not (notmuch-show-message-visible-p))))
     (if r
        (progn
          (notmuch-show-mark-read)
          (notmuch-show-message-adjust))
-      (goto-char (point-max)))))
+      (if (and parent-buffer pop-at-end)
+         (progn
+           (kill-this-buffer)
+           (switch-to-buffer parent-buffer)
+           (forward-line 1))
+       (goto-char (point-max))))))

 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.7.3

Reply via email to