[PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end

2012-01-25 Thread David Edmondson
Fine.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end

2012-01-24 Thread Jameson Graef Rollins
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 |   27 +++
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 0dc594b..8837402 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1358,14 +1358,19 @@ any effects from previous calls to
   (with-current-notmuch-show-message
(notmuch-mua-new-forward-message prompt-for-sender)))

-(defun notmuch-show-next-message ()
-  "Show the next message."
-  (interactive)
+(defun notmuch-show-next-message ( pop-at-end)
+  "Show the next message.
+
+If a prefix argument is given and this is the last message in the
+thread, navigate to the next thread in the parent search buffer."
+  (interactive "P")
   (if (notmuch-show-goto-message-next)
   (progn
(notmuch-show-mark-read)
(notmuch-show-message-adjust))
-(goto-char (point-max
+(if pop-at-end
+   (notmuch-show-next-thread)
+  (goto-char (point-max)

 (defun notmuch-show-previous-message ()
   "Show the previous message."
@@ -1374,9 +1379,13 @@ any effects from previous calls to
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))

-(defun notmuch-show-next-open-message ()
-  "Show the next message."
-  (interactive)
+(defun notmuch-show-next-open-message ( pop-at-end)
+  "Show the next open message.
+
+If a prefix argument is given and this is the last open message
+in the thread, navigate to the next thread in the parent search
+buffer."
+  (interactive "P")
   (let (r)
 (while (and (setq r (notmuch-show-goto-message-next))
(not (notmuch-show-message-visible-p
@@ -1384,7 +1393,9 @@ any effects from previous calls to
(progn
  (notmuch-show-mark-read)
  (notmuch-show-message-adjust))
-  (goto-char (point-max)
+  (if pop-at-end
+ (notmuch-show-next-thread)
+   (goto-char (point-max))

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