[PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end

Jameson Graef Rollins jrollins at finestructure.net
Mon Jan 23 00:34:23 PST 2012


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 |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index fcd2878..fe7ec6a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1373,17 +1373,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)
+  (interactive "P")
+  (let ((parent-buffer notmuch-show-parent-buffer)
+	(r))
     (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)
+	    (notmuch-search-next-message))
+	(goto-char (point-max))))))
 
 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.8.3



More information about the notmuch mailing list