1 Return-Path: <amthrax@awakening.csail.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 C1C5E431FAE
\r
6 for <notmuch@notmuchmail.org>; Mon, 26 Mar 2012 18:37:23 -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 nqfAl0cNnm2X for <notmuch@notmuchmail.org>;
\r
16 Mon, 26 Mar 2012 18:37:22 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id D3BE3431FB6
\r
20 for <notmuch@notmuchmail.org>; Mon, 26 Mar 2012 18:37:21 -0700 (PDT)
\r
21 X-AuditID: 12074423-b7f9c6d0000008c3-b9-4f7119d1d2eb
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 55.F8.02243.1D9117F4; Mon, 26 Mar 2012 21:37:21 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q2R1bKOU013590;
\r
27 Mon, 26 Mar 2012 21:37:20 -0400
\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 q2R1bJ5u004575
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Mon, 26 Mar 2012 21:37:20 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amthrax@awakening.csail.mit.edu>)
\r
36 id 1SCLLa-0005Kf-Na; Mon, 26 Mar 2012 21:37:18 -0400
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH 2/2] emacs: Escape all message ID queries
\r
40 Date: Mon, 26 Mar 2012 21:37:16 -0400
\r
41 Message-Id: <1332812236-20387-3-git-send-email-amdragon@mit.edu>
\r
42 X-Mailer: git-send-email 1.7.7.2
\r
43 In-Reply-To: <1332812236-20387-1-git-send-email-amdragon@mit.edu>
\r
44 References: <1332812236-20387-1-git-send-email-amdragon@mit.edu>
\r
45 X-Brightmail-Tracker:
\r
46 H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsUixCmqrHtRstDfYOIKTovrN2cyOzB6PFt1
\r
47 izmAMYrLJiU1J7MstUjfLoEro/nJMpaCE6oVqxtmMDYwHpPrYuTkkBAwkWh7eoEdwhaTuHBv
\r
48 PRuILSSwj1GiZZlrFyMXkL2BUeLLzSXMEImTTBLzTotCJDYzSpy5uQWsg01AQ2Lb/uWMILaI
\r
49 gLTEzruzWbsYOTiYBdQk/nSpgJjCApYSX6e4gFSwCKhK7Fn7iQXE5hVwkPh7+SkbxA0KEjOm
\r
50 XGEEKecUcJRY+C4UYquDxPM1e5knMPIvYGRYxSibklulm5uYmVOcmqxbnJyYl5dapGuml5tZ
\r
51 opeaUrqJERQu7C7KOxj/HFQ6xCjAwajEw2s4vcBfiDWxrLgy9xCjJAeTkigvLzDYhPiS8lMq
\r
52 MxKLM+KLSnNSiw8xSnAwK4nw3jwJVM6bklhZlVqUD5OS5mBREufV0HrnJySQnliSmp2aWpBa
\r
53 BJOV4eBQkuDlARkqWJSanlqRlplTgpBm4uAEGc4DNFwHpIa3uCAxtzgzHSJ/ilFRSpyXESQh
\r
54 AJLIKM2D64XF8ytGcaBXhHllQap4gKkArvsV0GAmoMFLjuSDDC5JREhJNTAaPf7lZL/PdG34
\r
55 /qznSxbO02Ld2fOiQWF9sOAR/bcps7Ybpkz49ecq0+Xr/1UX8BYV3L4Wyv+8sP9Vz9euXa2L
\r
56 5+6Mk7SYlv2oPI9j812hsxvrU4p/NUt8N5Lpv7vq1+FCORmj2fNfuPbUX730JXmlpuM+a73a
\r
57 9+0RQeyvD5bqTZpTOcXH4vZaJZbijERDLeai4kQACC8H/8ICAAA=
\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: Tue, 27 Mar 2012 01:37:23 -0000
\r
72 This adds a lib function to turn a message ID into a properly escaped
\r
73 message ID query and uses this function wherever we previously
\r
74 hand-constructed ID queries. Wherever this new function is used,
\r
75 documentation has been clarified to refer to "id: queries" instead of
\r
78 This fixes the broken test introduced by the previous patch.
\r
80 emacs/notmuch-lib.el | 6 +++++-
\r
81 emacs/notmuch-message.el | 2 +-
\r
82 emacs/notmuch-show.el | 14 +++++++-------
\r
84 4 files changed, 13 insertions(+), 10 deletions(-)
\r
86 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
87 index c146748..2e367b5 100644
\r
88 --- a/emacs/notmuch-lib.el
\r
89 +++ b/emacs/notmuch-lib.el
\r
90 @@ -144,6 +144,10 @@ the user hasn't set this variable with the old or new value."
\r
94 +(defun notmuch-id-to-query (id)
\r
95 + "Return a query that matches the message with id ID."
\r
96 + (concat "id:\"" (replace-regexp-in-string "\"" "\"\"" id t t) "\""))
\r
100 (defun notmuch-common-do-stash (text)
\r
101 @@ -230,7 +234,7 @@ the given type."
\r
103 (defun notmuch-get-bodypart-content (msg part nth process-crypto)
\r
104 (or (plist-get part :content)
\r
105 - (notmuch-get-bodypart-internal (concat "id:" (plist-get msg :id)) nth process-crypto)))
\r
106 + (notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto)))
\r
108 (defun notmuch-plist-to-alist (plist)
\r
109 (loop for (key value . rest) on plist by #'cddr
\r
110 diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
\r
111 index 264a5b9..3010281 100644
\r
112 --- a/emacs/notmuch-message.el
\r
113 +++ b/emacs/notmuch-message.el
\r
114 @@ -44,7 +44,7 @@ the \"inbox\" and \"todo\", you would set
\r
117 notmuch-message-replied-tags)))
\r
118 - (apply 'notmuch-tag (concat "id:" (car (car rep))) tags)))))
\r
119 + (apply 'notmuch-tag (notmuch-id-to-query (car (car rep))) tags)))))
\r
121 (add-hook 'message-send-hook 'notmuch-message-mark-replied)
\r
123 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
124 index 0cd7d82..6d3fe62 100644
\r
125 --- a/emacs/notmuch-show.el
\r
126 +++ b/emacs/notmuch-show.el
\r
127 @@ -613,7 +613,7 @@ current buffer, if possible."
\r
128 ;; times (hundreds!), which results in many calls to
\r
131 - (setq content (notmuch-get-bodypart-internal (concat "id:" message-id)
\r
132 + (setq content (notmuch-get-bodypart-internal (notmuch-id-to-query message-id)
\r
133 part-number notmuch-show-process-crypto))
\r
134 (with-current-buffer w3m-current-buffer
\r
135 (notmuch-show-w3m-cid-store-internal url
\r
136 @@ -1325,16 +1325,16 @@ Some useful entries are:
\r
137 (plist-get props prop)))
\r
139 (defun notmuch-show-get-message-id (&optional bare)
\r
140 - "Return the Message-Id of the current message.
\r
141 + "Return an id: query for the Message-Id of the current message.
\r
143 If optional argument BARE is non-nil, return
\r
144 -the Message-Id without prefix and quotes."
\r
145 +the Message-Id without id: prefix and escaping."
\r
147 (notmuch-show-get-prop :id)
\r
148 - (concat "id:\"" (notmuch-show-get-prop :id) "\"")))
\r
149 + (notmuch-id-to-query (notmuch-show-get-prop :id))))
\r
151 (defun notmuch-show-get-messages-ids ()
\r
152 - "Return all message ids of messages in the current thread."
\r
153 + "Return all id: queries of messages in the current thread."
\r
154 (let ((message-ids))
\r
156 (lambda () (push (notmuch-show-get-message-id) message-ids)))
\r
157 @@ -1401,7 +1401,7 @@ current thread."
\r
160 (defun notmuch-show-get-message-ids-for-open-messages ()
\r
161 - "Return a list of all message IDs for open messages in the current thread."
\r
162 + "Return a list of all id: queries for open messages in the current thread."
\r
164 (let (message-ids done)
\r
165 (goto-char (point-min))
\r
166 @@ -1805,7 +1805,7 @@ thread from search."
\r
167 (notmuch-common-do-stash (notmuch-show-get-from)))
\r
169 (defun notmuch-show-stash-message-id ()
\r
170 - "Copy message ID of current message to kill-ring."
\r
171 + "Copy id: query matching the current message to kill-ring."
\r
173 (notmuch-common-do-stash (notmuch-show-get-message-id)))
\r
175 diff --git a/test/emacs b/test/emacs
\r
176 index 62eaedb..8b92d0a 100755
\r
179 @@ -140,7 +140,6 @@ output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
\r
180 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
\r
182 test_begin_subtest "Message with quote in Message-Id:"
\r
183 -test_subtest_known_broken
\r
184 add_message '[id]="\"quote\"@example"' '[subject]="Message with quote in Message-Id"'
\r
185 test_emacs '(notmuch-search "subject:\"Message with quote\"")
\r
186 (notmuch-test-wait)
\r