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 arlo.cworth.org (Postfix) with ESMTP id 63DE86DE1A1F
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 Nov 2015 03:04:55 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.209 tagged_above=-999 required=5 tests=[AWL=0.079,
\r
12 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]
\r
16 Received: from arlo.cworth.org ([127.0.0.1])
\r
17 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
18 with ESMTP id 7qvhWDYi5Aj9 for <notmuch@notmuchmail.org>;
\r
19 Sat, 7 Nov 2015 03:04:53 -0800 (PST)
\r
20 Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com
\r
21 [74.125.82.47]) by arlo.cworth.org (Postfix) with ESMTPS id 729CC6DE1641 for
\r
22 <notmuch@notmuchmail.org>; Sat, 7 Nov 2015 03:04:47 -0800 (PST)
\r
23 Received: by wmll128 with SMTP id l128so59650236wml.0
\r
24 for <notmuch@notmuchmail.org>; Sat, 07 Nov 2015 03:04:46 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
27 bh=wM3/zNYHgIEi3p5igDA1A/8/4u/zXy6JX+XcFdkRBlo=;
\r
28 b=bd696H9AXy07nBUuQU+kSn6NuR+OgTf8d5wXRkv6jODb5r5TPQJ8jnUG9AhqFd50Cc
\r
29 6cFruafvalECndIuWiBnlowRg5mSwVssjq5xloiNG8ECz0kyClbgJj9mgfBGwG3HEdV3
\r
30 cQC1pMiCsridG7nwbRjdqI7i8OZitWClhi3okWP7p6iqaVnf1ByzjgsKwHbXyMeeT5tb
\r
31 KOS+13kkkal/nTZ1xh9oJGvESwvZOAoXjSQA+tPGxfX7DaMT15rDoX5wQsxrDiyjN0tM
\r
32 RHq7rwOFkaVXdvZ1OQes9d91uqUP2yDWHeI3ngPwiF6TLCX056zApUp+lyBZYrgKx4JK
\r
34 X-Received: by 10.28.214.141 with SMTP id n135mr16045295wmg.53.1446894286054;
\r
35 Sat, 07 Nov 2015 03:04:46 -0800 (PST)
\r
36 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])
\r
37 by smtp.gmail.com with ESMTPSA id l1sm4576870wjx.13.2015.11.07.03.04.44
\r
38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
39 Sat, 07 Nov 2015 03:04:44 -0800 (PST)
\r
40 From: Mark Walters <markwalters1009@gmail.com>
\r
41 To: notmuch@notmuchmail.org
\r
42 Subject: [PATCH v4 2/7] emacs/show: Accommodate the lack of part header
\r
44 Date: Sat, 7 Nov 2015 11:04:31 +0000
\r
45 Message-Id: <1446894276-7814-3-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 2.1.4
\r
47 In-Reply-To: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.20
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sat, 07 Nov 2015 11:04:55 -0000
\r
63 From: David Edmondson <dme@dme.org>
\r
65 Various pieces of code assumed (reasonably) that part header buttons
\r
66 are present. Modify them to avoid problems if no part headers were
\r
69 emacs/notmuch-show.el | 88 ++++++++++++++++++++++++++++-----------------------
\r
70 1 file changed, 48 insertions(+), 40 deletions(-)
\r
72 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
73 index 47a02e5..9fc79e0 100644
\r
74 --- a/emacs/notmuch-show.el
\r
75 +++ b/emacs/notmuch-show.el
\r
76 @@ -509,36 +509,37 @@ (defun notmuch-show-insert-part-header (nth content-type declared-type &optional
\r
78 (defun notmuch-show-toggle-part-invisibility (&optional button)
\r
80 - (let* ((button (or button (button-at (point))))
\r
81 - (overlay (button-get button 'overlay))
\r
82 - (lazy-part (button-get button :notmuch-lazy-part)))
\r
83 - ;; We have a part to toggle if there is an overlay or if there is a lazy part.
\r
84 - ;; If neither is present we cannot toggle the part so we just return nil.
\r
85 - (when (or overlay lazy-part)
\r
86 - (let* ((show (button-get button :notmuch-part-hidden))
\r
87 - (new-start (button-start button))
\r
88 - (button-label (button-get button :base-label))
\r
89 - (old-point (point))
\r
90 - (properties (text-properties-at (button-start button)))
\r
91 - (inhibit-read-only t))
\r
92 - ;; Toggle the button itself.
\r
93 - (button-put button :notmuch-part-hidden (not show))
\r
94 - (goto-char new-start)
\r
95 - (insert "[ " button-label (if show " ]" " (hidden) ]"))
\r
96 - (set-text-properties new-start (point) properties)
\r
97 - (let ((old-end (button-end button)))
\r
98 - (move-overlay button new-start (point))
\r
99 - (delete-region (point) old-end))
\r
100 - (goto-char (min old-point (1- (button-end button))))
\r
101 - ;; Return nil if there is a lazy-part, it is empty, and we are
\r
102 - ;; trying to show it. In all other cases return t.
\r
105 - (button-put button :notmuch-lazy-part nil)
\r
106 - (notmuch-show-lazy-part lazy-part button))
\r
107 - ;; else there must be an overlay.
\r
108 - (overlay-put overlay 'invisible (not show))
\r
110 + (let ((button (or button (button-at (point)))))
\r
112 + (let ((overlay (button-get button 'overlay))
\r
113 + (lazy-part (button-get button :notmuch-lazy-part)))
\r
114 + ;; We have a part to toggle if there is an overlay or if there is a lazy part.
\r
115 + ;; If neither is present we cannot toggle the part so we just return nil.
\r
116 + (when (or overlay lazy-part)
\r
117 + (let* ((show (button-get button :notmuch-part-hidden))
\r
118 + (new-start (button-start button))
\r
119 + (button-label (button-get button :base-label))
\r
120 + (old-point (point))
\r
121 + (properties (text-properties-at (button-start button)))
\r
122 + (inhibit-read-only t))
\r
123 + ;; Toggle the button itself.
\r
124 + (button-put button :notmuch-part-hidden (not show))
\r
125 + (goto-char new-start)
\r
126 + (insert "[ " button-label (if show " ]" " (hidden) ]"))
\r
127 + (set-text-properties new-start (point) properties)
\r
128 + (let ((old-end (button-end button)))
\r
129 + (move-overlay button new-start (point))
\r
130 + (delete-region (point) old-end))
\r
131 + (goto-char (min old-point (1- (button-end button))))
\r
132 + ;; Return nil if there is a lazy-part, it is empty, and we are
\r
133 + ;; trying to show it. In all other cases return t.
\r
136 + (button-put button :notmuch-lazy-part nil)
\r
137 + (notmuch-show-lazy-part lazy-part button))
\r
138 + ;; else there must be an overlay.
\r
139 + (overlay-put overlay 'invisible (not show))
\r
142 ;; Part content ID handling
\r
144 @@ -647,14 +648,17 @@ (defun notmuch-show-insert-part-multipart/related (msg part content-type nth dep
\r
147 (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
\r
148 - (button-put button 'face 'notmuch-crypto-part-header)
\r
149 - ;; add signature status button if sigstatus provided
\r
151 + (button-put button 'face 'notmuch-crypto-part-header))
\r
152 + ;; Add signature status button if sigstatus provided.
\r
153 (if (plist-member part :sigstatus)
\r
154 (let* ((from (notmuch-show-get-header :From msg))
\r
155 (sigstatus (car (plist-get part :sigstatus))))
\r
156 (notmuch-crypto-insert-sigstatus-button sigstatus from))
\r
157 - ;; if we're not adding sigstatus, tell the user how they can get it
\r
158 - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
\r
159 + ;; If we're not adding the signature status, tell the user how
\r
160 + ;; they can get it.
\r
162 + (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
\r
164 (let ((inner-parts (plist-get part :content))
\r
166 @@ -668,17 +672,20 @@ (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth dept
\r
169 (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)
\r
170 - (button-put button 'face 'notmuch-crypto-part-header)
\r
171 - ;; add encryption status button if encstatus specified
\r
173 + (button-put button 'face 'notmuch-crypto-part-header))
\r
174 + ;; Add encryption status button if encryption status is specified.
\r
175 (if (plist-member part :encstatus)
\r
176 (let ((encstatus (car (plist-get part :encstatus))))
\r
177 (notmuch-crypto-insert-encstatus-button encstatus)
\r
178 - ;; add signature status button if sigstatus specified
\r
179 + ;; Add signature status button if signature status is
\r
181 (if (plist-member part :sigstatus)
\r
182 (let* ((from (notmuch-show-get-header :From msg))
\r
183 (sigstatus (car (plist-get part :sigstatus))))
\r
184 (notmuch-crypto-insert-sigstatus-button sigstatus from))))
\r
185 - ;; if we're not adding encstatus, tell the user how they can get it
\r
186 + ;; If we're not adding the encryption status, tell the user how
\r
187 + ;; they can get it.
\r
188 (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
\r
190 (let ((inner-parts (plist-get part :content))
\r
191 @@ -977,8 +984,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
194 (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
\r
195 - (button-put button :notmuch-lazy-part
\r
196 - (list msg part mime-type nth depth button)))
\r
198 + (button-put button :notmuch-lazy-part
\r
199 + (list msg part mime-type nth depth button))))
\r
201 ;; Some of the body part handlers leave point somewhere up in the
\r
202 ;; part, so we make sure that we're down at the end.
\r