When using the `gnus-search-imap' backend for `gnus-search', there is a bug in the `gnus-search-run-search' method. When the search query begins with parentheses (such as "(OR FROM A FROM B)"), the naive check for a known IMAP keyword at the beginning fails due to the parenthesis, and gnus-search adds "TEXT " to the beginning of the query. Moreover, these are several search keys that are not in `gnus-search-imap-search-keys'. These are "new", "not", "old", and "or". I include a minimal patch for these problems. There's another misfeature which I have not attempted to fix that made debugging the problem much more difficult. If the result of a query is not OK, this fact just gets ignored by `gnus-search-run-search' and the search group is considered empty. Even after fixing the above problems, this is a problem when doing a raw search, as one doesn't know whether the query is bad or if it just does not result in any messages. Example: C-u G G "((OR" RET This results in something like: 577841 BAD Error in IMAP command UID SEARCH: Missing ')' (0.001 + 0.000 secs). in the process buffer. Here's a small patch for the first two issues: