X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fnnmail.el;h=c3b53048a6bd7507850112278175e51dc4f6e6d3;hb=8047583c8c86a5c6a61bddc27b391042e39e1ce5;hp=2e5d87a0935b428c02b2113dcf62deb3113fc449;hpb=ea2f43b386c1bdd005351eacbecf47ed2f60fd77;p=elisp%2Fgnus.git- diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 2e5d87a..c3b5304 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1,5 +1,5 @@ ;;; nnmail.el --- mail support functions for the Gnus mail backends -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -31,7 +31,6 @@ (require 'gnus) ; for macro gnus-kill-buffer, at least (require 'nnheader) (require 'message) -(require 'custom) (require 'gnus-util) (require 'mail-source) @@ -223,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") @@ -381,12 +381,8 @@ This is copy of the `lazy' widget in Emacs 21.4 provided for compatibility." (widget-apply (car (widget-get widget :children)) :value-inline)) :default-get (lambda (widget) - ;;(widget-default-get - ;; (widget-convert (widget-get widget :type)))) - ;; `widget-default-get' isn't available in Mule 2. - (let ((w (widget-convert (widget-get widget :type)))) - (or (widget-get w :value) - (widget-apply w :default-get)))) + (widget-default-get + (widget-convert (widget-get widget :type)))) :match (lambda (widget value) (widget-apply (widget-convert (widget-get widget :type)) :match value)) @@ -470,7 +466,7 @@ FIELD must match a complete field name. VALUE must match a complete word according to the `nnmail-split-fancy-syntax-table' syntax table. You can use \".*\" in the regexps to match partial field names or words. -FIELD and VALUE can also be lisp symbols, in that case they are expanded +FIELD and VALUE can also be Lisp symbols, in that case they are expanded as specified in `nnmail-split-abbrev-alist'. GROUP can contain \\& and \\N which will substitute from matching @@ -561,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) @@ -578,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*" @@ -622,8 +627,7 @@ by anything." (after-insert-file-functions nil)) (condition-case () (let ((auto-mode-alist (nnheader-auto-mode-alist)) - (file-name-coding-system nnmail-pathname-coding-system) - (pathname-coding-system nnmail-pathname-coding-system)) + (file-name-coding-system nnmail-pathname-coding-system)) (insert-file-contents-as-coding-system nnmail-file-coding-system file) t) @@ -671,7 +675,7 @@ nn*-request-list should have been called before calling this function." (while (not (eobp)) (condition-case err (progn - (narrow-to-region (point) (gnus-point-at-eol)) + (narrow-to-region (point) (point-at-eol)) (setq group (read buffer)) (unless (stringp group) (setq group (symbol-name group))) @@ -689,8 +693,7 @@ nn*-request-list should have been called before calling this function." (defun nnmail-save-active (group-assoc file-name) "Save GROUP-ASSOC in ACTIVE-FILE." - (let ((coding-system-for-write nnmail-active-file-coding-system) - (output-coding-system nnmail-active-file-coding-system)) + (let ((coding-system-for-write nnmail-active-file-coding-system)) (when file-name (with-temp-file file-name (nnmail-generate-active group-assoc))))) @@ -1110,7 +1113,7 @@ FUNC will be called with the group name to determine the article number." (while (not (eobp)) (unless (< (move-to-column nnmail-split-header-length-limit) nnmail-split-header-length-limit) - (delete-region (point) (gnus-point-at-eol))) + (delete-region (point) (point-at-eol))) (forward-line 1)) ;; Allow washing. (goto-char (point-min)) @@ -1312,12 +1315,8 @@ to actually put the message in the right group." (defun nnmail-split-fancy () "Fancy splitting method. See the documentation for the variable `nnmail-split-fancy' for details." - (let ((syntab (syntax-table))) - (unwind-protect - (progn - (set-syntax-table nnmail-split-fancy-syntax-table) - (nnmail-split-it nnmail-split-fancy)) - (set-syntax-table syntab)))) + (with-syntax-table nnmail-split-fancy-syntax-table + (nnmail-split-it nnmail-split-fancy))) (defvar nnmail-split-cache nil) ;; Alist of split expressions their equivalent regexps. @@ -1474,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 @@ -1619,7 +1621,7 @@ See the documentation for the variable `nnmail-split-fancy' for details." (skip-chars-forward "^\n\r\t") (unless (looking-at "[\r\n]") (forward-char 1) - (buffer-substring (point) (gnus-point-at-eol))))))) + (buffer-substring (point) (point-at-eol))))))) ;; Function for nnmail-split-fancy: look up all references in the ;; cache and if a match is found, return that group. @@ -1889,8 +1891,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (defun nnmail-write-region (start end filename &optional append visit lockname) "Do a `write-region', and then set the file modes." - (let ((file-name-coding-system nnmail-pathname-coding-system) - (pathname-coding-system nnmail-pathname-coding-system)) + (let ((file-name-coding-system nnmail-pathname-coding-system)) (write-region-as-coding-system nnmail-file-coding-system start end filename append visit lockname) (set-file-modes filename nnmail-default-file-modes)))