X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnnmail.el;h=d88a1bf1580645b921786c2d6d33998b191b372e;hb=3ab4faecaf6eefd16142e072f29edf2af25c5e21;hp=8ccd7b02a16ff3e084f2fb71ce439b89ae523697;hpb=ff79efac756f360c9a48b292b4619699fe19d057;p=gnus diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 8ccd7b02a..d88a1bf15 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1,7 +1,6 @@ ;;; nnmail.el --- mail support functions for the Gnus mail backends -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1995-2014 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: news, mail @@ -25,10 +24,6 @@ ;;; Code: -;; For Emacs <22.2 and XEmacs. -(eval-and-compile - (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) - (eval-when-compile (require 'cl)) (require 'gnus) ; for macro gnus-kill-buffer, at least @@ -41,6 +36,8 @@ (autoload 'gnus-add-buffer "gnus") (autoload 'gnus-kill-buffer "gnus") +(eval-when-compile + (autoload 'mail-send-and-exit "sendmail" nil t)) (defgroup nnmail nil "Reading mail with Gnus." @@ -178,7 +175,7 @@ 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.: +E.g.: \(setq nnmail-expiry-wait-function (lambda (newsgroup) @@ -290,7 +287,7 @@ directory. This hook is called after the incoming mail box has been emptied, and can be used to call any mail box programs you have running (\"xwatch\", etc.) -Eg. +E.g.: \(add-hook 'nnmail-read-incoming-hook (lambda () @@ -373,7 +370,7 @@ messages will be shown to indicate the current status." (number :tag "count"))) (define-widget 'nnmail-lazy 'default - "Base widget for recursive datastructures. + "Base widget for recursive data structures. This is copy of the `lazy' widget in Emacs 22.1 provided for compatibility." :format "%{%t%}: %v" @@ -554,9 +551,11 @@ parameter. It should return nil, `warn' or `delete'." (const warn) (const delete))) -(defcustom nnmail-extra-headers '(To Newsgroups) - "*Extra headers to parse." - :version "21.1" +(defcustom nnmail-extra-headers '(To Newsgroups Cc) + "Extra headers to parse. +In addition to the standard headers, these extra headers will be +included in NOV headers (and the like) when backends parse headers." + :version "24.3" :group 'nnmail :type '(repeat symbol)) @@ -1149,6 +1148,7 @@ FUNC will be called with the group name to determine the article number." (setq nnmail-split-trace nil)) (if (or (and (symbolp nnmail-split-methods) (fboundp nnmail-split-methods)) + (not (consp (car-safe nnmail-split-methods))) (and (listp nnmail-split-methods) ;; Not a regular split method, so it has to be a ;; fancy one. @@ -1215,7 +1215,8 @@ FUNC will be called with the group name to determine the article number." ;; This is the final group, which is used as a ;; catch-all. (when (and (not group-art) - (not nnmail-inhibit-default-split-group)) + (or (equal "" (nth 1 method)) + (not nnmail-inhibit-default-split-group))) (setq group-art (list (cons (car method) (funcall func (car method)))))))) @@ -1347,7 +1348,7 @@ Eudora has a broken References line, but an OK In-Reply-To." ;;; Utility functions (declare-function gnus-activate-group "gnus-start" - (group &optional scan dont-check method)) + (group &optional scan dont-check method dont-sub-check)) (defun nnmail-do-request-post (accept-func &optional server) "Utility function to directly post a message to an nnmail-derived group. @@ -1425,12 +1426,14 @@ See the documentation for the variable `nnmail-split-fancy' for details." ;; Check the cache for the regexp for this split. ((setq cached-pair (assq split nnmail-split-cache)) (let (split-result + match-data (end-point (point-max)) (value (nth 1 split))) (if (symbolp value) (setq value (cdr (assq value nnmail-split-abbrev-alist)))) (while (and (goto-char end-point) (re-search-backward (cdr cached-pair) nil t)) + (setq match-data (match-data)) (when nnmail-split-tracing (push split nnmail-split-trace)) (let ((split-rest (cddr split)) @@ -1459,12 +1462,9 @@ See the documentation for the variable `nnmail-split-fancy' for details." (setq split-rest (cddr split-rest)))) (when split-rest (goto-char end) - (let ((value (nth 1 split))) - (if (symbolp value) - (setq value (cdr (assq value nnmail-split-abbrev-alist)))) - ;; Someone might want to do a \N sub on this match, so get the - ;; correct match positions. - (re-search-backward value start-of-value)) + ;; Someone might want to do a \N sub on this match, so + ;; restore the match data. + (set-match-data match-data) (dolist (sp (nnmail-split-it (car split-rest))) (unless (member sp split-result) (push sp split-result)))))) @@ -1796,7 +1796,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (i 0) (new 0) (total 0) - incoming incomings source) + source) (when (and (nnmail-get-value "%s-get-new-mail" method) sources) (while (setq source (pop sources)) @@ -1839,18 +1839,23 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." ;; and fetch the mail from each. (while (setq source (pop fetching-sources)) (when (setq new - (mail-source-fetch - source - (gnus-byte-compile - `(lambda (file orig-file) - (nnmail-split-incoming - file ',(intern (format "%s-save-mail" method)) - ',spool-func - (or in-group - (if (equal file orig-file) - nil - (nnmail-get-split-group orig-file ',source))) - ',(intern (format "%s-active-number" method))))))) + (condition-case cond + (mail-source-fetch + source + (gnus-byte-compile + `(lambda (file orig-file) + (nnmail-split-incoming + file ',(intern (format "%s-save-mail" method)) + ',spool-func + (or in-group + (if (equal file orig-file) + nil + (nnmail-get-split-group orig-file + ',source))) + ',(intern (format "%s-active-number" method)))))) + ((error quit) + (message "Mail source %s failed: %s" source cond) + 0))) (incf total new) (incf i))) ;; If we did indeed read any incoming spools, we save all info. @@ -1914,8 +1919,9 @@ If TIME is nil, then return the cutoff time for oldness instead." (unless (eq target 'delete) (when (or (gnus-request-group target) (gnus-request-create-group target)) - (let ((group-art (gnus-request-accept-article target nil t t))) - (when (consp group-art) + (let ((group-art (gnus-request-accept-article target nil nil t))) + (when (and (consp group-art) + (cdr group-art)) (gnus-group-mark-article-read target (cdr group-art)))))))) (defun nnmail-fancy-expiry-target (group) @@ -1941,9 +1947,13 @@ If TIME is nil, then return the cutoff time for oldness instead." ((and (equal header 'to-from) (or (string-match (cadr regexp-target-pair) from) (and (string-match (cadr regexp-target-pair) to) - (let ((rmail-dont-reply-to-names - (message-dont-reply-to-names))) - (equal (rmail-dont-reply-to from) ""))))) + (let* ((mail-dont-reply-to-names + (message-dont-reply-to-names)) + (rmail-dont-reply-to-names ; obsolete since 24.1 + mail-dont-reply-to-names)) + (equal (if (fboundp 'rmail-dont-reply-to) + (rmail-dont-reply-to from) + (mail-dont-reply-to from)) ""))))) (setq target (format-time-string (caddr regexp-target-pair) date))) ((and (not (equal header 'to-from)) (string-match (cadr regexp-target-pair)