1 Return-Path: <dme@dme.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 1C5D24196EC
\r
6 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 08:31:23 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id rVsTs3Ko+pFR for <notmuch@notmuchmail.org>;
\r
16 Mon, 30 Jan 2012 08:31:21 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 D2AA241ED91 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 08:31:12 -0800
\r
22 Received: by mail-ww0-f45.google.com with SMTP id dt12so4198685wgb.2
\r
23 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 08:31:12 -0800 (PST)
\r
24 Received: by 10.180.101.101 with SMTP id ff5mr29335143wib.14.1327941072534;
\r
25 Mon, 30 Jan 2012 08:31:12 -0800 (PST)
\r
26 Received: from hotblack-desiato.hh.sledj.net
\r
27 (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])
\r
28 by mx.google.com with ESMTPS id t15sm31314359wiv.6.2012.01.30.08.31.10
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Mon, 30 Jan 2012 08:31:11 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 19441A0141; Mon, 30 Jan 2012 16:31:06 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH 5/5] emacs: Retain the state of the buffer during
\r
36 `notmuch-show-refresh-view'.
\r
37 Date: Mon, 30 Jan 2012 16:31:04 +0000
\r
38 Message-Id: <1327941064-20027-6-git-send-email-dme@dme.org>
\r
39 X-Mailer: git-send-email 1.7.8.3
\r
40 In-Reply-To: <1327941064-20027-1-git-send-email-dme@dme.org>
\r
41 References: <1327486729-18052-1-git-send-email-dme@dme.org>
\r
42 <1327941064-20027-1-git-send-email-dme@dme.org>
\r
43 X-BeenThere: notmuch@notmuchmail.org
\r
44 X-Mailman-Version: 2.1.13
\r
46 List-Id: "Use and development of the notmuch mail system."
\r
47 <notmuch.notmuchmail.org>
\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
51 List-Post: <mailto:notmuch@notmuchmail.org>
\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
55 X-List-Received-Date: Mon, 30 Jan 2012 16:31:23 -0000
\r
57 Record the state of the buffer during `notmuch-show-refresh-view'.
\r
59 In this context, "state" is defined as:
\r
60 - the open/closed state of each message,
\r
61 - the current message.
\r
63 emacs/notmuch-show.el | 41 +++++++++++++++++++++++++++++++++++++----
\r
64 1 files changed, 37 insertions(+), 4 deletions(-)
\r
66 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
67 index 8b07adf..a77cd52 100644
\r
68 --- a/emacs/notmuch-show.el
\r
69 +++ b/emacs/notmuch-show.el
\r
70 @@ -1053,15 +1053,48 @@ function is used."
\r
72 (notmuch-show-mark-read)))
\r
74 +(defun notmuch-show-capture-state ()
\r
75 + "Capture the state of the current buffer.
\r
78 + - the list of open messages,
\r
79 + - the current message."
\r
80 + (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
\r
82 +(defun notmuch-show-apply-state (state)
\r
83 + "Apply STATE to the current buffer.
\r
86 + - opening the messages previously opened,
\r
87 + - closing all other messages,
\r
88 + - moving to the correct current message."
\r
89 + (let ((current (car state))
\r
90 + (open (cadr state)))
\r
92 + ;; Open those that were open.
\r
93 + (goto-char (point-min))
\r
94 + (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
\r
95 + (member (notmuch-show-get-message-id) open))
\r
96 + until (not (notmuch-show-goto-message-next)))
\r
98 + ;; Go to the previously open message.
\r
99 + (goto-char (point-min))
\r
100 + (unless (loop if (string= current (notmuch-show-get-message-id))
\r
102 + until (not (notmuch-show-goto-message-next)))
\r
103 + (message "Previously current message not found."))))
\r
105 (defun notmuch-show-refresh-view ()
\r
106 "Refresh the current view.
\r
108 Refreshes the current view, observing changes in cryptographic preferences."
\r
110 - (let ((inhibit-read-only t))
\r
112 - (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
\r
113 - notmuch-show-query-context))
\r
114 + (let ((inhibit-read-only t)
\r
115 + (state (notmuch-show-capture-state)))
\r
117 + (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
\r
118 + notmuch-show-query-context)
\r
119 + (notmuch-show-apply-state state)))
\r
121 (defvar notmuch-show-stash-map
\r
122 (let ((map (make-sparse-keymap)))
\r