1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Turn expiry on for nnselect groups

Articles in (persistent) groups from the gnus/nnselect backend will
now be run through the expiry process upon exit, like other persistent
groups. Expiry is not on by default for ephemeral nnselect groups but
may be turned on with nnselect-allow-ephemeral-expiry set to t.

* lisp/gnus/nnselect.el (nnselect-request-expire-articles): Make
article expiry work.
(nnselect-allow-ephemeral-expiry): New variable.
* doc/misc/gnus.texi (Creating Search Groups): Document
nnselect-allow-ephemeral-expiry.
This commit is contained in:
Andrew G Cohen 2022-03-04 16:20:01 +08:00
parent 4f6583ab8a
commit 62d97d4afd
2 changed files with 32 additions and 18 deletions

View file

@ -21735,6 +21735,12 @@ articles are drawn. If you want to create a @emph{persistent} group
that sticks around after exit from the summary buffer, you can call that sticks around after exit from the summary buffer, you can call
@code{gnus-group-make-search-group} (bound to @kbd{G g}). @code{gnus-group-make-search-group} (bound to @kbd{G g}).
Unlike persistent groups, ephemeral groups by default do not run
articles through the expiry process on exiting. If you want expiry to
happen in ephemeral search groups you can customize the variable
@code{nnselect-allow-ephemeral-expiry}. In all cases the expiry
process uses the underlying group's expiry parameters.
So you just performed a search whose results are so fabulous you So you just performed a search whose results are so fabulous you
wished you had done a persistent search rather than an ephemeral one? wished you had done a persistent search rather than an ephemeral one?
No problem; you can create such a group by calling No problem; you can create such a group by calling

View file

@ -256,6 +256,12 @@ as `(keyfunc member)' and the corresponding element is just
(define-obsolete-variable-alias 'nnir-retrieve-headers-override-function (define-obsolete-variable-alias 'nnir-retrieve-headers-override-function
'nnselect-retrieve-headers-override-function "28.1") 'nnselect-retrieve-headers-override-function "28.1")
(defcustom nnselect-allow-ephemeral-expiry nil
"If non-nil, articles in an ephemeral nnselect group will be put
through the expiry process."
:version "29.1"
:type 'boolean)
(defcustom nnselect-retrieve-headers-override-function nil (defcustom nnselect-retrieve-headers-override-function nil
"A function that retrieves article headers for ARTICLES from GROUP. "A function that retrieves article headers for ARTICLES from GROUP.
The retrieved headers should populate the `nntp-server-buffer'. The retrieved headers should populate the `nntp-server-buffer'.
@ -457,24 +463,26 @@ If this variable is nil, or if the provided function returns nil,
:test #'equal :count 1))))) :test #'equal :count 1)))))
(deffoo nnselect-request-expire-articles (deffoo nnselect-request-expire-articles
(articles _group &optional _server force) (articles group &optional _server force)
(if force (let ((nnimap-expunge 'immediately) not-deleted)
(let (not-expired) (if (and (not force)
(pcase-dolist (`(,artgroup . ,artids) (ids-by-group articles)) (not nnselect-allow-ephemeral-expiry)
(let ((artlist (sort (mapcar #'cdr artids) #'<))) (gnus-ephemeral-group-p (nnselect-add-prefix group)))
(unless (gnus-check-backend-function 'request-expire-articles articles
artgroup) (pcase-dolist (`(,artgroup . ,artids) (ids-by-group articles))
(error "Group %s does not support article expiration" artgroup)) (let ((artlist (sort (mapcar #'cdr artids) #'<)))
(unless (gnus-check-server (gnus-find-method-for-group artgroup)) (unless
(error "Couldn't open server for group %s" artgroup)) (gnus-check-backend-function 'request-expire-articles artgroup)
(push (mapcar (lambda (art) (error "Group %s does not support article expiration" artgroup))
(car (rassq art artids))) (unless (gnus-check-server (gnus-find-method-for-group artgroup))
(let ((nnimap-expunge 'immediately)) (error "Couldn't open server for group %s" artgroup))
(gnus-request-expire-articles (setq not-deleted
artlist artgroup force))) (append
not-expired))) (mapcar (lambda (art) (car (rassq art artids)))
(sort (delq nil not-expired) #'<)) (gnus-request-expire-articles artlist artgroup
articles)) force))
not-deleted))))
(sort (delq nil not-deleted) #'<))))
(deffoo nnselect-warp-to-article () (deffoo nnselect-warp-to-article ()