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 D69E76DE1370 for ; Sun, 9 Oct 2016 13:34:07 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.021 X-Spam-Level: X-Spam-Status: No, score=0.021 tagged_above=-999 required=5 tests=[AWL=-0.109, 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_NONE=-0.0001, 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 YWvHnD_L_7Tw for ; Sun, 9 Oct 2016 13:34:06 -0700 (PDT) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by arlo.cworth.org (Postfix) with ESMTPS id 85EB06DE1390 for ; Sun, 9 Oct 2016 13:33:58 -0700 (PDT) Received: by mail-lf0-f67.google.com with SMTP id x79so3329548lff.2 for ; Sun, 09 Oct 2016 13:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=G1G+wEq0WbKuPt26VrcX9yp4JF9Nve2ct/FNCej/XKg=; b=t/PBiwJoi6LJCI6pm4Fvi2cEyvJvKoIzCD4mNvuHZroy29Xp4S3/Igqs2c84cdjxzt uSWp1k31hW5HK0mBurU+G/1VPxz/sDqMb91Px1OmhON+UNo3OxyYs+8dLivAEYrW7OF5 UUoTPY3WvJzk2PAfgXmoGX0gX2oJOA/ATAwjxSK6l3QzcxZxAt3rQlF5AEZBvY/uqXy+ 9P2YWAwNK9bwvo6x/2ONLa3M+laqexQLYEXA7YsUz8arbgdx4iJURD1m9GhBO28CGcIF b0npoAfwgQ7LLK8KmPQwgSlVSxEW+3imkN1pBSD6zAKU309X3zd+eVt/wKIiJfhHEMkq /Gfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=G1G+wEq0WbKuPt26VrcX9yp4JF9Nve2ct/FNCej/XKg=; b=A3graOXUT9ehgNGUJozz0AwD8zULyjphgqpq3Ffv1czFTcMRX3FwNdcdhnUCgbS/km 43uC39cDTqLvmPtknUJWOBMIPllBKz8kcxGw5BnlgpyE9Y0hUqnXTwAOPFdw7ht6HEb+ JnGmyTV+rjOMy8KrXcosDuOHwmO3PFLP7EDhZ3AUEKCf0++mRkAx8Oh98cAaqi59Vn1O ST+EzAwQRHiJDRM+mvs1hSIz2F6g05LtDPxFj6maUzuy7zRjk0MNzGJs6Ip9nYQPL2Vl WWDmQSq+Y+X+ZYp8yEx/B/kyJo2tzFfwj7R+tDWwzXI6Y7kSKd0osLvevllZg+oIMwFM NjKQ== X-Gm-Message-State: AA6/9RlMwSocoS7FawacuP92zSIymSeaBs4XMwcu0NU2g/U2oCjlLnAuyIWZUW9Pjaq0XA== X-Received: by 10.194.51.37 with SMTP id h5mr24921157wjo.171.1476045235743; Sun, 09 Oct 2016 13:33:55 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id e2sm19098084wjw.14.2016.10.09.13.33.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Oct 2016 13:33:55 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org, adi@adirat.com Subject: [PATCH v5 6/7] emacs: notmuch-show: refresh all windows displaying buffer Date: Sun, 9 Oct 2016 21:33:42 +0100 Message-Id: <1476045223-5238-7-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1476045223-5238-1-git-send-email-markwalters1009@gmail.com> References: <1476045223-5238-1-git-send-email-markwalters1009@gmail.com> 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: Sun, 09 Oct 2016 20:34:08 -0000 From: Ioan-Adrian Ratiu 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 message based on the (point) location. We store the state of all displayed windows when refreshing a notmuch-show buffer and re-apply the current shown message (point) for all windows. Implementation note: Each window has it's own (point) value, besides the buffer's (point) value. Sometimes these values are identical like in the case where a single window displays a buffer. When multiple windows display a buffer, (point) returns each window's specific value. What we are storing in this changeset is the window values not the buffer point values. The buffer's point is returned only if no window is displaying the buffer, a case we do not care about here. 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.1.4