(declare-function nnimap-buffer "nnimap" ())
(declare-function nnimap-command "nnimap" (&rest args))
+(defvar gnus-search-imap-search-keys
+ '(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)
+ "Known IMAP search keys.")
+
;; imap interface
(cl-defmethod gnus-search-run-search ((engine gnus-search-imap)
srv query groups)
(setq q-string
(gnus-search-make-query-string engine query))
+ ;; 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 "\\`[[:word:]]+" 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
;; searches are also references searches.
(when (alist-get 'thread query)
(nnimap-get-response call)))
(t (nnimap-command "UID SEARCH %s" query)))))
-;; TODO: Don't exclude booleans and date keys, just check for them
-;; before checking for general keywords.
-(defvar gnus-search-imap-search-keys
- '(body cc bcc from header keyword larger smaller subject text to uid x-gm-raw)
- "Known IMAP search keys, excluding booleans and date keys.")
-
(cl-defmethod gnus-search-transform ((_ gnus-search-imap)
(_query null))
"ALL")