Commit graph

21 commits

Author SHA1 Message Date
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Eric Abrahamsen
aae44a36f3 Ensure that Gnus servers are open(able) before searching them
* lisp/gnus/gnus-search.el (gnus-search-run-search): Imap servers need
to be opened (made into the "current server") before we manipulate the
nnimap-buffer.
(gnus-search-run-search): Sneakily fix regexp.
(gnus-search-indexed-parse-output): We need to pass the server name in
here, otherwise nnmaildir won't know how to make this the "current
server".
2020-12-22 09:01:25 -08:00
Eric Abrahamsen
e3f83a89aa Fix regexp in IMAP search-string preparation
* lisp/gnus/gnus-search.el (gnus-search-run-search): This was failing
to catch all of X-GM-RAW.
2020-12-17 19:16:52 -08:00
Eric Abrahamsen
afee776594 Fix logic of gnus-search-imap-handle-date
* lisp/gnus/gnus-search.el (gnus-search-imap-handle-date): Just
rewrite this whole ridiculous function.
2020-12-14 09:27:05 -08:00
Eric Abrahamsen
808817d76f Be more graceful about handling Gnus search errors
One search may be applied to several servers: don't let one server's
error derail the whole process.

* lisp/gnus/gnus-search.el (gnus-search-config-error): Define new
error.
(gnus-search-run-search, gnus-search-server-to-engine): Raise this
specific error as appropriate.
(gnus-search-run-query): Catch this error and effectively demote it.
2020-12-10 17:56:35 -08:00
Eric Abrahamsen
61f1eb99b0 Add "replied" -> "answered" for gnus-search imap searches
* lisp/gnus/gnus-search.el (gnus-search-imap-handle-flag): This allows
"mark:A" to be translated into "ANSWERED" and "-mark:A" to be
translated into "UNANSWERED".
2020-11-25 15:27:54 -08:00
Eric Abrahamsen
11bef9693a Assume default imap TEXT search even when not using parsed queries
This behavior both better matches the previous nnir behavior, reducing
confusion for new users, and matches behavior when using parsed
queries.

* lisp/gnus/gnus-search.el (gnus-search-imap-search-keys): Make sure
this variable contains all known IMAP search keys.
(gnus-search-run-search): If the search query doesn't start with a
known search key, prepend "TEXT " to the query.
2020-11-25 15:06:55 -08:00
Eric Abrahamsen
8b7fa9e663 Small fixes to gnus-search output parsing of indexed engines
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output): When
filtering for desired groups, accept any of [.\/] as potential segment
delimiters. Later on, filesystem path separators will be interpreted
as dots (".") when constructing group names. Also, make sure we use
`expand-file-name' on the prefix, and just use `string-remove-prefix'
to get rid of it.
2020-11-22 20:46:18 -08:00
Eric Abrahamsen
ab417cf64d Handle negation of search keys in gnus-search minibuffer completion
* lisp/gnus/gnus-search.el (gnus-search-get-active): Keys might start
with a leading "-": check for that and ignore it.
2020-11-14 13:22:13 -08:00
Eric Abrahamsen
31f94e4b1c Save instantiated gnus-search engines in an alist
So we aren't re-instantiating (and potentially configuring) them with
every search.

