(gnus-advanced-integer): Swap arguments in
[gnus] / lisp / nnmail.el
index 2ac587e..b640ae8 100644 (file)
@@ -104,7 +104,8 @@ The last element should always have \"\" as the regexp.
 
 This variable can also have a function as its value."
   :group 'nnmail-split
-  :type '(choice (repeat :tag "Alist" (group (string :tag "Name") regexp))
+  :type '(choice (repeat :tag "Alist" (group (string :tag "Name")
+                                            (choice regexp function)))
                 (function-item nnmail-split-fancy)
                 (function :tag "Other")))
 
@@ -123,6 +124,15 @@ If nil, the first match found will be used."
                 (regexp :value ".*")
                 (repeat :value (".*") regexp)))
 
+(defcustom nnmail-cache-ignore-groups nil
+  "Regexp that matches group names to be ignored when inserting message
+ids into the cache (`nnmail-cache-insert').  This can also be a list
+of regexps."
+  :group 'nnmail-split
+  :type '(choice (const :tag "none" nil)
+                (regexp :value ".*")
+                (repeat :value (".*") regexp)))
+
 ;; Added by gord@enci.ucalgary.ca (Gordon Matzigkeit).
 (defcustom nnmail-keep-last-article nil
   "If non-nil, nnmail will never delete/move a group's last article.
@@ -1477,7 +1487,12 @@ See the documentation for the variable `nnmail-split-fancy' for documentation."
       (if (and grp (not (string= "" grp))
               (gnus-methods-equal-p gnus-command-method
                                     (nnmail-cache-primary-mail-backend)))
-         (insert id "\t" grp "\n")
+         (let ((regexp (if (consp nnmail-cache-ignore-groups)
+                           (mapconcat 'identity nnmail-cache-ignore-groups
+                                      "\\|")
+                         nnmail-cache-ignore-groups)))
+           (unless (and regexp (string-match regexp grp))
+             (insert id "\t" grp "\n")))
        (insert id "\n")))))
 
 (defun nnmail-cache-primary-mail-backend ()
@@ -1755,7 +1770,9 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
        (setq target (format-time-string (caddr regexp-target-pair) date)))
        ((and (not (equal header 'to-from))
             (string-match (cadr regexp-target-pair)
-                          (message-fetch-field header)))
+                          (or
+                           (message-fetch-field header)
+                           "")))
        (setq target
              (format-time-string (caddr regexp-target-pair) date)))))))