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 87323431FAE
\r
6 for <notmuch@notmuchmail.org>; Mon, 27 May 2013 13:47:00 -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 xEIJti9UVYMp for <notmuch@notmuchmail.org>;
\r
16 Mon, 27 May 2013 13:46:55 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 9AAEF431FB6
\r
20 for <notmuch@notmuchmail.org>; Mon, 27 May 2013 13:46:49 -0700 (PDT)
\r
21 X-AuditID: 12074424-b7f8c6d0000028c4-22-51a3c639ae72
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 59.E5.10436.936C3A15; Mon, 27 May 2013 16:46:49 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r4RKkgmF008815;
\r
27 Mon, 27 May 2013 16:46:43 -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 r4RKkepZ026421
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Mon, 27 May 2013 16:46:42 -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 1Uh4JT-0008ND-QD; Mon, 27 May 2013 16:46:39 -0400
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH 2/4] emacs: Record part p-list in a text property
\r
40 Date: Mon, 27 May 2013 16:46:32 -0400
\r
41 Message-Id: <1369687594-31774-3-git-send-email-amdragon@mit.edu>
\r
42 X-Mailer: git-send-email 1.7.10.4
\r
43 In-Reply-To: <1369687594-31774-1-git-send-email-amdragon@mit.edu>
\r
44 References: <1369687594-31774-1-git-send-email-amdragon@mit.edu>
\r
45 X-Brightmail-Tracker:
\r
46 H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrGt5bHGgwYleKYvVc3ksrt+cyezA
\r
47 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZexdfY+5YLFoxYTty9gaGBsFuxg5OSQETCR6
\r
48 919ggrDFJC7cW8/WxcjFISSwj1Fi0p/rrCAJIYGNjBIrX7tAJE4zSTx9fZMNIjGXUWL3AnMQ
\r
49 m01AQ2Lb/uWMILaIgLTEzruzwZqZBRwlPu9fBFYvDGQfPzMbrIZFQFVi140dQDUcHLwCDhJn
\r
50 thlAHKEo0f1sAlg5J1D5lV2/oW5wkFj9uoNpAiP/AkaGVYyyKblVurmJmTnFqcm6xcmJeXmp
\r
51 RbrmermZJXqpKaWbGEFBxO6isoOx+ZDSIUYBDkYlHl6LzMWBQqyJZcWVuYcYJTmYlER52Y8A
\r
52 hfiS8lMqMxKLM+KLSnNSiw8xSnAwK4nwbl8BlONNSaysSi3Kh0lJc7AoifNeT7npLySQnliS
\r
53 mp2aWpBaBJOV4eBQkuCVAxkqWJSanlqRlplTgpBm4uAEGc4DNDwDpIa3uCAxtzgzHSJ/ilGX
\r
54 Y/P5ye8YhVjy8vNSpcR5y0GKBECKMkrz4ObAov8VozjQW8K8TiBVPMDEATfpFdASJqAl4sxg
\r
55 S0oSEVJSDYy1hj1zluTYhm7Ye6AiQab1UfQrg9UPMrcaaZ9bW7E8tbtwZYcM3+TtwUXVxw4d
\r
56 FevNX+hfJTWLxfWzj4lQ2MZ1z+vbTbQvOSzyPHz0d+eBjAqxklV/nq1OiZasNf5kUHj4Zu3u
\r
57 H+nmdz6Yqu1jOXO9a2swX0S1if2Ns9c/ynO83cTJnTVdQ0qJpTgj0VCLuag4EQAO4lda2QIA 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: Mon, 27 May 2013 20:47:00 -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 | 16 ++++++++++++++++
\r
78 emacs/notmuch-show.el | 13 ++++++++++++-
\r
79 2 files changed, 28 insertions(+), 1 deletion(-)
\r
81 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
82 index 790136e..09ce25e 100644
\r
83 --- a/emacs/notmuch-lib.el
\r
84 +++ b/emacs/notmuch-lib.el
\r
85 @@ -360,6 +360,22 @@ OBJECT."
\r
89 +(defun notmuch-put-text-property-if-nil (start end property value
\r
91 + "Like `put-text-property', but only set the property where it is nil."
\r
92 + (while (< start end)
\r
93 + (let ((start-nil (text-property-any start end property nil object)))
\r
94 + (if (null start-nil)
\r
95 + ;; There are no more nil regions; exit the loop
\r
97 + ;; Find the end of the nil region
\r
99 + (or (text-property-not-all start-nil end property nil object)
\r
101 + ;; Set the property
\r
102 + (put-text-property start-nil end-nil property value object)
\r
103 + (setq start end-nil))))))
\r
105 (defun notmuch-logged-error (msg &optional extra)
\r
106 "Log MSG and EXTRA to *Notmuch errors* and signal MSG.
\r
108 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
109 index a080134..acd0b55 100644
\r
110 --- a/emacs/notmuch-show.el
\r
111 +++ b/emacs/notmuch-show.el
\r
112 @@ -900,7 +900,10 @@ If HIDE is non-nil then initially hide this part."
\r
113 ;; Ensure that the part ends with a carriage return.
\r
116 - (notmuch-show-create-part-overlays msg beg (point) hide)))
\r
117 + (notmuch-show-create-part-overlays msg beg (point) hide)
\r
118 + ;; Record part information. Since we already inserted subparts,
\r
119 + ;; don't override exiting :notmuch-part properties.
\r
120 + (notmuch-put-text-property-if-nil beg (point) :notmuch-part part)))
\r
122 (defun notmuch-show-insert-body (msg body depth)
\r
123 "Insert the body BODY at depth DEPTH in the current thread."
\r
124 @@ -1404,6 +1407,14 @@ Some useful entries are:
\r
125 (notmuch-show-move-to-message-top)
\r
126 (get-text-property (point) :notmuch-message-properties)))
\r
128 +(defun notmuch-show-get-part-properties ()
\r
129 + "Return the properties of the part containing point.
\r
131 +This is the part property list retrieved from the CLI. Signals
\r
132 +an error if there is no part containing point."
\r
133 + (or (get-text-property (point) :notmuch-part)
\r
134 + (error "No message part here")))
\r
136 (defun notmuch-show-set-prop (prop val &optional props)
\r
137 (let ((inhibit-read-only t)
\r