]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix possible prepending of "TEXT" to IMAP searches
authorEric Abrahamsen <eric@ericabrahamsen.net>
Mon, 11 Jan 2021 17:46:58 +0000 (09:46 -0800)
committerEric Abrahamsen <eric@ericabrahamsen.net>
Mon, 11 Jan 2021 17:48:50 +0000 (09:48 -0800)
* lisp/gnus/gnus-search.el (gnus-search-imap-search-keys): Add missing
keys "old", "new", "or" and "not".
(gnus-search-run-search): In addition, don't touch the query if it
starts with a parenthesis. Consider just getting rid of this
convenience altogether.

lisp/gnus/gnus-search.el

index 44f43b073c82626ed76a5ff8b5fea05e76abdc9d..5c6a5b9efd084dfb26e37d4dcc9d483498ff2dd9 100644 (file)
@@ -1036,7 +1036,7 @@ Responsible for handling and, or, and parenthetical expressions.")
   '(body cc bcc from header keyword larger smaller subject text to uid x-gm-raw
         answered before deleted draft flagged on since recent seen sentbefore
         senton sentsince unanswered undeleted undraft unflagged unkeyword
-        unseen all)
+        unseen all old new or not)
   "Known IMAP search keys.")
 
 ;; imap interface
@@ -1072,10 +1072,11 @@ Responsible for handling and, or, and parenthetical expressions.")
       ;; A bit of backward-compatibility slash convenience: if the
       ;; query string doesn't start with any known IMAP search
       ;; keyword, assume it is a "TEXT" search.
-      (unless (and (string-match "\\`[^[:blank:]]+" q-string)
-                  (memql (intern-soft (downcase
-                                       (match-string 0 q-string)))
-                         gnus-search-imap-search-keys))
+      (unless (or (looking-at "(")
+                 (and (string-match "\\`[^[:blank:]]+" q-string)
+                      (memql (intern-soft (downcase
+                                           (match-string 0 q-string)))
+                             gnus-search-imap-search-keys)))
        (setq q-string (concat "TEXT " q-string)))
 
       ;; If it's a thread query, make sure that all message-id