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 6A9C2431FD7
\r
6 for <notmuch@notmuchmail.org>; Tue, 4 Dec 2012 15:28:01 -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 kvXQtx8CCDJj for <notmuch@notmuchmail.org>;
\r
18 Tue, 4 Dec 2012 15:27:56 -0800 (PST)
\r
19 Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com
\r
20 [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 8C230429E32 for <notmuch@notmuchmail.org>; Tue, 4 Dec 2012 15:27:52 -0800
\r
24 Received: by mail-wg0-f47.google.com with SMTP id dq11so2243404wgb.2
\r
25 for <notmuch@notmuchmail.org>; Tue, 04 Dec 2012 15:27:51 -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=jS5XjTdjllp2CsHpn/ESiIKeEE6ByFIsb+xTBvJqaoY=;
\r
29 b=XvaMOErYMRYJzDDXlpsxCcfz8hQak0WgNBkvgUI9bYeiSdrVR+jKwa004HyW3LkDjE
\r
30 lkQ7Z+GjzLC/n4qyXYOFcvBTigDA4Q0TDLXPTPxsqtaYO+wR12UOwKRgM+7BHo7Bcp0P
\r
31 RhElKjdJaSHFrs2PACMdg5LX3ASStPybg/yR/6m/lP/KtxgbYEXPud4Ph8zmA9GGSQif
\r
32 t7zC0hkP+HM6t2kDZ71J8mJF41vQGzYOLxcfLM0wgQiKMYP9ohxIosjgHhzSacDO3n1K
\r
33 t6IoVMkMpwXY0clpY5VgZWnB8nnYFPR90qH/GWc3QlVP9TjQLDy1KjCS+5eSJeW0idgN
\r
35 Received: by 10.180.102.234 with SMTP id fr10mr28383wib.17.1354663671416;
\r
36 Tue, 04 Dec 2012 15:27:51 -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 eu8sm16989974wib.1.2012.12.04.15.27.50
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Tue, 04 Dec 2012 15:27:50 -0800 (PST)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 2/3] emacs: show: add overlays for each part
\r
44 Date: Tue, 4 Dec 2012 23:27:41 +0000
\r
45 Message-Id: <1354663662-20524-3-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:01 -0000
\r
63 This make notmuch-show-insert-bodypart add an overlay for any
\r
64 non-trivial part with a button header (currently the first text/plain
\r
65 part does not have a button). At this point the overlay is available
\r
66 to the button but there is no action using it yet.
\r
68 In addition a not-shown variable which is used to request the part be
\r
69 hidden by default down to the overlay but this is not acted on yet.
\r
71 emacs/notmuch-show.el | 62 +++++++++++++++++++++++++++++++++++++-----------
\r
72 1 files changed, 48 insertions(+), 14 deletions(-)
\r
74 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
75 index f8ce037..3215ebc 100644
\r
76 --- a/emacs/notmuch-show.el
\r
77 +++ b/emacs/notmuch-show.el
\r
78 @@ -569,10 +569,9 @@ message at DEPTH in the current thread."
\r
79 ;; should be chosen if there are more than one that match?
\r
80 (mapc (lambda (inner-part)
\r
81 (let ((inner-type (plist-get inner-part :content-type)))
\r
82 - (if (or notmuch-show-all-multipart/alternative-parts
\r
83 - (string= chosen-type inner-type))
\r
84 - (notmuch-show-insert-bodypart msg inner-part depth)
\r
85 - (notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil " (not shown)"))))
\r
86 + (notmuch-show-insert-bodypart msg inner-part depth
\r
87 + (not (or notmuch-show-all-multipart/alternative-parts
\r
88 + (string= chosen-type inner-type))))))
\r
91 (when notmuch-show-indent-multipart
\r
92 @@ -840,17 +839,52 @@ message at DEPTH in the current thread."
\r
93 (setq handlers (cdr handlers))))
\r
96 -(defun notmuch-show-insert-bodypart (msg part depth)
\r
97 - "Insert the body part PART at depth DEPTH in the current thread."
\r
98 +(defun notmuch-show-insert-part-overlays (msg beg end not-shown)
\r
99 + "Add an overlay to the part between BEG and END"
\r
100 + (let* ((button (button-at beg))
\r
101 + (part-beg (and button (1+ (button-end button)))))
\r
103 + ;; If the part contains no text we do not make it toggleable.
\r
104 + (unless (or (not button) (eq part-beg end))
\r
105 + (let ((base-label (button-get button :base-label))
\r
106 + (overlay (make-overlay part-beg end))
\r
107 + (message-invis-spec (plist-get msg :message-invis-spec))
\r
108 + (invis-spec (make-symbol "notmuch-part-region")))
\r
110 + (overlay-put overlay 'invisible (list invis-spec message-invis-spec))
\r
111 + (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)
\r
112 + (overlay-put overlay 'priority 10)
\r
113 + (overlay-put overlay 'type "part")
\r
114 + ;; Now we have to add invis-spec to every overlay this
\r
115 + ;; overlay contains, otherwise these inner overlays will
\r
116 + ;; override this one.
\r
117 + (mapc (lambda (inner)
\r
118 + (when (and (>= (overlay-start inner) part-beg)
\r
119 + (<= (overlay-end inner) end))
\r
120 + (overlay-put inner 'invisible
\r
121 + (cons invis-spec (overlay-get inner 'invisible)))))
\r
122 + (overlays-in part-beg end))
\r
124 + (button-put button 'invisibility-spec invis-spec)
\r
125 + (button-put button 'overlay overlay))
\r
126 + (goto-char (point-max)))))
\r
128 +(defun notmuch-show-insert-bodypart (msg part depth &optional not-shown)
\r
129 + "Insert the body part PART at depth DEPTH in the current thread.
\r
131 +If not-shown is TRUE then initially hide this part."
\r
132 (let ((content-type (downcase (plist-get part :content-type)))
\r
133 - (nth (plist-get part :id)))
\r
134 - (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type))
\r
135 - ;; Some of the body part handlers leave point somewhere up in the
\r
136 - ;; part, so we make sure that we're down at the end.
\r
137 - (goto-char (point-max))
\r
138 - ;; Ensure that the part ends with a carriage return.
\r
141 + (nth (plist-get part :id))
\r
144 + (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type)
\r
145 + ;; Some of the body part handlers leave point somewhere up in the
\r
146 + ;; part, so we make sure that we're down at the end.
\r
147 + (goto-char (point-max))
\r
148 + ;; Ensure that the part ends with a carriage return.
\r
151 + (notmuch-show-insert-part-overlays msg beg (point) not-shown)))
\r
153 (defun notmuch-show-insert-body (msg body depth)
\r
154 "Insert the body BODY at depth DEPTH in the current thread."
\r