X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnnmail.el;h=c4a347fad8b27c97d00e7814188de9436cc14117;hb=2ce8d66354a55ca69721c6833e2b50352aa4b49a;hp=0abb9e3c343b31a08b8a1297fc1251b13b670cfa;hpb=c21dcaafa9a64f42d036891a08bc95ff2329fe3e;p=gnus diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 0abb9e3c3..c4a347fad 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 +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -36,9 +36,8 @@ (require 'mm-util) (eval-and-compile - (autoload 'gnus-error "gnus-util") - (autoload 'gnus-buffer-live-p "gnus-util") - (autoload 'gnus-add-buffer "gnus")) + (autoload 'gnus-add-buffer "gnus") + (autoload 'gnus-kill-buffer "gnus")) (defgroup nnmail nil "Reading mail with Gnus." @@ -167,10 +166,10 @@ can also be `immediate' and `never'." (defcustom nnmail-expiry-wait-function nil "Variable that holds function to specify how old articles should be before they are expired. - The function will be called with the name of the group that the -expiry is to be performed in, and it should return an integer that -says how many days an article can be stored before it is considered -\"old\". It can also return the values `never' and `immediate'. +The function will be called with the name of the group that the expiry +is to be performed in, and it should return an integer that says how +many days an article can be stored before it is considered \"old\". +It can also return the values `never' and `immediate'. Eg.: @@ -350,6 +349,11 @@ discarded after running the split process." :group 'nnmail-split :type 'hook) +(defcustom nnmail-spool-hook nil + "*A hook called when a new article is spooled." + :group 'nnmail + :type 'hook) + (defcustom nnmail-large-newsgroup 50 "*The number of the articles which indicates a large newsgroup or nil. If the number of the articles is greater than the value, verbose @@ -1012,7 +1016,12 @@ FUNC will be called with the group name to determine the article number." (erase-buffer) (insert-buffer-substring obuf) ;; Narrow to headers. - (mail-narrow-to-head) + (narrow-to-region + (goto-char (point-min)) + (if (search-forward "\n\n" nil t) + (point) + (point-max))) + (goto-char (point-min)) ;; Decode MIME headers and charsets. (when nnmail-mail-splitting-decodes (let ((mail-parse-charset nnmail-mail-splitting-charset)) @@ -1104,6 +1113,7 @@ FUNC will be called with the group name to determine the article number." (goto-char (point-min)) (gnus-configure-windows 'split-trace) (set-buffer restore))) + (widen) ;; See whether the split methods returned `junk'. (if (equal group-art '(junk)) nil @@ -1113,8 +1123,7 @@ FUNC will be called with the group name to determine the article number." (let (elem) (while (setq elem (car (memq 'junk group-art))) (setq group-art (delq elem group-art))) - (nreverse group-art)))) - (widen)))) + (nreverse group-art))))))) (defun nnmail-insert-lines () "Insert how many lines there are in the body of the mail. @@ -1323,7 +1332,7 @@ See the documentation for the variable `nnmail-split-fancy' for details." ;; correct match positions. (re-search-backward value start-of-value)) (dolist (sp (nnmail-split-it (car split-rest))) - (unless (memq sp split-result) + (unless (member sp split-result) (push sp split-result)))))) split-result)) @@ -1468,13 +1477,15 @@ See the documentation for the variable `nnmail-split-fancy' for details." nnmail-message-id-cache-file nil 'silent) (set-buffer-modified-p nil) (setq nnmail-cache-buffer nil) - (kill-buffer (current-buffer))))) + (gnus-kill-buffer (current-buffer))))) ;; Compiler directives. (defvar group) (defvar group-art-list) (defvar group-art) (defun nnmail-cache-insert (id grp) + (run-hook-with-args 'nnmail-spool-hook + id grp) (when nnmail-treat-duplicates ;; Store some information about the group this message is written ;; to. This is passed in as the grp argument -- all locations this @@ -1877,7 +1888,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." "Remove all instances of GROUP from `nnmail-split-history'." (let ((history nnmail-split-history)) (while history - (setcar history (gnus-delete-if (lambda (e) (string= (car e) group)) + (setcar history (gnus-remove-if (lambda (e) (string= (car e) group)) (car history))) (pop history)) (setq nnmail-split-history (delq nil nnmail-split-history))))