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 35E8F414BA1
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 06:39:35 -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 x9KdZt-E7gGl for <notmuch@notmuchmail.org>;
\r
16 Wed, 1 Feb 2012 06:39:34 -0800 (PST)
\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
18 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 62715418C33
\r
21 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 06:39:34 -0800 (PST)
\r
22 Received: by werb10 with SMTP id b10so1130087wer.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 01 Feb 2012 06:39:33 -0800 (PST)
\r
24 Received: by 10.216.134.157 with SMTP id s29mr10593430wei.1.1328107173158;
\r
25 Wed, 01 Feb 2012 06:39:33 -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 n5sm74268096wiw.7.2012.02.01.06.39.30
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Wed, 01 Feb 2012 06:39:32 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 3E99BA0601; Wed, 1 Feb 2012 14:39:26 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH v5 5/6] emacs: Optionally retain the state of the buffer
\r
36 during `notmuch-show-refresh-view'.
\r
37 Date: Wed, 1 Feb 2012 14:39:23 +0000
\r
38 Message-Id: <1328107164-10520-6-git-send-email-dme@dme.org>
\r
39 X-Mailer: git-send-email 1.7.8.3
\r
40 In-Reply-To: <1328107164-10520-1-git-send-email-dme@dme.org>
\r
41 References: <1327486729-18052-1-git-send-email-dme@dme.org>
\r
42 <1328107164-10520-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: Wed, 01 Feb 2012 14:39:35 -0000
\r
57 With an argument, record and reply the state of the buffer during
\r
58 `notmuch-show-refresh-view'.
\r
60 In this context, "state" is defined as:
\r
61 - the open/closed state of each message,
\r
62 - the current message.
\r
64 Traditional use of refresh with the = key does not retain the
\r
65 state. The recently introduced toggle commands ($, !, < and >) do
\r
68 emacs/notmuch-show.el | 56 ++++++++++++++++++++++++++++++++++++++++++-------
\r
69 1 files changed, 48 insertions(+), 8 deletions(-)
\r
71 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
72 index 8d318c9..1b31166 100644
\r
73 --- a/emacs/notmuch-show.el
\r
74 +++ b/emacs/notmuch-show.el
\r
75 @@ -938,7 +938,7 @@ current buffer, if possible."
\r
76 (message (if notmuch-show-process-crypto
\r
77 "Processing cryptographic MIME parts."
\r
78 "Not processing cryptographic MIME parts."))
\r
79 - (notmuch-show-refresh-view))
\r
80 + (notmuch-show-refresh-view t))
\r
82 (defun notmuch-show-toggle-elide-non-matching ()
\r
83 "Toggle the display of non-matching messages."
\r
84 @@ -947,7 +947,7 @@ current buffer, if possible."
\r
85 (message (if notmuch-show-elide-non-matching-messages
\r
86 "Showing matching messages only."
\r
87 "Showing all messages."))
\r
88 - (notmuch-show-refresh-view))
\r
89 + (notmuch-show-refresh-view t))
\r
91 (defun notmuch-show-toggle-thread-indentation ()
\r
92 "Toggle the indentation of threads."
\r
93 @@ -956,7 +956,7 @@ current buffer, if possible."
\r
94 (message (if notmuch-show-indent-content
\r
95 "Content is indented."
\r
96 "Content is not indented."))
\r
97 - (notmuch-show-refresh-view))
\r
98 + (notmuch-show-refresh-view t))
\r
100 (defun notmuch-show-insert-tree (tree depth)
\r
101 "Insert the message tree TREE at depth DEPTH in the current thread."
\r
102 @@ -1060,14 +1060,54 @@ function is used."
\r
104 (notmuch-show-mark-read)))
\r
106 -(defun notmuch-show-refresh-view ()
\r
107 +(defun notmuch-show-capture-state ()
\r
108 + "Capture the state of the current buffer.
\r
111 + - the list of open messages,
\r
112 + - the current message."
\r
113 + (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
\r
115 +(defun notmuch-show-apply-state (state)
\r
116 + "Apply STATE to the current buffer.
\r
119 + - opening the messages previously opened,
\r
120 + - closing all other messages,
\r
121 + - moving to the correct current message."
\r
122 + (let ((current (car state))
\r
123 + (open (cadr state)))
\r
125 + ;; Open those that were open.
\r
126 + (goto-char (point-min))
\r
127 + (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
\r
128 + (member (notmuch-show-get-message-id) open))
\r
129 + until (not (notmuch-show-goto-message-next)))
\r
131 + ;; Go to the previously open message.
\r
132 + (goto-char (point-min))
\r
133 + (unless (loop if (string= current (notmuch-show-get-message-id))
\r
135 + until (not (notmuch-show-goto-message-next)))
\r
136 + (goto-char (point-min))
\r
137 + (message "Previously current message not found."))
\r
138 + (notmuch-show-message-adjust)))
\r
140 +(defun notmuch-show-refresh-view (&optional retain-state)
\r
141 "Refresh the current view.
\r
143 -Refreshes the current view, observing changes in cryptographic preferences."
\r
144 +Refreshes the current view, observing changes in display
\r
145 +preferences. If RETAIN-STATE is non-nil then the state of the
\r
146 +buffer is stored and re-applied after the refresh."
\r
148 - (let ((inhibit-read-only t))
\r
150 - (notmuch-show-worker))
\r
151 + (let ((inhibit-read-only t)
\r
154 + (setq state (notmuch-show-capture-state)))
\r
156 + (notmuch-show-worker)
\r
158 + (notmuch-show-apply-state state))))
\r
160 (defvar notmuch-show-stash-map
\r
161 (let ((map (make-sparse-keymap)))
\r