Synch to No Gnus 200409231508.
[elisp/gnus.git-] / lisp / nnmail.el
index e71afe7..c3b5304 100644 (file)
@@ -222,6 +222,7 @@ From header will be expired to the group \"nnfolder:Work\";
 articles containing the sting \"IMPORTANT\" in the Subject header will
 be expired to the group \"nnfolder:IMPORTANT.YYYY.MMM\"; and
 everything else will be expired to \"nnfolder:Archive-YYYY\"."
+  :version "21.4"
   :group 'nnmail-expire
   :type '(repeat (list (choice :tag "Match against"
                               (string :tag "Header")
@@ -556,11 +557,13 @@ parameter.  It should return nil, `warn' or `delete'."
 
 (defcustom nnmail-mail-splitting-charset nil
   "Default charset to be used when splitting incoming mail."
+  :version "21.4"
   :group 'nnmail
   :type 'symbol)
 
 (defcustom nnmail-mail-splitting-decodes t
   "Whether the nnmail splitting functionality should MIME decode headers."
+  :version "21.4"
   :group 'nnmail
   :type 'boolean)
 
@@ -573,6 +576,13 @@ by anything."
   :group 'nnmail
   :type 'boolean)
 
+(defcustom nnmail-split-lowercase-expanded t
+  "Whether to lowercase expanded entries (i.e. \\N) when splitting mails.
+This avoids the creation of multiple groups when users send to an address
+using different case (i.e. mailing-list@domain vs Mailing-List@Domain)."
+  :group 'nnmail
+  :type 'boolean)
+
 ;;; Internal variables.
 
 (defvar nnmail-article-buffer " *nnmail incoming*"
@@ -1463,7 +1473,10 @@ See the documentation for the variable `nnmail-split-fancy' for details."
              (setq N 0)
            (setq N (- c ?0)))
          (when (match-beginning N)
-           (push (buffer-substring (match-beginning N) (match-end N))
+           (push (if nnmail-split-lowercase-expanded
+                     (downcase (buffer-substring (match-beginning N)
+                                                 (match-end N)))
+                   (buffer-substring (match-beginning N) (match-end N)))
                  expanded))))
       (setq pos (1+ pos)))
     (if did-expand
@@ -1569,16 +1582,15 @@ See the documentation for the variable `nnmail-split-fancy' for details."
       (save-excursion
        (set-buffer nnmail-cache-buffer)
        (goto-char (point-max))
-       (if (and grp (not (string= "" grp)))
+       (if (and grp (not (string= "" grp))
+                (gnus-methods-equal-p gnus-command-method
+                                      (nnmail-cache-primary-mail-backend)))
            (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))
-               (if (gnus-methods-equal-p gnus-command-method
-                                         (nnmail-cache-primary-mail-backend))
-                   (insert id "\t" grp "\n")
-                 (insert id "\n"))))
+               (insert id "\t" grp "\n")))
          (insert id "\n"))))))
   
 (defun nnmail-cache-primary-mail-backend ()