aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew G Cohen2022-03-04 16:20:01 +0800
committerAndrew G Cohen2022-03-04 16:20:01 +0800
commit62d97d4afd4a13cb2cd0f7eacbc4b5af1d620cf7 (patch)
tree08f020dd66efe809f71993da7b4d16eadbb562b6
parent4f6583ab8a6f1f8e2329bf0b683277101447948d (diff)
downloademacs-62d97d4afd4a13cb2cd0f7eacbc4b5af1d620cf7.tar.gz
emacs-62d97d4afd4a13cb2cd0f7eacbc4b5af1d620cf7.zip
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.
-rw-r--r--doc/misc/gnus.texi6
-rw-r--r--lisp/gnus/nnselect.el44
2 files changed, 32 insertions, 18 deletions
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index a3def495c44..20a2d920841 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -21735,6 +21735,12 @@ articles are drawn. If you want to create a @emph{persistent} group
21735that sticks around after exit from the summary buffer, you can call 21735that sticks around after exit from the summary buffer, you can call
21736@code{gnus-group-make-search-group} (bound to @kbd{G g}). 21736@code{gnus-group-make-search-group} (bound to @kbd{G g}).
21737 21737
21738Unlike persistent groups, ephemeral groups by default do not run
21739articles through the expiry process on exiting. If you want expiry to
21740happen in ephemeral search groups you can customize the variable
21741@code{nnselect-allow-ephemeral-expiry}. In all cases the expiry
21742process uses the underlying group's expiry parameters.
21743
21738So you just performed a search whose results are so fabulous you 21744So you just performed a search whose results are so fabulous you
21739wished you had done a persistent search rather than an ephemeral one? 21745wished you had done a persistent search rather than an ephemeral one?
21740No problem; you can create such a group by calling 21746No problem; you can create such a group by calling
diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index b9072d4cb39..9193b38e315 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -256,6 +256,12 @@ as `(keyfunc member)' and the corresponding element is just
256(define-obsolete-variable-alias 'nnir-retrieve-headers-override-function 256(define-obsolete-variable-alias 'nnir-retrieve-headers-override-function
257 'nnselect-retrieve-headers-override-function "28.1") 257 'nnselect-retrieve-headers-override-function "28.1")
258 258
259(defcustom nnselect-allow-ephemeral-expiry nil
260 "If non-nil, articles in an ephemeral nnselect group will be put
261through the expiry process."
262 :version "29.1"
263 :type 'boolean)
264
259(defcustom nnselect-retrieve-headers-override-function nil 265(defcustom nnselect-retrieve-headers-override-function nil
260 "A function that retrieves article headers for ARTICLES from GROUP. 266 "A function that retrieves article headers for ARTICLES from GROUP.
261The retrieved headers should populate the `nntp-server-buffer'. 267The retrieved headers should populate the `nntp-server-buffer'.
@@ -457,24 +463,26 @@ If this variable is nil, or if the provided function returns nil,
457 :test #'equal :count 1))))) 463 :test #'equal :count 1)))))
458 464
459(deffoo nnselect-request-expire-articles 465(deffoo nnselect-request-expire-articles
460 (articles _group &optional _server force) 466 (articles group &optional _server force)
461 (if force 467 (let ((nnimap-expunge 'immediately) not-deleted)
462 (let (not-expired) 468 (if (and (not force)
463 (pcase-dolist (`(,artgroup . ,artids) (ids-by-group articles)) 469 (not nnselect-allow-ephemeral-expiry)
464 (let ((artlist (sort (mapcar #'cdr artids) #'<))) 470 (gnus-ephemeral-group-p (nnselect-add-prefix group)))
465 (unless (gnus-check-backend-function 'request-expire-articles 471 articles
466 artgroup) 472 (pcase-dolist (`(,artgroup . ,artids) (ids-by-group articles))
467 (error "Group %s does not support article expiration" artgroup)) 473 (let ((artlist (sort (mapcar #'cdr artids) #'<)))
468 (unless (gnus-check-server (gnus-find-method-for-group artgroup)) 474 (unless
469 (error "Couldn't open server for group %s" artgroup)) 475 (gnus-check-backend-function 'request-expire-articles artgroup)
470 (push (mapcar (lambda (art) 476 (error "Group %s does not support article expiration" artgroup))
471 (car (rassq art artids))) 477 (unless (gnus-check-server (gnus-find-method-for-group artgroup))
472 (let ((nnimap-expunge 'immediately)) 478 (error "Couldn't open server for group %s" artgroup))
473 (gnus-request-expire-articles 479 (setq not-deleted
474 artlist artgroup force))) 480 (append
475 not-expired))) 481 (mapcar (lambda (art) (car (rassq art artids)))
476 (sort (delq nil not-expired) #'<)) 482 (gnus-request-expire-articles artlist artgroup
477 articles)) 483 force))
484 not-deleted))))
485 (sort (delq nil not-deleted) #'<))))
478 486
479 487
480(deffoo nnselect-warp-to-article () 488(deffoo nnselect-warp-to-article ()