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 BFBA66DE1ABD
\r
6 for <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:24 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.245 tagged_above=-999 required=5 tests=[AWL=0.325,
\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, RCVD_IN_DNSWL_LOW=-0.7,
\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 gAMLtTLOgIgy for <notmuch@notmuchmail.org>;
\r
19 Sun, 14 Feb 2016 10:40:22 -0800 (PST)
\r
20 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com
\r
21 [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id 5CA776DE0A87 for
\r
22 <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:18 -0800 (PST)
\r
23 Received: by mail-wm0-f66.google.com with SMTP id c200so12198238wme.0
\r
24 for <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:18 -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=gCEQUDTI2mN64Kcd22gStbK2S8d4mhSuPOKJSkGWhmw=;
\r
28 b=VPgsp1SyixpT+9Zz5XUvLHO/bTGFtWo1dZt4o0eicNPxJk6PjyGMxD9+Qb04yZbM9g
\r
29 u/KgOwQrdApSmOvlXL0dbv2I6r91M44dywZRarGHrmvXgDZRx+OoanfbJQIXGiqy2fyH
\r
30 vgjPBZ1pjPzyQZqI7jMQ8rpKOJrxa5ShHaDPYwk/d7YJsFlOvlmwgtGjFAZR3vANroxr
\r
31 oGEwtOt52gTmjsZ/vub6JFNpC9Ixi2pdade6TVVoiN4nc79AYgu0LfITvCkr/Tek/KOX
\r
32 pYm1+VC3NGT2TdUFaPExmBloL3CxHu0pO6RiK9ak66DRQMv6UgX9+c7bNi3AUCMRIE2I
\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
35 d=1e100.net; s=20130820;
\r
36 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
38 bh=gCEQUDTI2mN64Kcd22gStbK2S8d4mhSuPOKJSkGWhmw=;
\r
39 b=UH0YcFCLc2IRnYxz1o7hYigNn6LP8E/sabPvGqdrklx8iFIg1sxHjqOROeCQ3YNRmK
\r
40 jOyNjMDf9KcoUxRDhRLO3W9P35D6EB2EQMkmdFd6CpdL7jyXW5oT47uLPxDTkH+hv5S1
\r
41 wNXbKkX6MDoU+WmyG/B/AkBONy8zMNDodIu42HgSjqCX1iymIT8dXey/1b32q47Hu77+
\r
42 LRobqbGxZ5JM9j9loMs4UzI7VSXIALcLcT0afoaE32PaM3XfBRNPt6NhC5YjDVmkw6dT
\r
43 4hb3AJID6FLxnCHgmADDr/xmCGsdZjkSN4Bj4MXBtwk42/amtsOiikH6tm+5Y0ghtUD7
\r
46 AG10YOT7roZv4ogbHAI7BNxAmJQM/n1wzZRlCKld5Z9irQQETgoqDyL/LDx6/oEhbZcyLQ==
\r
47 X-Received: by 10.28.68.139 with SMTP id r133mr8319922wma.13.1455475217106;
\r
48 Sun, 14 Feb 2016 10:40:17 -0800 (PST)
\r
49 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])
\r
50 by smtp.gmail.com with ESMTPSA id r10sm21676952wjz.24.2016.02.14.10.40.16
\r
51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
52 Sun, 14 Feb 2016 10:40:16 -0800 (PST)
\r
53 From: Mark Walters <markwalters1009@gmail.com>
\r
54 To: notmuch@notmuchmail.org
\r
55 Subject: [PATCH v5 2/7] emacs/show: Accommodate the lack of part header
\r
57 Date: Sun, 14 Feb 2016 18:39:54 +0000
\r
58 Message-Id: <1455475199-32622-3-git-send-email-markwalters1009@gmail.com>
\r
59 X-Mailer: git-send-email 2.1.4
\r
60 In-Reply-To: <1455475199-32622-1-git-send-email-markwalters1009@gmail.com>
\r
61 References: <1455475199-32622-1-git-send-email-markwalters1009@gmail.com>
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.20
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sun, 14 Feb 2016 18:40:24 -0000
\r
76 From: David Edmondson <dme@dme.org>
\r
78 Various pieces of code assumed (reasonably) that part header buttons
\r
79 are present. Modify them to avoid problems if no part headers were
\r
82 emacs/notmuch-show.el | 88 ++++++++++++++++++++++++++++-----------------------
\r
83 1 file changed, 48 insertions(+), 40 deletions(-)
\r
85 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
86 index 70cdb9d..37ed74d 100644
\r
87 --- a/emacs/notmuch-show.el
\r
88 +++ b/emacs/notmuch-show.el
\r
89 @@ -507,36 +507,37 @@ message at DEPTH in the current thread."
\r
91 (defun notmuch-show-toggle-part-invisibility (&optional button)
\r
93 - (let* ((button (or button (button-at (point))))
\r
94 - (overlay (button-get button 'overlay))
\r
95 - (lazy-part (button-get button :notmuch-lazy-part)))
\r
96 - ;; We have a part to toggle if there is an overlay or if there is a lazy part.
\r
97 - ;; If neither is present we cannot toggle the part so we just return nil.
\r
98 - (when (or overlay lazy-part)
\r
99 - (let* ((show (button-get button :notmuch-part-hidden))
\r
100 - (new-start (button-start button))
\r
101 - (button-label (button-get button :base-label))
\r
102 - (old-point (point))
\r
103 - (properties (text-properties-at (button-start button)))
\r
104 - (inhibit-read-only t))
\r
105 - ;; Toggle the button itself.
\r
106 - (button-put button :notmuch-part-hidden (not show))
\r
107 - (goto-char new-start)
\r
108 - (insert "[ " button-label (if show " ]" " (hidden) ]"))
\r
109 - (set-text-properties new-start (point) properties)
\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 - ;; Return nil if there is a lazy-part, it is empty, and we are
\r
115 - ;; trying to show it. In all other cases return t.
\r
118 - (button-put button :notmuch-lazy-part nil)
\r
119 - (notmuch-show-lazy-part lazy-part button))
\r
120 - ;; else there must be an overlay.
\r
121 - (overlay-put overlay 'invisible (not show))
\r
123 + (let ((button (or button (button-at (point)))))
\r
125 + (let ((overlay (button-get button 'overlay))
\r
126 + (lazy-part (button-get button :notmuch-lazy-part)))
\r
127 + ;; We have a part to toggle if there is an overlay or if there is a lazy part.
\r
128 + ;; If neither is present we cannot toggle the part so we just return nil.
\r
129 + (when (or overlay lazy-part)
\r
130 + (let* ((show (button-get button :notmuch-part-hidden))
\r
131 + (new-start (button-start button))
\r
132 + (button-label (button-get button :base-label))
\r
133 + (old-point (point))
\r
134 + (properties (text-properties-at (button-start button)))
\r
135 + (inhibit-read-only t))
\r
136 + ;; Toggle the button itself.
\r
137 + (button-put button :notmuch-part-hidden (not show))
\r
138 + (goto-char new-start)
\r
139 + (insert "[ " button-label (if show " ]" " (hidden) ]"))
\r
140 + (set-text-properties new-start (point) properties)
\r
141 + (let ((old-end (button-end button)))
\r
142 + (move-overlay button new-start (point))
\r
143 + (delete-region (point) old-end))
\r
144 + (goto-char (min old-point (1- (button-end button))))
\r
145 + ;; Return nil if there is a lazy-part, it is empty, and we are
\r
146 + ;; trying to show it. In all other cases return t.
\r
149 + (button-put button :notmuch-lazy-part nil)
\r
150 + (notmuch-show-lazy-part lazy-part button))
\r
151 + ;; else there must be an overlay.
\r
152 + (overlay-put overlay 'invisible (not show))
\r
155 ;; Part content ID handling
\r
157 @@ -645,14 +646,17 @@ will return nil if the CID is unknown or cannot be retrieved."
\r
160 (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
\r
161 - (button-put button 'face 'notmuch-crypto-part-header)
\r
162 - ;; add signature status button if sigstatus provided
\r
164 + (button-put button 'face 'notmuch-crypto-part-header))
\r
165 + ;; Add signature status button if sigstatus provided.
\r
166 (if (plist-member part :sigstatus)
\r
167 (let* ((from (notmuch-show-get-header :From msg))
\r
168 (sigstatus (car (plist-get part :sigstatus))))
\r
169 (notmuch-crypto-insert-sigstatus-button sigstatus from))
\r
170 - ;; if we're not adding sigstatus, tell the user how they can get it
\r
171 - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
\r
172 + ;; If we're not adding the signature status, tell the user how
\r
173 + ;; they can get it.
\r
175 + (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
\r
177 (let ((inner-parts (plist-get part :content))
\r
179 @@ -666,17 +670,20 @@ will return nil if the CID is unknown or cannot be retrieved."
\r
182 (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)
\r
183 - (button-put button 'face 'notmuch-crypto-part-header)
\r
184 - ;; add encryption status button if encstatus specified
\r
186 + (button-put button 'face 'notmuch-crypto-part-header))
\r
187 + ;; Add encryption status button if encryption status is specified.
\r
188 (if (plist-member part :encstatus)
\r
189 (let ((encstatus (car (plist-get part :encstatus))))
\r
190 (notmuch-crypto-insert-encstatus-button encstatus)
\r
191 - ;; add signature status button if sigstatus specified
\r
192 + ;; Add signature status button if signature status is
\r
194 (if (plist-member part :sigstatus)
\r
195 (let* ((from (notmuch-show-get-header :From msg))
\r
196 (sigstatus (car (plist-get part :sigstatus))))
\r
197 (notmuch-crypto-insert-sigstatus-button sigstatus from))))
\r
198 - ;; if we're not adding encstatus, tell the user how they can get it
\r
199 + ;; If we're not adding the encryption status, tell the user how
\r
200 + ;; they can get it.
\r
201 (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
\r
203 (let ((inner-parts (plist-get part :content))
\r
204 @@ -976,8 +983,9 @@ useful for quoting in replies)."
\r
207 (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
\r
208 - (button-put button :notmuch-lazy-part
\r
209 - (list msg part mime-type nth depth button)))
\r
211 + (button-put button :notmuch-lazy-part
\r
212 + (list msg part mime-type nth depth button))))
\r
214 ;; Some of the body part handlers leave point somewhere up in the
\r
215 ;; part, so we make sure that we're down at the end.
\r