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 CAAAF6DE0C69 for ; Thu, 6 Oct 2016 07:30:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.546 X-Spam-Level: X-Spam-Status: No, score=0.546 tagged_above=-999 required=5 tests=[AWL=-0.425, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.972] 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 awqlhZX7pvEY for ; Thu, 6 Oct 2016 07:30:24 -0700 (PDT) Received: from ni.com (skprod3.natinst.com [130.164.80.24]) by arlo.cworth.org (Postfix) with ESMTPS id D9B3F6DE0C66 for ; Thu, 6 Oct 2016 07:30:23 -0700 (PDT) Received: from us-aus-mgwout1.amer.corp.natinst.com (nb-snip2-1338.natinst.com [130.164.19.135]) by us-aus-skprod3.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id u96Di0G0031254; Thu, 6 Oct 2016 08:44:00 -0500 Received: from adi-pc-linux.iotechamer.corp.natinst.com ([130.164.14.198]) by us-aus-mgwout1.amer.corp.natinst.com (Lotus Domino Release 8.5.3FP6 HF1218) with ESMTP id 2016100608440051-645261 ; Thu, 6 Oct 2016 08:44:00 -0500 From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v3 2/4] emacs: notmuch-show: refresh all windows showing a buffer Date: Thu, 6 Oct 2016 16:42:25 +0300 Message-Id: <20161006134227.17194-3-adi@adirat.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006134227.17194-1-adi@adirat.com> References: <20161006134227.17194-1-adi@adirat.com> X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 10/06/2016 08:44:00 AM, Serialize by Router on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 10/06/2016 08:44:00 AM, Serialize complete at 10/06/2016 08:44:00 AM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-06_06:, , signatures=0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Thu, 06 Oct 2016 14:30:27 -0000 This updates all windows displaying a notmuch-show buffer when the buffer refresh function is called. Each window displaying a notmuch-show buffer has its own currently displayed messaged based on the (point) location. Store the state of all displayed windows when refreshing a notmuch-show buffer and re-apply the current shown message for all windows. Signed-off-by: Ioan-Adrian Ratiu --- emacs/notmuch-show.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index f2487ab..ac7eb77 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1317,8 +1317,13 @@ If no messages match the query return NIL." This includes: - the list of open messages, - - the current message." - (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages))) + - the combination of current message id with/for each visible window." + (let* ((win-list (get-buffer-window-list (current-buffer) nil t)) + (win-id-combo (mapcar (lambda (win) + (with-selected-window win + (list win (notmuch-show-get-message-id)))) + win-list))) + (list win-id-combo (notmuch-show-get-message-ids-for-open-messages)))) (defun notmuch-show-get-query () "Return the current query in this show buffer" @@ -1345,8 +1350,8 @@ This includes: This includes: - opening the messages previously opened, - closing all other messages, - - moving to the correct current message." - (let ((current (car state)) + - moving to the correct current message in every displayed window." + (let ((win-msg-alist (car state)) (open (cadr state))) ;; Open those that were open. @@ -1355,8 +1360,10 @@ This includes: (member (notmuch-show-get-message-id) open)) until (not (notmuch-show-goto-message-next))) - ;; Go to the previously open message. - (notmuch-show-goto-message current))) + (dolist (win-msg-pair win-msg-alist) + (with-selected-window (car win-msg-pair) + ;; Go to the previously open message in this window + (notmuch-show-goto-message (cadr win-msg-pair)))))) (defun notmuch-show-refresh-view (&optional reset-state) "Refresh the current view. -- 2.10.0