--- /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 olra.theworths.org (Postfix) with ESMTP id 45FFD431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 17:06:36 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id LXxyojUmPJaq for <notmuch@notmuchmail.org>;\r
+ Sat, 28 Apr 2012 17:06:35 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+ [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id A1B92431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 17:06:35 -0700 (PDT)\r
+Received: by werm13 with SMTP id m13so1420031wer.26\r
+ for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 17:06:34 -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:x-mailer:in-reply-to:references;\r
+ bh=GYkBzW2NW7GNllB69VmV8L43QIIgGBt7aGIuXAkVU50=;\r
+ b=RwzRHEovdJRwDo3USJhqYnDHdb6E2ordwH6vsvhSXGVQ/0ZGs4WkkSsz9s3z4vIaxh\r
+ 0rrl9HezLxeClMpUnZB8+VXHWfVq+iavv8ZXT7Bqmx5O63D5+G9vPnw5vWPeh14O96Ee\r
+ +vhteQX8l8rKshQ8zvcRzn5dx2lT58a9N61At2twUFcXRuI4SQTxRAaBLLYKGIl0WOHV\r
+ 4Q7wocyLoDDmn0BfCdN0N8k4YHoJvdD5B0bnLXlEhAVMpOTM7qnAEb3R7ybU5TbpUQvr\r
+ GbS65NsAAXpFLjooGr3mmZcJEdKlUGt73IQxG7JvxH69mqlrolyXPjqpiBGsZ1JVJzEO\r
+ wRFg==\r
+Received: by 10.216.136.100 with SMTP id v78mr5521608wei.88.1335657994264;\r
+ Sat, 28 Apr 2012 17:06:34 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223]) by mx.google.com with ESMTPS id\r
+ ca3sm16566793wib.6.2012.04.28.17.06.33 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sat, 28 Apr 2012 17:06:33 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v4 1/3] emacs: split notmuch-show-apply-state\r
+Date: Sun, 29 Apr 2012 01:06:44 +0100\r
+Message-Id: <1335658006-20161-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Sun, 29 Apr 2012 00:06:36 -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 files changed, 11 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 30b26d1..3bd9a64 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1085,6 +1085,16 @@ This includes:\r
+ - the current message."\r
+ (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))\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
+@@ -1102,13 +1112,7 @@ This includes:\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
+1.7.9.1\r
+\r