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 24F1F431FDD
\r
6 for <notmuch@notmuchmail.org>; Wed, 29 May 2013 18:14:14 -0700 (PDT)
\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 Marq7Ctqxuib for <notmuch@notmuchmail.org>;
\r
16 Wed, 29 May 2013 18:14:06 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 331B8431FC2
\r
20 for <notmuch@notmuchmail.org>; Wed, 29 May 2013 18:14:00 -0700 (PDT)
\r
21 X-AuditID: 12074425-b7f986d00000082c-99-51a6a7d5f4c2
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id B8.BF.02092.5D7A6A15; Wed, 29 May 2013 21:13:58 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r4U1DtHn031313;
\r
27 Wed, 29 May 2013 21:13:56 -0400
\r
28 Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net
\r
29 [76.21.105.205]) (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4U1DqiK003006
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Wed, 29 May 2013 21:13:54 -0400
\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1UhrRA-0003Ys-3c; Wed, 29 May 2013 21:13:52 -0400
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH v2 2/5] emacs: Record part p-list in a text property
\r
40 Date: Wed, 29 May 2013 21:13:45 -0400
\r
41 Message-Id: <1369876428-13537-3-git-send-email-amdragon@mit.edu>
\r
42 X-Mailer: git-send-email 1.7.10.4
\r
43 In-Reply-To: <1369876428-13537-1-git-send-email-amdragon@mit.edu>
\r
44 References: <1369876428-13537-1-git-send-email-amdragon@mit.edu>
\r
45 X-Brightmail-Tracker:
\r
46 H4sIAAAAAAAAA+NgFjrBIsWRmVeSWpSXmKPExsUixCmqrXtt+bJAgz3TmS1Wz+WxuH5zJrMD
\r
47 k8fOWXfZPZ6tusUcwBTFZZOSmpNZllqkb5fAlXHsylSWgsPiFZ2bdrI2ML4V6mLk5JAQMJG4
\r
48 OGM2K4QtJnHh3no2EFtIYB+jRFencBcjF5C9Ech+cIsJwjnNJNFws58FwpnLKPHoXQMLSAub
\r
49 gIbEtv3LGUFsEQFpiZ13IcYyCzhKfN6/CGyssICLxMYZz8HqWQRUJR5/PgNWwyvgIHFx5n1G
\r
50 iDMUJbqfTQCr5wTqfd92nRHiJAeJ5m99TBMY+RcwMqxilE3JrdLNTczMKU5N1i1OTszLSy3S
\r
51 tdDLzSzRS00p3cQICiR2F9UdjBMOKR1iFOBgVOLh5dBdFijEmlhWXJl7iFGSg0lJlHfNUqAQ
\r
52 X1J+SmVGYnFGfFFpTmrxIUYJDmYlEd412kA53pTEyqrUonyYlDQHi5I4742Um/5CAumJJanZ
\r
53 qakFqUUwWRkODiUJ3qJlQI2CRanpqRVpmTklCGkmDk6Q4TxAw5VAaniLCxJzizPTIfKnGHU5
\r
54 Np+f/I5RiCUvPy9VSpzXFqRIAKQoozQPbg4sAbxiFAd6SxhiHQ8wecBNegW0hAloiTjzYpAl
\r
55 JYkIKakGRq4JMc3r7/lHOCz4zd327/r6f0J+NWw2n57s2L7I+Ne5CrHdL3h+zbNNXW3MNzfZ
\r
56 qU2w/NoTo9r/as8rDh5JuH5hvdO+p+pTmBq+nI+a8HvGb9bA8M4vYhbGD6OaNvZtSZlwYmdk
\r
57 avrj48zBXPOWXT7PMd/I9T9biFbb853xb6xnGCo/Oxhk26jEUpyRaKjFXFScCAAYsH+82wIA AA==
\r
58 X-BeenThere: notmuch@notmuchmail.org
\r
59 X-Mailman-Version: 2.1.13
\r
61 List-Id: "Use and development of the notmuch mail system."
\r
62 <notmuch.notmuchmail.org>
\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
66 List-Post: <mailto:notmuch@notmuchmail.org>
\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
70 X-List-Received-Date: Thu, 30 May 2013 01:14:14 -0000
\r
72 This is similar to what we already do with the message p-list, though
\r
73 we apply the part's text property to the whole part's text, in
\r
74 contrast with the message p-list, which is (rather obscurely) only
\r
75 applied to the first character.
\r
77 emacs/notmuch-lib.el | 12 ++++++++++++
\r
78 emacs/notmuch-show.el | 20 +++++++++++++++++++-
\r
79 2 files changed, 31 insertions(+), 1 deletion(-)
\r
81 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
82 index 790136e..2186783 100644
\r
83 --- a/emacs/notmuch-lib.el
\r
84 +++ b/emacs/notmuch-lib.el
\r
85 @@ -360,6 +360,18 @@ OBJECT."
\r
89 +(defun notmuch-map-text-property (start end prop func &optional object)
\r
90 + "Transform text property PROP using FUNC.
\r
92 +Applies FUNC to each distinct value of the text property PROP
\r
93 +between START and END of OBJECT, setting PROP to the value
\r
95 + (while (< start end)
\r
96 + (let ((value (get-text-property start prop object))
\r
97 + (next (next-single-property-change start prop object end)))
\r
98 + (put-text-property start next prop (funcall func value) object)
\r
99 + (setq start next))))
\r
101 (defun notmuch-logged-error (msg &optional extra)
\r
102 "Log MSG and EXTRA to *Notmuch errors* and signal MSG.
\r
104 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
105 index a080134..e84e1ba 100644
\r
106 --- a/emacs/notmuch-show.el
\r
107 +++ b/emacs/notmuch-show.el
\r
108 @@ -900,7 +900,17 @@ If HIDE is non-nil then initially hide this part."
\r
109 ;; Ensure that the part ends with a carriage return.
\r
112 - (notmuch-show-create-part-overlays msg beg (point) hide)))
\r
113 + (notmuch-show-create-part-overlays msg beg (point) hide)
\r
114 + ;; Record part information. Since we already inserted subparts,
\r
115 + ;; don't override existing :notmuch-part properties.
\r
116 + (notmuch-map-text-property beg (point) :notmuch-part
\r
117 + (lambda (v) (or v part)))
\r
118 + ;; Make :notmuch-part front sticky and rear non-sticky so it stays
\r
119 + ;; applied to the beginning of each line when we indent the message.
\r
120 + (notmuch-map-text-property beg (point) 'front-sticky
\r
121 + (lambda (v) (pushnew :notmuch-part v)))
\r
122 + (notmuch-map-text-property beg (point) 'rear-nonsticky
\r
123 + (lambda (v) (pushnew :notmuch-part v)))))
\r
125 (defun notmuch-show-insert-body (msg body depth)
\r
126 "Insert the body BODY at depth DEPTH in the current thread."
\r
127 @@ -1404,6 +1414,14 @@ Some useful entries are:
\r
128 (notmuch-show-move-to-message-top)
\r
129 (get-text-property (point) :notmuch-message-properties)))
\r
131 +(defun notmuch-show-get-part-properties ()
\r
132 + "Return the properties of the innermost part containing point.
\r
134 +This is the part property list retrieved from the CLI. Signals
\r
135 +an error if there is no part containing point."
\r
136 + (or (get-text-property (point) :notmuch-part)
\r
137 + (error "No message part here")))
\r
139 (defun notmuch-show-set-prop (prop val &optional props)
\r
140 (let ((inhibit-read-only t)
\r