From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 893E26DE13CC for ; Sat, 13 Jun 2015 01:08:21 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.36 X-Spam-Level: X-Spam-Status: No, score=0.36 tagged_above=-999 required=5 tests=[AWL=0.930, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Zr_ntRvlP2q for ; Sat, 13 Jun 2015 01:08:19 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by arlo.cworth.org (Postfix) with ESMTPS id 7DC296DE0948 for ; Sat, 13 Jun 2015 01:08:19 -0700 (PDT) Received: by wiwd19 with SMTP id d19so34376595wiw.0 for ; Sat, 13 Jun 2015 01:08:18 -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:in-reply-to:references; bh=tgqlQKTBy2YvwWWyEg35QHhem87c/FVNaTBV+k3/aes=; b=a/0/E9ZqIt0ulZsDgRCc5fOXn32YM+jdWtiCCOVxl2Usom7HV+sKD6uTIiowF8idcT M3peEKT2AKzkiaPzvFm3d1N7XKVMDKN0k5kKAHe7mZhmYdVSHAA65tSTxgyySFS3Oqxt 1yCAH4BR4FEU1LQBjbEOP/iBPxgUSEFY8BYSmZ62ymBBh80JtAh8K3CdmCcnf1bNAMC3 rHAQvtc/RG0k47k7ssgHMFJstSZmL9zmpH8uoRnCDBtflCHe/251q8XF68tryaV7TYXw Ij3/VyyOpA9QMd+0F4dI+7NT7Xtfx+7uwQ6BN3tW9vzskreeM5BH5mRQQS2nEMO9x+Wn xqtQ== X-Received: by 10.194.203.138 with SMTP id kq10mr32636800wjc.124.1434182897993; Sat, 13 Jun 2015 01:08:17 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by mx.google.com with ESMTPSA id gz3sm6837975wib.0.2015.06.13.01.08.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jun 2015 01:08:17 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v5 1/3] emacs: split notmuch-show-apply-state Date: Sat, 13 Jun 2015 09:08:08 +0100 Message-Id: <1434182890-8047-2-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434182890-8047-1-git-send-email-markwalters1009@gmail.com> References: <1434182890-8047-1-git-send-email-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Sat, 13 Jun 2015 08:08:21 -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 file changed, 11 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 2a53461..a978d3c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1281,6 +1281,16 @@ (defun notmuch-show-get-query () ")") notmuch-show-thread-id)) +(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. @@ -1298,13 +1308,7 @@ (defun notmuch-show-apply-state (state) 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. -- 2.1.4