1 Return-Path: <amdragon@mit.edu>
\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 9349A431FD6
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:09:53 -0700 (PDT)
\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 QsN4opE4px8Y for <notmuch@notmuchmail.org>;
\r
16 Fri, 31 May 2013 16:09:47 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 424E6431FBD
\r
20 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:09:47 -0700 (PDT)
\r
21 X-AuditID: 1209190e-b7f4f6d000005142-78-51a92db9d25a
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 98.3B.20802.9BD29A15; Fri, 31 May 2013 19:09:45 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r4VN9iDU001529;
\r
27 Fri, 31 May 2013 19:09:44 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4VN9gQb027710
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Fri, 31 May 2013 19:09:43 -0400
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1UiYS6-00059K-82; Fri, 31 May 2013 19:09:42 -0400
\r
37 From: Austin Clements <aclements@csail.mit.edu>
\r
38 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org,
\r
39 Adam Wolfe Gordon <awg+notmuch@xvx.ca>
\r
40 Subject: Re: [PATCH v3 4/5] emacs: show: modify the way hidden state is
\r
42 In-Reply-To: <1370024806-6616-5-git-send-email-markwalters1009@gmail.com>
\r
43 References: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>
\r
44 <1370024806-6616-5-git-send-email-markwalters1009@gmail.com>
\r
45 User-Agent: Notmuch/0.15.2+83~g8bee3c4 (http://notmuchmail.org) Emacs/23.4.1
\r
47 Date: Fri, 31 May 2013 19:09:42 -0400
\r
48 Message-ID: <871u8m3fwp.fsf@awakening.csail.mit.edu>
\r
50 Content-Type: text/plain; charset=us-ascii
\r
51 X-Brightmail-Tracker:
\r
52 H4sIAAAAAAAAA+NgFvrBIsWRmVeSWpSXmKPExsUixCmqrLtTd2WgwdKPOhZH9sxit1g9l8fi
\r
53 +s2ZzA7MHjtn3WX3eLbqFrNH04/FrAHMUVw2Kak5mWWpRfp2CVwZ63cvZSuYrFwx+clfpgbG
\r
54 +9JdjJwcEgImEi9mL2KCsMUkLtxbz9bFyMUhJLCPUeJw+0woZyOjxI8nz5khnNNMEpf6njBB
\r
55 OEsYJTp2XGQH6WcT0JdYsXYSK4gtIlAmsWX6LLC5zAI6Eid2b2MEsYUFAiUeTd8JVsMp4Cnx
\r
56 Z8J6qEGtjBKN67uYQRKiAgkSK++eAGtgEVCVuHr0IQuIzQt07Im325ghbEGJkzOfsEAs0JK4
\r
57 8e8l0wRGwVlIUrOQpBYwMq1ilE3JrdLNTczMKU5N1i1OTszLSy3SNdbLzSzRS00p3cQIDmBJ
\r
58 vh2MXw8qHWIU4GBU4uE1WLEiUIg1say4MvcQoyQHk5Iob736ykAhvqT8lMqMxOKM+KLSnNTi
\r
59 Q4wSHMxKIrz5c4DKeVMSK6tSi/JhUtIcLErivFdSbvoLCaQnlqRmp6YWpBbBZGU4OJQkeA/r
\r
60 AA0VLEpNT61Iy8wpQUgzcXCCDOcBGv4YpIa3uCAxtzgzHSJ/ilFRSpz3DkhCACSRUZoH1wtL
\r
61 MK8YxYFeEeZ9ClLFA0xOcN2vgAYzAQ1+Yr0cZHBJIkJKqoEx0mG1rpH3lS9vC+YEyF4T2PR6
\r
62 QeyrY0VznRhUhfm/dZ7/8uTa24v/enqSb/JXS1YmmGjHmgW5h6uG5K1cNreNsefVkebKvoDN
\r
63 Cn32/5yvWqeGfdigc9TETkB9jqr45a2WGbtPfFh2X133QPu3X1dmfJN5HpAjMks8ca1WGsOn
\r
64 qjXrg1oWXstXYinOSDTUYi4qTgQAQp1/aAsDAAA=
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Fri, 31 May 2013 23:09:53 -0000
\r
79 On Fri, 31 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
80 > Previously, whether a part was hidden or shown was recorded in the
\r
81 > invisibility/visibility of the part overlay. Since we are going to
\r
82 > have lazily rendered parts with no overlay store the hidden/shown
\r
83 > state in the part button itself.
\r
85 > Additionally, in preparation for the invisible part handling move the
\r
86 > actual hiding of the hidden parts to insert-bodypart from
\r
87 > create-part-overlays.
\r
89 > Finally, we will need to know whether a part-insertion has done
\r
90 > anything (it won't if the invisible part cannot be displayed by emacs)
\r
91 > so we slightly rejig the code order in
\r
92 > notmuch-show-toggle-part-invisibility to make it easier for the
\r
93 > function to set an appropriate return value.
\r
95 > emacs/notmuch-show.el | 23 +++++++++++++----------
\r
96 > 1 file changed, 13 insertions(+), 10 deletions(-)
\r
98 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
99 > index 66cc3a5..89199e8 100644
\r
100 > --- a/emacs/notmuch-show.el
\r
101 > +++ b/emacs/notmuch-show.el
\r
102 > @@ -495,6 +495,7 @@ message at DEPTH in the current thread."
\r
103 > (concat "[ " base-label " ]")
\r
104 > :base-label base-label
\r
105 > :type 'notmuch-show-part-button-type
\r
106 > + :notmuch-part-hidden nil
\r
107 > :notmuch-part nth
\r
108 > :notmuch-filename name
\r
109 > :notmuch-content-type content-type))
\r
110 > @@ -555,18 +556,20 @@ message at DEPTH in the current thread."
\r
111 > (let* ((button (or button (button-at (point))))
\r
112 > (overlay (button-get button 'overlay)))
\r
114 > - (let* ((show (overlay-get overlay 'invisible))
\r
115 > + (let* ((show (button-get button :notmuch-part-hidden))
\r
116 > (new-start (button-start button))
\r
117 > (button-label (button-get button :base-label))
\r
118 > (old-point (point))
\r
119 > (inhibit-read-only t))
\r
120 > - (overlay-put overlay 'invisible (not show))
\r
121 > + ;; Toggle the button itself.
\r
122 > + (button-put button :notmuch-part-hidden (not show))
\r
123 > (goto-char new-start)
\r
124 > (insert "[ " button-label (if show " ]" " (hidden) ]"))
\r
125 > (let ((old-end (button-end button)))
\r
126 > (move-overlay button new-start (point))
\r
127 > (delete-region (point) old-end))
\r
128 > - (goto-char (min old-point (1- (button-end button))))))))
\r
129 > + (goto-char (min old-point (1- (button-end button))))
\r
130 > + (overlay-put overlay 'invisible (not show))))))
\r
132 > (defun notmuch-show-multipart/*-to-list (part)
\r
133 > (mapcar (lambda (inner-part) (plist-get inner-part :content-type))
\r
134 > @@ -851,7 +854,7 @@ message at DEPTH in the current thread."
\r
135 > (setq handlers (cdr handlers))))
\r
138 > -(defun notmuch-show-create-part-overlays (button beg end hide)
\r
139 > +(defun notmuch-show-create-part-overlays (button beg end)
\r
140 > "Add an overlay to the part between BEG and END"
\r
142 > ;; If there is no button (i.e., the part is text/plain and the first
\r
143 > @@ -859,11 +862,9 @@ message at DEPTH in the current thread."
\r
145 > (when (and button (/= beg end))
\r
146 > (button-put button 'overlay (make-overlay beg end))
\r
147 > - ;; We toggle the button for hidden parts as that gets the
\r
148 > - ;; button label right.
\r
149 > - (save-excursion
\r
151 > - (notmuch-show-toggle-part-invisibility button)))))
\r
152 > + ;; Return true if we created an overlay.
\r
156 Ah, I see the mis-indentation was only temporary.
\r
159 > (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
160 > "Insert the body part PART at depth DEPTH in the current thread.
\r
161 > @@ -889,7 +890,9 @@ If HIDE is non-nil then initially hide this part."
\r
162 > ;; Ensure that the part ends with a carriage return.
\r
165 > - (notmuch-show-create-part-overlays button beg (point) hide)))
\r
166 > + (notmuch-show-create-part-overlays button beg (point))
\r
168 > + (notmuch-show-toggle-part-invisibility button))))
\r
170 This lost the save-excursion around
\r
171 notmuch-show-toggle-part-invisibility. I'm surprised that works, given
\r
172 how notmuch-show-toggle-part-invisibility moves point, but then again, I
\r
173 can believe that the planets happen to align here because you're hiding
\r
174 a part and that part happens to go to (point-max). Might be worth a
\r
175 comment or putting back the save-excursion just so people don't have to
\r
179 > (defun notmuch-show-insert-body (msg body depth)
\r
180 > "Insert the body BODY at depth DEPTH in the current thread."
\r