]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-lib.el
emacs: Use whitelist instead of blacklist for term escaping
[notmuch] / emacs / notmuch-lib.el
index fa7646fecb8bb020c2b06cea1fb5579be19c49f4..959764e33c98a0487a6d401ebfb7ebecd7881241 100644 (file)
@@ -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)))