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 8A4ED431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 20:06:52 -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 hUgYaqAVdZb6 for <notmuch@notmuchmail.org>;
\r
16 Mon, 10 Dec 2012 20:06:52 -0800 (PST)
\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 DF88C431FAE
\r
20 for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 20:06:51 -0800 (PST)
\r
21 X-AuditID: 1209190e-b7f516d0000008e4-04-50c6b15b8293
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 98.D6.02276.B51B6C05; Mon, 10 Dec 2012 23:06:51 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qBB46ock003735;
\r
27 Mon, 10 Dec 2012 23:06:51 -0500
\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.6/8.12.4) with ESMTP id qBB46mNT017618
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Mon, 10 Dec 2012 23:06:50 -0500 (EST)
\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 1TiH7I-0003bJ-9l; Mon, 10 Dec 2012 23:06:48 -0500
\r
37 From: Austin Clements <aclements@csail.mit.edu>
\r
38 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
39 Subject: Re: [PATCH 3/3] emacs: show: add invisibility button action
\r
40 In-Reply-To: <1354663662-20524-4-git-send-email-markwalters1009@gmail.com>
\r
41 References: <1354663662-20524-1-git-send-email-markwalters1009@gmail.com>
\r
42 <1354663662-20524-4-git-send-email-markwalters1009@gmail.com>
\r
43 User-Agent: Notmuch/0.14+159~g6895fee (http://notmuchmail.org) Emacs/23.4.1
\r
45 Date: Mon, 10 Dec 2012 23:06:48 -0500
\r
46 Message-ID: <87r4mxnsfb.fsf@awakening.csail.mit.edu>
\r
48 Content-Type: text/plain; charset=us-ascii
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixG6nohu98ViAwYU3khar5/JYXL85k9mB
\r
51 yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgymg618JW8FGm4sCp2ywNjAfEuxg5OSQETCTe
\r
52 vVjMDGGLSVy4t56ti5GLQ0hgH6PE/Q0gDieQs4FRYu0tZYjERSaJFYt2MUI4SxglNmx9xg5S
\r
53 xSagL7Fi7SRWEFtEwFXi6bfPYGOFBVwkLhw7ADaJU8BL4sLRacwQze2MEkcaGoEcDg5RgXiJ
\r
54 2ed8QGpYBFQlOm/8B5vDC3Tewt4JTBC2oMTJmU9YQGxmAS2JG/9eMk1gFJiFJDULSWoBI9Mq
\r
55 RtmU3Crd3MTMnOLUZN3i5MS8vNQiXWO93MwSvdSU0k2MoIDklOTbwfj1oNIhRgEORiUe3grV
\r
56 YwFCrIllxZW5hxglOZiURHl9lwOF+JLyUyozEosz4otKc1KLDzFKcDArifCW5gLleFMSK6tS
\r
57 i/JhUtIcLErivFdSbvoLCaQnlqRmp6YWpBbBZGU4OJQkeF02ADUKFqWmp1akZeaUIKSZODhB
\r
58 hvMADf+zHmR4cUFibnFmOkT+FKOilDivBUizAEgiozQPrheWMF4xigO9IswrDFLFA0w2cN2v
\r
59 gAYzAQ0+KXgYZHBJIkJKqoHR7OpL6xTfyqoqfsEbvactNrtzCPx97cCZdqmqceMcnsqKU7Nu
\r
60 8tv/V3DpFvDYHRI4p2leLufM0J87O/QbH1fY7Q6a9OnF84f/049LiVm16lTZhS1WMiiquvEw
\r
61 5pO69kW5y3mlz8z/vYnV7Z7Fp5int/92bMJlnmt7WXaoS3spnTEtDY68uEmJpTgj0VCLuag4
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Tue, 11 Dec 2012 04:06:52 -0000
\r
77 On Tue, 04 Dec 2012, Mark Walters <markwalters1009@gmail.com> wrote:
\r
78 > This adds a button action to show hidden parts. In this version "t"
\r
79 > toggles the visibility of a part. In addition "RET" on a non-shown
\r
82 > The button is used to hide parts when appropriate (eg text/html in
\r
83 > multipart/alternative).
\r
85 > emacs/notmuch-show.el | 36 +++++++++++++++++++++++++++++++++++-
\r
86 > 1 files changed, 35 insertions(+), 1 deletions(-)
\r
88 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
89 > index 3215ebc..a4daff8 100644
\r
90 > --- a/emacs/notmuch-show.el
\r
91 > +++ b/emacs/notmuch-show.el
\r
92 > @@ -478,6 +478,7 @@ message at DEPTH in the current thread."
\r
93 > (define-key map "v" 'notmuch-show-part-button-view)
\r
94 > (define-key map "o" 'notmuch-show-part-button-interactively-view)
\r
95 > (define-key map "|" 'notmuch-show-part-button-pipe)
\r
96 > + (define-key map "t" 'notmuch-show-toggle-invisible-part-action)
\r
98 > "Submap for button commands")
\r
99 > (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
\r
100 > @@ -555,6 +556,31 @@ message at DEPTH in the current thread."
\r
101 > (let ((handle (mm-make-handle (current-buffer) (list content-type))))
\r
102 > (mm-pipe-part handle))))
\r
104 > +;; This is taken from notmuch-wash: maybe it should be unified?
\r
105 > +(defun notmuch-show-toggle-invisible-part-action (&optional button no-redisplay)
\r
107 > + (let* ((button (or button (button-at (point))))
\r
108 > + (overlay (button-get button 'overlay))
\r
109 > + (invis-spec (button-get button 'invisibility-spec))
\r
110 > + (show (invisible-p invis-spec)))
\r
113 > + (remove-from-invisibility-spec invis-spec)
\r
114 > + (add-to-invisibility-spec invis-spec))
\r
115 > + (let* ((new-start (button-start button))
\r
116 > + (button-label (button-get button :base-label))
\r
117 > + (old-point (point))
\r
118 > + (inhibit-read-only t))
\r
119 > + (goto-char new-start)
\r
120 > + (insert "[ " button-label (if show " ]" " (not shown) ]"))
\r
122 s/not shown/hidden/?
\r
124 > + (let ((old-end (button-end button)))
\r
125 > + (move-overlay button new-start (point))
\r
126 > + (delete-region (point) old-end))
\r
127 > + (goto-char (min old-point (1- (button-end button)))))
\r
128 > + (unless no-redisplay
\r
129 > + (force-window-update)
\r
130 > + (redisplay t)))))
\r
132 Is the t argument necessary? Actually, are either (force-window-update)
\r
133 or (redisplay) necessary?
\r
136 > (defun notmuch-show-multipart/*-to-list (part)
\r
137 > (mapcar (lambda (inner-part) (plist-get inner-part :content-type))
\r
138 > (plist-get part :content)))
\r
139 > @@ -867,6 +893,11 @@ message at DEPTH in the current thread."
\r
141 > (button-put button 'invisibility-spec invis-spec)
\r
142 > (button-put button 'overlay overlay))
\r
144 > + ;; We toggle the button for hidden parts as that gets the
\r
145 > + ;; button label right.
\r
146 > + (when not-shown
\r
147 > + (notmuch-show-toggle-invisible-part-action button t))
\r
148 > (goto-char (point-max)))))
\r
150 > (defun notmuch-show-insert-bodypart (msg part depth &optional not-shown)
\r
151 > @@ -1996,7 +2027,10 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
153 > (defun notmuch-show-part-button-default (&optional button)
\r
155 > - (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))
\r
156 > + (let ((button (or button (button-at (point)))))
\r
157 > + (if (invisible-p (button-get button 'invisibility-spec))
\r
158 > + (notmuch-show-toggle-invisible-part-action button)
\r
159 > + (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))))
\r
161 > (defun notmuch-show-part-button-save (&optional button)
\r