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 6BFB7431FC0
\r
6 for <notmuch@notmuchmail.org>; Tue, 4 Dec 2012 15:28:02 -0800 (PST)
\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 dVLHjmHKi7Id for <notmuch@notmuchmail.org>;
\r
18 Tue, 4 Dec 2012 15:27:58 -0800 (PST)
\r
19 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com
\r
20 [209.85.212.169]) (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 E646C431FC7
\r
23 for <notmuch@notmuchmail.org>; Tue, 4 Dec 2012 15:27:54 -0800 (PST)
\r
24 Received: by mail-wi0-f169.google.com with SMTP id hq12so1271837wib.2
\r
25 for <notmuch@notmuchmail.org>; Tue, 04 Dec 2012 15:27:53 -0800 (PST)
\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=q/7FmSp30zN6J5A7ffR738RN63A+tQM477LMsf8RsDk=;
\r
29 b=vdwtqL5ciuiMeqSUrqKtR4iuxsrMMtV275dHb0ZixYqxZIwt/zHenVIvEol6mHUrBl
\r
30 S2BiaO3ZgVYyGVTtOOOpY/iJiAS0oqxSpzw2nIZbfhploxvDdTASXEACzKzsgM/NF/iW
\r
31 Nozrfe/RXmgyzIiWX+PYK8J1fTfQoEXfmfgIbwcUJ1p/6M+0qyICkMcoeWT6ofmYIoeZ
\r
32 8cQhgKieNLUTkqZuIA20qDFu6epjXJj2UeDGs0WES1RCMPsJotcZDc6H42n8auueLosI
\r
33 ZWUH0EZ4BpXqA0FHzwXwAqlkEDUmh7MGchzRXIQ6VU7lvMLvnS1ubFIdVGLgt1MtoYBo
\r
35 Received: by 10.180.109.166 with SMTP id ht6mr59119wib.7.1354663673756;
\r
36 Tue, 04 Dec 2012 15:27:53 -0800 (PST)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPS id cf6sm4005280wib.3.2012.12.04.15.27.52
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Tue, 04 Dec 2012 15:27:53 -0800 (PST)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 3/3] emacs: show: add invisibility button action
\r
44 Date: Tue, 4 Dec 2012 23:27:42 +0000
\r
45 Message-Id: <1354663662-20524-4-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1354663662-20524-1-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1354663662-20524-1-git-send-email-markwalters1009@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Tue, 04 Dec 2012 23:28:02 -0000
\r
63 This adds a button action to show hidden parts. In this version "t"
\r
64 toggles the visibility of a part. In addition "RET" on a non-shown
\r
67 The button is used to hide parts when appropriate (eg text/html in
\r
68 multipart/alternative).
\r
70 emacs/notmuch-show.el | 36 +++++++++++++++++++++++++++++++++++-
\r
71 1 files changed, 35 insertions(+), 1 deletions(-)
\r
73 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
74 index 3215ebc..a4daff8 100644
\r
75 --- a/emacs/notmuch-show.el
\r
76 +++ b/emacs/notmuch-show.el
\r
77 @@ -478,6 +478,7 @@ message at DEPTH in the current thread."
\r
78 (define-key map "v" 'notmuch-show-part-button-view)
\r
79 (define-key map "o" 'notmuch-show-part-button-interactively-view)
\r
80 (define-key map "|" 'notmuch-show-part-button-pipe)
\r
81 + (define-key map "t" 'notmuch-show-toggle-invisible-part-action)
\r
83 "Submap for button commands")
\r
84 (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
\r
85 @@ -555,6 +556,31 @@ message at DEPTH in the current thread."
\r
86 (let ((handle (mm-make-handle (current-buffer) (list content-type))))
\r
87 (mm-pipe-part handle))))
\r
89 +;; This is taken from notmuch-wash: maybe it should be unified?
\r
90 +(defun notmuch-show-toggle-invisible-part-action (&optional button no-redisplay)
\r
92 + (let* ((button (or button (button-at (point))))
\r
93 + (overlay (button-get button 'overlay))
\r
94 + (invis-spec (button-get button 'invisibility-spec))
\r
95 + (show (invisible-p invis-spec)))
\r
98 + (remove-from-invisibility-spec invis-spec)
\r
99 + (add-to-invisibility-spec invis-spec))
\r
100 + (let* ((new-start (button-start button))
\r
101 + (button-label (button-get button :base-label))
\r
102 + (old-point (point))
\r
103 + (inhibit-read-only t))
\r
104 + (goto-char new-start)
\r
105 + (insert "[ " button-label (if show " ]" " (not shown) ]"))
\r
106 + (let ((old-end (button-end button)))
\r
107 + (move-overlay button new-start (point))
\r
108 + (delete-region (point) old-end))
\r
109 + (goto-char (min old-point (1- (button-end button)))))
\r
110 + (unless no-redisplay
\r
111 + (force-window-update)
\r
112 + (redisplay t)))))
\r
114 (defun notmuch-show-multipart/*-to-list (part)
\r
115 (mapcar (lambda (inner-part) (plist-get inner-part :content-type))
\r
116 (plist-get part :content)))
\r
117 @@ -867,6 +893,11 @@ message at DEPTH in the current thread."
\r
119 (button-put button 'invisibility-spec invis-spec)
\r
120 (button-put button 'overlay overlay))
\r
122 + ;; We toggle the button for hidden parts as that gets the
\r
123 + ;; button label right.
\r
125 + (notmuch-show-toggle-invisible-part-action button t))
\r
126 (goto-char (point-max)))))
\r
128 (defun notmuch-show-insert-bodypart (msg part depth &optional not-shown)
\r
129 @@ -1996,7 +2027,10 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
131 (defun notmuch-show-part-button-default (&optional button)
\r
133 - (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))
\r
134 + (let ((button (or button (button-at (point)))))
\r
135 + (if (invisible-p (button-get button 'invisibility-spec))
\r
136 + (notmuch-show-toggle-invisible-part-action button)
\r
137 + (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))))
\r
139 (defun notmuch-show-part-button-save (&optional button)
\r