diff options
author | Austin Clements <amdragon@MIT.EDU> | 2014-03-11 18:19:54 -0400 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-03-25 19:57:06 -0300 |
commit | 92c3fd938e7a4e86edbc872eb5348dc048ec0e78 (patch) | |
tree | 9b6ce988392f85117972b603b3642282365a6926 /emacs | |
parent | 716af7deb8d0692ec3c867a599e29da61027b808 (diff) |
emacs: Use whitelist instead of blacklist for term escaping
Previously, the term escaper used a blacklist of characters that
needed escaping. This blacklist turned out to be somewhat incomplete;
for example, it did not contain non-whitespace ASCII control
characters or Unicode "fancy quotes", both of which do require the
term to be escaped.
Switch to a whitelist of characters that are definitely safe to leave
unquoted. This fixes the broken test introduced by the previous
patch.
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/notmuch-lib.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index fa7646fe..959764e3 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -426,7 +426,10 @@ user-friendly queries." (save-match-data (if (or (equal term "") - (string-match "[ ()]\\|^\"" term)) + ;; To be pessimistic, only pass through terms composed + ;; entirely of ASCII printing characters other than ", (, + ;; and ). + (string-match "[^!#-'*-~]" term)) ;; Requires escaping (concat "\"" (replace-regexp-in-string "\"" "\"\"" term t t) "\"") term))) |