* lisp/gnus/gnus-search.el (gnus-search-engine-instance-alist): New
variable holding server->engine mapping.
(gnus-search-server-to-engine): See if we've already instantiated this
server. If so, return it. If not, instantiate it and save in the above
variable.
(gnus-search-shutdown): Shutdown function clearing the above alist.
2020-11-13 17:25:46 -08:00
Eric Abrahamsen
3e07b871c4 Remove unused "internal" gnus-search variables
* lisp/gnus/gnus-search.el (gnus-search-memo-query,
gnus-search-memo-server): No longer needed.
2020-11-11 10:36:51 -08:00
Eric Abrahamsen
d22a914c79 Fix defgeneric name of gnus-search-index(ed)-extract
* lisp/gnus/gnus-search.el (gnus-search-indexed-extract): Had the
wrong name on the generic.
2020-11-11 10:35:20 -08:00
Eric Abrahamsen
795b7da16b Add more protections to gnus-search query parsing
* lisp/gnus/gnus-group.el (gnus-group-make-search-group,
gnus-group-read-ephemeral-search-group): If the query is coming in via
the old 'nnir-query-spec key, we know not to parse it.
* lisp/gnus/gnus-search.el (gnus-search-make-query-string): Check if
the query was sent in as '(query "query"), and not '(query . "query).
(gnus-search-imap-search-keys): Add x-gm-raw to imap search keys.
(gnus-search-prepare-query): If we know this query should be raw,
don't even try parsing it, as it probably won't work.
2020-11-08 16:35:19 -08:00
Eric Abrahamsen
33c7ddd47d Another backwards-compatibility fix for gnus-search
* lisp/gnus/gnus-search.el (gnus-search-server-to-engine): Because of
the way we've set up the obsolete variable alias for
`nnir-method-default-engines', we may end up with its value in
`gnus-search-default-engines'. Make the check for "old style" values
general, so we catch them no matter where they came from.
2020-11-08 08:39:19 -08:00
Eric Abrahamsen
35d9881809 Various fixes and backward compatibility for gnus-search
* lisp/gnus/gnus-group.el (gnus-group-make-search-group,
gnus-group-read-ephemeral-search-group): Check for and accept the old
nnir-* spec keys.
* lisp/gnus/gnus-search.el (shared-initialize): Use
generate-new-buffer instead of doing it ourselves.
(gnus-search-server-to-engine): Raise an informative error explicitly
if we can't find a search engine, rather than letting it fall through
to something less helpful.
(gnus-search-make-spec): Add `gnus-search--complete-key-data' to
`completion-at-point-functions' locally, not globally.
2020-11-07 09:44:10 -08:00
Mattias Engdegård
b7b9bbb93d Rectify skip-set argument
* lisp/gnus/gnus-search.el (gnus-search-query-end-of-input):
Remove brackets that don't belong.  Found by relint.
2020-11-06 23:02:29 +01:00
Mattias Engdegård
aea936562b * lisp/gnus/gnus-search.el (gnus-search-contact-tables): Fix type.
A more precise type is desirable but at it is now correct ('list' is not).
2020-11-06 13:55:33 +01:00
Eric Abrahamsen
ac471ff09d Fixes and improvements to gnus-search
* lisp/gnus/gnus-search.el (gnus-search-default-engines): Change type
from a list of two-element lists, to alist. This matches nnir's old
option type, and should make transition easier.
(nnir-imap-default-search-key): Note that variable is obsolete.
(gnus-search-transform-expression): Interpret the "attachment" key as
"body" in imap searches. Allow specifying larger/smaller message size
values in KB or MB units.
(gnus-search-server-to-engine): Fix error in this function, and
clarify somewhat.
2020-11-05 19:47:58 -08:00
Eric Abrahamsen
125956725b Avoid use of eieio-oset-default
* lisp/gnus/gnus-search.el: Replace with an :initform tag on the slot
definition. `symbol-value' is necessary, otherwise the defclass macro
will treat the option as a quoted symbol.
2020-11-04 10:40:25 -08:00
Eric Abrahamsen
9bcdebd9b7 Remove gmane search engine
Remove the gnus-search-gmane class and all associated methods.  If
search functionality is ever resurrected, then revert this commit.

* lisp/gnus/gnus-search.el: Delete code, and remove from default value
of `gnus-search-default-engines'.
2020-11-03 21:20:17 -08:00
Eric Abrahamsen
7fad12c59b New gnus-search library
This library provides a fundamental reworking of the search
functionality previously found in nnir.el.  It uses class-based search
engines to interface with external searching facilities, and a parsed
search query syntax that can search multiple engines.

* lisp/gnus/gnus-search.el: New library containing search
functionality for Gnus.
* doc/misc/gnus.texi: Document.
* lisp/gnus/gnus-group.el (gnus-group-make-search-group,
gnus-group-read-ephemeral-search-group): Remove references to nnir,
change meaning of prefix argument, change values of nnselect-function
and nnselect-args.
* lisp/gnus/nnselect.el: Replace references to nnir
(nnselect-request-article): Use gnus-search functions, and search
criteria.
(nnselect-request-thread, nnselect-search-thread): Use gnus-search
thread search.
(gnus-summary-make-search-group): Switch to use gnus-search function
and arguments.
* test/lisp/gnus/search-tests.el: Tests for new functionality.
2020-11-03 21:20:17 -08:00