From 883679dde80700322e5a316102b47812d824bad5 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sat, 27 Jul 2019 09:11:04 -0700 Subject: [PATCH] Adjust location of Gnus group split setup process Updating group splits requires the gnus-newsrc-hashtb to be initialized. Previously this failed silently, now it errors. * lisp/gnus/gnus-mlspl.el (gnus-group-split-setup): Don't call the update when loading the user's init file, that's too early. Use appropriate hooks depending on AUTO-UPDATE. * doc/misc/gnus.texi (Group Mail Splitting): Change mention in docs. --- doc/misc/gnus.texi | 2 +- lisp/gnus/gnus-mlspl.el | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index cc6873cfcb4..3968fa58377 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -15720,7 +15720,7 @@ you. For example, add to your @file{~/.gnus.el}: @end lisp If @var{auto-update} is non-@code{nil}, @code{gnus-group-split-update} -will be added to @code{nnmail-pre-get-new-mail-hook}, so you won't ever +will be added to @code{gnus-get-top-new-news-hook}, so you won't ever have to worry about updating @code{nnmail-split-fancy} again. If you don't omit @var{catch-all} (it's optional, equivalent to @code{nil}), @code{gnus-group-split-default-catch-all-group} will be set to its diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el index e9c0de968b3..74e132b7a48 100644 --- a/lisp/gnus/gnus-mlspl.el +++ b/lisp/gnus/gnus-mlspl.el @@ -48,7 +48,7 @@ group parameters. If AUTO-UPDATE is non-nil (prefix argument accepted, if called interactively), it makes sure nnmail-split-fancy is re-computed before getting new mail, by adding `gnus-group-split-update' to -`nnmail-pre-get-new-mail-hook'. +`gnus-get-top-new-news-hook'. A non-nil CATCH-ALL replaces the current value of `gnus-group-split-default-catch-all-group'. This variable is only used @@ -64,9 +64,14 @@ match any of the group-specified splitting rules. See (setq nnmail-split-methods 'nnmail-split-fancy) (when catch-all (setq gnus-group-split-default-catch-all-group catch-all)) - (gnus-group-split-update) - (when auto-update - (add-hook 'nnmail-pre-get-new-mail-hook 'gnus-group-split-update))) + (add-hook + (if auto-update + 'gnus-get-top-new-news-hook + ;; Split updating requires `gnus-newsrc-hashtb' to be + ;; initialized; the read newsrc hook is the only hook that comes + ;; after initialization, but before checking for new news. + 'gnus-read-newsrc-el-hook) + #'gnus-group-split-update)) ;;;###autoload (defun gnus-group-split-update (&optional catch-all) -- 2.39.2