1 Return-Path: <markwalters1009@gmail.com>
\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 4CB14429E32
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 11:27:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id gVTbjmb7Hh0B for <notmuch@notmuchmail.org>;
\r
18 Fri, 31 May 2013 11:27:46 -0700 (PDT)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id BAAF0429E34
\r
23 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 11:27:26 -0700 (PDT)
\r
24 Received: by mail-wi0-f181.google.com with SMTP id hi5so962562wib.14
\r
25 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 11:27:25 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=NzwqXnMZ2smnb1/JhTNQRyJO1YLCnbUlj0bBHWuMpiM=;
\r
29 b=N3NWsDqWOHFpBCCPN3Oto3xIUpS24sF1qhW9V4EWdcbJWTUmjrMRwIm8uSA7bj7PQ2
\r
30 Nm2ZhfKSPe3xBv2CaAURqbQkF+t2vi3kvQAZYH6xtEGtvlqF4he2R7VZd7pSN5NWGsg5
\r
31 B/UDpFl1W8tlDYiQBU3iw7152Ei5xJ+tGZLOLueN/H1XOGlfRBe8z8AcTXlyxBqv+lxW
\r
32 9+IDDgLbU/+mtj71g+gp+fSXLh1GIrQk35+mfLiLoFVNwSF77pM/YZ7eFDApeTkMevlH
\r
33 Fhc2psYESe4d8WsHWb9+E/lUCTH+qssPB6nsv2NDVVdb+JrS5/HtCeM1UoZT9pAjMpKT
\r
35 X-Received: by 10.180.206.77 with SMTP id lm13mr4448242wic.18.1370024845601;
\r
36 Fri, 31 May 2013 11:27:25 -0700 (PDT)
\r
37 Received: from localhost (92.40.240.237.threembb.co.uk. [92.40.240.237])
\r
38 by mx.google.com with ESMTPSA id d5sm5742397wic.1.2013.05.31.11.27.23
\r
39 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Fri, 31 May 2013 11:27:25 -0700 (PDT)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org, Austin Clements <aclements@csail.mit.edu>,
\r
44 Adam Wolfe Gordon <awg+notmuch@xvx.ca>
\r
45 Subject: [PATCH v3 4/5] emacs: show: modify the way hidden state is recorded.
\r
46 Date: Fri, 31 May 2013 19:26:45 +0100
\r
47 Message-Id: <1370024806-6616-5-git-send-email-markwalters1009@gmail.com>
\r
48 X-Mailer: git-send-email 1.7.10.4
\r
49 In-Reply-To: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>
\r
50 References: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>
\r
51 X-BeenThere: notmuch@notmuchmail.org
\r
52 X-Mailman-Version: 2.1.13
\r
54 List-Id: "Use and development of the notmuch mail system."
\r
55 <notmuch.notmuchmail.org>
\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
59 List-Post: <mailto:notmuch@notmuchmail.org>
\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
63 X-List-Received-Date: Fri, 31 May 2013 18:27:52 -0000
\r
65 Previously, whether a part was hidden or shown was recorded in the
\r
66 invisibility/visibility of the part overlay. Since we are going to
\r
67 have lazily rendered parts with no overlay store the hidden/shown
\r
68 state in the part button itself.
\r
70 Additionally, in preparation for the invisible part handling move the
\r
71 actual hiding of the hidden parts to insert-bodypart from
\r
72 create-part-overlays.
\r
74 Finally, we will need to know whether a part-insertion has done
\r
75 anything (it won't if the invisible part cannot be displayed by emacs)
\r
76 so we slightly rejig the code order in
\r
77 notmuch-show-toggle-part-invisibility to make it easier for the
\r
78 function to set an appropriate return value.
\r
80 emacs/notmuch-show.el | 23 +++++++++++++----------
\r
81 1 file changed, 13 insertions(+), 10 deletions(-)
\r
83 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
84 index 66cc3a5..89199e8 100644
\r
85 --- a/emacs/notmuch-show.el
\r
86 +++ b/emacs/notmuch-show.el
\r
87 @@ -495,6 +495,7 @@ message at DEPTH in the current thread."
\r
88 (concat "[ " base-label " ]")
\r
89 :base-label base-label
\r
90 :type 'notmuch-show-part-button-type
\r
91 + :notmuch-part-hidden nil
\r
93 :notmuch-filename name
\r
94 :notmuch-content-type content-type))
\r
95 @@ -555,18 +556,20 @@ message at DEPTH in the current thread."
\r
96 (let* ((button (or button (button-at (point))))
\r
97 (overlay (button-get button 'overlay)))
\r
99 - (let* ((show (overlay-get overlay 'invisible))
\r
100 + (let* ((show (button-get button :notmuch-part-hidden))
\r
101 (new-start (button-start button))
\r
102 (button-label (button-get button :base-label))
\r
103 (old-point (point))
\r
104 (inhibit-read-only t))
\r
105 - (overlay-put overlay 'invisible (not show))
\r
106 + ;; Toggle the button itself.
\r
107 + (button-put button :notmuch-part-hidden (not show))
\r
108 (goto-char new-start)
\r
109 (insert "[ " button-label (if show " ]" " (hidden) ]"))
\r
110 (let ((old-end (button-end button)))
\r
111 (move-overlay button new-start (point))
\r
112 (delete-region (point) old-end))
\r
113 - (goto-char (min old-point (1- (button-end button))))))))
\r
114 + (goto-char (min old-point (1- (button-end button))))
\r
115 + (overlay-put overlay 'invisible (not show))))))
\r
117 (defun notmuch-show-multipart/*-to-list (part)
\r
118 (mapcar (lambda (inner-part) (plist-get inner-part :content-type))
\r
119 @@ -851,7 +854,7 @@ message at DEPTH in the current thread."
\r
120 (setq handlers (cdr handlers))))
\r
123 -(defun notmuch-show-create-part-overlays (button beg end hide)
\r
124 +(defun notmuch-show-create-part-overlays (button beg end)
\r
125 "Add an overlay to the part between BEG and END"
\r
127 ;; If there is no button (i.e., the part is text/plain and the first
\r
128 @@ -859,11 +862,9 @@ message at DEPTH in the current thread."
\r
130 (when (and button (/= beg end))
\r
131 (button-put button 'overlay (make-overlay beg end))
\r
132 - ;; We toggle the button for hidden parts as that gets the
\r
133 - ;; button label right.
\r
136 - (notmuch-show-toggle-part-invisibility button)))))
\r
137 + ;; Return true if we created an overlay.
\r
141 (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
142 "Insert the body part PART at depth DEPTH in the current thread.
\r
143 @@ -889,7 +890,9 @@ If HIDE is non-nil then initially hide this part."
\r
144 ;; Ensure that the part ends with a carriage return.
\r
147 - (notmuch-show-create-part-overlays button beg (point) hide)))
\r
148 + (notmuch-show-create-part-overlays button beg (point))
\r
150 + (notmuch-show-toggle-part-invisibility button))))
\r
152 (defun notmuch-show-insert-body (msg body depth)
\r
153 "Insert the body BODY at depth DEPTH in the current thread."
\r