[Patch v4 1/3] emacs: split notmuch-show-apply-state

Mark Walters markwalters1009 at gmail.com
Sat Apr 28 17:06:44 PDT 2012


Separate out a notmuch-show-goto-msg-id sub-function from
notmuch-show-apply-state. There should be no functional change but the
next patch will call the new function.
---
 emacs/notmuch-show.el |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 30b26d1..3bd9a64 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1085,6 +1085,16 @@ This includes:
  - the current message."
   (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
 
+(defun notmuch-show-goto-message (msg-id)
+  "Go to message with msg-id."
+  (goto-char (point-min))
+  (unless (loop if (string= msg-id (notmuch-show-get-message-id))
+		return t
+		until (not (notmuch-show-goto-message-next)))
+    (goto-char (point-min))
+    (message "Message-id not found."))
+  (notmuch-show-message-adjust))
+
 (defun notmuch-show-apply-state (state)
   "Apply STATE to the current buffer.
 
@@ -1102,13 +1112,7 @@ This includes:
 	  until (not (notmuch-show-goto-message-next)))
 
     ;; Go to the previously open message.
-    (goto-char (point-min))
-    (unless (loop if (string= current (notmuch-show-get-message-id))
-		  return t
-		  until (not (notmuch-show-goto-message-next)))
-      (goto-char (point-min))
-      (message "Previously current message not found."))
-    (notmuch-show-message-adjust)))
+    (notmuch-show-goto-message current)))
 
 (defun notmuch-show-refresh-view (&optional reset-state)
   "Refresh the current view.
-- 
1.7.9.1



More information about the notmuch mailing list