From ee1180018ee3c772d7ac769222ff9c6940f3c838 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 26 Mar 2012 21:37:16 -0400 Subject: emacs: Escape all message ID queries This adds a lib function to turn a message ID into a properly escaped message ID query and uses this function wherever we previously hand-constructed ID queries. Wherever this new function is used, documentation has been clarified to refer to "id: queries" instead of "message IDs". This fixes the broken test introduced by the previous patch. --- emacs/notmuch-lib.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'emacs/notmuch-lib.el') diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index a754de77..2492b80b 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -144,6 +144,10 @@ the user hasn't set this variable with the old or new value." "[No Subject]" subject))) +(defun notmuch-id-to-query (id) + "Return a query that matches the message with id ID." + (concat "id:\"" (replace-regexp-in-string "\"" "\"\"" id t t) "\"")) + ;; (defun notmuch-common-do-stash (text) @@ -231,7 +235,7 @@ the given type." (defun notmuch-get-bodypart-content (msg part nth process-crypto) (or (plist-get part :content) - (notmuch-get-bodypart-internal (concat "id:" (plist-get msg :id)) nth process-crypto))) + (notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto))) (defun notmuch-plist-to-alist (plist) (loop for (key value . rest) on plist by #'cddr -- cgit v1.2.3