summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-07-03 17:11:06 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-07-11 18:37:32 -0700
commit11c3c66038d015383c72803ed73ded38ca1f33ac (patch)
treeb03ec6f9dec0805d49031f2aa9089d6da84bd051
parent92509cb792ab1b77b9a17df066d5aa5549c13499 (diff)
downloaddotfiles-11c3c66038d015383c72803ed73ded38ca1f33ac.tar.gz
add spw/guard-gnus-{group,summary}-catchup
-rw-r--r--.emacs.d/init.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index c72cb859..2c5e14f4 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -3355,6 +3355,25 @@ scroll through them."
(message "Not marking mail from processing views as read")
(gnus-summary-mark-read-and-unread-as-read))))
+(defun spw/guard-gnus-group-catchup (group &optional _all)
+ (when (string-prefix-p "nnselect:Process-" group)
+ (user-error "Cannot catch up processing views"))
+ (when (spw/all-group-process-view-ids group)
+ (error "This group contains articles from processing views")))
+(advice-add 'gnus-group-catchup :before #'spw/guard-gnus-group-catchup)
+
+(defun spw/guard-gnus-summary-catchup (&rest _ignore)
+ ;; `gnus-group-select-group' also calls `gnus-summary-catchup'.
+ (when (string-prefix-p "gnus-summary-catchup" (symbol-name this-command))
+ (when (spw/gnus-summary-processing-view-p)
+ (user-error "Cannot catch up processing views"))
+ ;; We could pay attention to the TO-HERE and REVERSE arguments and check
+ ;; only those IDs, though it'd be slower.
+ (unless (and spw/process-view-ids
+ (zerop (hash-table-count spw/process-view-ids)))
+ (error "This group/range may contain articles from processing views"))))
+(advice-add 'gnus-summary-catchup :before #'spw/guard-gnus-summary-catchup)
+
(defun spw/gnus-summary-mark-as-read-forward ()
(interactive)
(if (not (or (spw/gnus-summary-processing-view-p)