diff options
author | Andrew G Cohen <cohen@andy.bu.edu> | 2022-03-04 16:20:01 +0800 |
---|---|---|
committer | Andrew G Cohen <cohen@andy.bu.edu> | 2022-03-04 16:20:01 +0800 |
commit | 62d97d4afd4a13cb2cd0f7eacbc4b5af1d620cf7 (patch) | |
tree | 08f020dd66efe809f71993da7b4d16eadbb562b6 /lisp | |
parent | 4f6583ab8a6f1f8e2329bf0b683277101447948d (diff) | |
download | emacs-62d97d4afd4a13cb2cd0f7eacbc4b5af1d620cf7.tar.gz emacs-62d97d4afd4a13cb2cd0f7eacbc4b5af1d620cf7.tar.bz2 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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/gnus/nnselect.el | 44 |
1 files changed, 26 insertions, 18 deletions
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 (define-obsolete-variable-alias 'nnir-retrieve-headers-override-function '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 "A function that retrieves article headers for ARTICLES from GROUP. 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))))) (deffoo nnselect-request-expire-articles - (articles _group &optional _server force) - (if force - (let (not-expired) - (pcase-dolist (`(,artgroup . ,artids) (ids-by-group articles)) - (let ((artlist (sort (mapcar #'cdr artids) #'<))) - (unless (gnus-check-backend-function 'request-expire-articles - artgroup) - (error "Group %s does not support article expiration" artgroup)) - (unless (gnus-check-server (gnus-find-method-for-group artgroup)) - (error "Couldn't open server for group %s" artgroup)) - (push (mapcar (lambda (art) - (car (rassq art artids))) - (let ((nnimap-expunge 'immediately)) - (gnus-request-expire-articles - artlist artgroup force))) - not-expired))) - (sort (delq nil not-expired) #'<)) - articles)) + (articles group &optional _server force) + (let ((nnimap-expunge 'immediately) not-deleted) + (if (and (not force) + (not nnselect-allow-ephemeral-expiry) + (gnus-ephemeral-group-p (nnselect-add-prefix group))) + articles + (pcase-dolist (`(,artgroup . ,artids) (ids-by-group articles)) + (let ((artlist (sort (mapcar #'cdr artids) #'<))) + (unless + (gnus-check-backend-function 'request-expire-articles artgroup) + (error "Group %s does not support article expiration" artgroup)) + (unless (gnus-check-server (gnus-find-method-for-group artgroup)) + (error "Couldn't open server for group %s" artgroup)) + (setq not-deleted + (append + (mapcar (lambda (art) (car (rassq art artids))) + (gnus-request-expire-articles artlist artgroup + force)) + not-deleted)))) + (sort (delq nil not-deleted) #'<)))) (deffoo nnselect-warp-to-article () |