--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 893E26DE13CC\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 01:08:21 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.36\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.36 tagged_above=-999 required=5 tests=[AWL=0.930,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 1Zr_ntRvlP2q for <notmuch@notmuchmail.org>;\r
+ Sat, 13 Jun 2015 01:08:19 -0700 (PDT)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+ [209.85.212.181])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 7DC296DE0948\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 01:08:19 -0700 (PDT)\r
+Received: by wiwd19 with SMTP id d19so34376595wiw.0\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 01:08:18 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=tgqlQKTBy2YvwWWyEg35QHhem87c/FVNaTBV+k3/aes=;\r
+ b=a/0/E9ZqIt0ulZsDgRCc5fOXn32YM+jdWtiCCOVxl2Usom7HV+sKD6uTIiowF8idcT\r
+ M3peEKT2AKzkiaPzvFm3d1N7XKVMDKN0k5kKAHe7mZhmYdVSHAA65tSTxgyySFS3Oqxt\r
+ 1yCAH4BR4FEU1LQBjbEOP/iBPxgUSEFY8BYSmZ62ymBBh80JtAh8K3CdmCcnf1bNAMC3\r
+ rHAQvtc/RG0k47k7ssgHMFJstSZmL9zmpH8uoRnCDBtflCHe/251q8XF68tryaV7TYXw\r
+ Ij3/VyyOpA9QMd+0F4dI+7NT7Xtfx+7uwQ6BN3tW9vzskreeM5BH5mRQQS2nEMO9x+Wn\r
+ xqtQ==\r
+X-Received: by 10.194.203.138 with SMTP id\r
+ kq10mr32636800wjc.124.1434182897993; Sat, 13 Jun 2015 01:08:17 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by mx.google.com with ESMTPSA id gz3sm6837975wib.0.2015.06.13.01.08.16\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 13 Jun 2015 01:08:17 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v5 1/3] emacs: split notmuch-show-apply-state\r
+Date: Sat, 13 Jun 2015 09:08:08 +0100\r
+Message-Id: <1434182890-8047-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1434182890-8047-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1434182890-8047-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 13 Jun 2015 08:08:21 -0000\r
+\r
+Separate out a notmuch-show-goto-msg-id sub-function from\r
+notmuch-show-apply-state. There should be no functional change but the\r
+next patch will call the new function.\r
+---\r
+ emacs/notmuch-show.el | 18 +++++++++++-------\r
+ 1 file changed, 11 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 2a53461..a978d3c 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1281,6 +1281,16 @@ (defun notmuch-show-get-query ()\r
+ ")")\r
+ notmuch-show-thread-id))\r
+ \r
++(defun notmuch-show-goto-message (msg-id)\r
++ "Go to message with msg-id."\r
++ (goto-char (point-min))\r
++ (unless (loop if (string= msg-id (notmuch-show-get-message-id))\r
++ return t\r
++ until (not (notmuch-show-goto-message-next)))\r
++ (goto-char (point-min))\r
++ (message "Message-id not found."))\r
++ (notmuch-show-message-adjust))\r
++\r
+ (defun notmuch-show-apply-state (state)\r
+ "Apply STATE to the current buffer.\r
+ \r
+@@ -1298,13 +1308,7 @@ (defun notmuch-show-apply-state (state)\r
+ until (not (notmuch-show-goto-message-next)))\r
+ \r
+ ;; Go to the previously open message.\r
+- (goto-char (point-min))\r
+- (unless (loop if (string= current (notmuch-show-get-message-id))\r
+- return t\r
+- until (not (notmuch-show-goto-message-next)))\r
+- (goto-char (point-min))\r
+- (message "Previously current message not found."))\r
+- (notmuch-show-message-adjust)))\r
++ (notmuch-show-goto-message current)))\r
+ \r
+ (defun notmuch-show-refresh-view (&optional reset-state)\r
+ "Refresh the current view.\r
+-- \r
+2.1.4\r
+\r