summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-mlspl.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus/gnus-mlspl.el')
-rw-r--r--lisp/gnus/gnus-mlspl.el39
1 files changed, 28 insertions, 11 deletions
diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el
index edc70667ba1..74e132b7a48 100644
--- a/lisp/gnus/gnus-mlspl.el
+++ b/lisp/gnus/gnus-mlspl.el
@@ -24,7 +24,6 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'gnus)
(require 'gnus-sum)
(require 'gnus-group)
@@ -49,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
@@ -65,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)
@@ -183,7 +187,8 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
(to-list (cdr (assoc 'to-list params)))
(extra-aliases (cdr (assoc 'extra-aliases params)))
(split-regexp (cdr (assoc 'split-regexp params)))
- (split-exclude (cdr (assoc 'split-exclude params))))
+ (split-exclude (cdr (assoc 'split-exclude params)))
+ (match-list (cdr (assoc 'match-list params))))
(when (or to-address to-list extra-aliases split-regexp)
;; regexp-quote to-address, to-list and extra-aliases
;; and add them all to split-regexp
@@ -203,16 +208,28 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
"\\|")
"\\)"))
;; Now create the new SPLIT
- (push (append
- (list 'any split-regexp)
+ (let ((split-regexp-with-list-ids
+ (replace-regexp-in-string "@" "[@.]" split-regexp t t))
+ (exclude
;; Generate RESTRICTs for SPLIT-EXCLUDEs.
(if (listp split-exclude)
(apply #'append
(mapcar (lambda (arg) (list '- arg))
split-exclude))
- (list '- split-exclude))
- (list group-clean))
- split)
+ (list '- split-exclude))))
+
+ (if match-list
+ ;; Match RFC2919 IDs or mail addresses
+ (push (append
+ (list 'list split-regexp-with-list-ids)
+ exclude
+ (list group-clean))
+ split)
+ (push (append
+ (list 'any split-regexp)
+ exclude
+ (list group-clean))
+ split)))
;; If it matches the empty string, it is a catch-all
(when (string-match split-regexp "")
(setq catch-all nil)))))))))