Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 45FFD431FC0 for ; Sat, 28 Apr 2012 17:06:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LXxyojUmPJaq for ; Sat, 28 Apr 2012 17:06:35 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A1B92431FAE for ; Sat, 28 Apr 2012 17:06:35 -0700 (PDT) Received: by werm13 with SMTP id m13so1420031wer.26 for ; Sat, 28 Apr 2012 17:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=GYkBzW2NW7GNllB69VmV8L43QIIgGBt7aGIuXAkVU50=; b=RwzRHEovdJRwDo3USJhqYnDHdb6E2ordwH6vsvhSXGVQ/0ZGs4WkkSsz9s3z4vIaxh 0rrl9HezLxeClMpUnZB8+VXHWfVq+iavv8ZXT7Bqmx5O63D5+G9vPnw5vWPeh14O96Ee +vhteQX8l8rKshQ8zvcRzn5dx2lT58a9N61At2twUFcXRuI4SQTxRAaBLLYKGIl0WOHV 4Q7wocyLoDDmn0BfCdN0N8k4YHoJvdD5B0bnLXlEhAVMpOTM7qnAEb3R7ybU5TbpUQvr GbS65NsAAXpFLjooGr3mmZcJEdKlUGt73IQxG7JvxH69mqlrolyXPjqpiBGsZ1JVJzEO wRFg== Received: by 10.216.136.100 with SMTP id v78mr5521608wei.88.1335657994264; Sat, 28 Apr 2012 17:06:34 -0700 (PDT) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id ca3sm16566793wib.6.2012.04.28.17.06.33 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 28 Apr 2012 17:06:33 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [Patch v4 1/3] emacs: split notmuch-show-apply-state Date: Sun, 29 Apr 2012 01:06:44 +0100 Message-Id: <1335658006-20161-2-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com> References: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Apr 2012 00:06:36 -0000 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