X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=lisp%2Fnnmail.el;h=d1a0455a1b04eb0504354abfc0eec4c17a922c53;hp=239bcbf5c874c337c594a70735b09c0c5b95a118;hb=9850b9927df1b942efb2ed75c5055857a51b0251;hpb=8d89ec3968f7109ddc9795c2309706b6e92a89b1 diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 239bcbf5c..d1a0455a1 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1,6 +1,6 @@ ;;; nnmail.el --- mail support functions for the Gnus mail backends -;; Copyright (C) 1995-2011 Free Software Foundation, Inc. +;; Copyright (C) 1995-2014 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: news, mail @@ -24,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 @@ -40,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." @@ -177,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) @@ -289,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 () @@ -372,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" @@ -553,11 +551,11 @@ parameter. It should return nil, `warn' or `delete'." (const warn) (const delete))) -(defcustom nnmail-extra-headers '(To Newsgroups) +(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 "21.1" + :version "24.3" :group 'nnmail :type '(repeat symbol)) @@ -1395,7 +1393,7 @@ See the documentation for the variable `nnmail-split-fancy' for details." ((stringp split) (when nnmail-split-tracing (push split nnmail-split-trace)) - (list (nnmail-expand-newtext split))) + (list (nnmail-expand-newtext split t))) ;; Junk the message. ((eq split 'junk) @@ -1428,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)) @@ -1462,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)))))) @@ -1516,7 +1513,7 @@ See the documentation for the variable `nnmail-split-fancy' for details." ;; on the same split, which will find it immediately in the cache. (nnmail-split-it split)))))) -(defun nnmail-expand-newtext (newtext) +(defun nnmail-expand-newtext (newtext &optional fancyp) (let ((len (length newtext)) (pos 0) c expanded beg N did-expand) @@ -1541,6 +1538,10 @@ See the documentation for the variable `nnmail-split-fancy' for details." (if (= c ?\&) (setq N 0) (setq N (- c ?0))) + ;; We wrapped the searches in parentheses, so we have to + ;; add some parentheses here... + (when fancyp + (setq N (+ N 3))) (when (match-beginning N) (push (if nnmail-split-lowercase-expanded (downcase (buffer-substring (match-beginning N) @@ -1799,7 +1800,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)) @@ -1856,7 +1857,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (nnmail-get-split-group orig-file ',source))) ',(intern (format "%s-active-number" method)))))) - (error + ((error quit) (message "Mail source %s failed: %s" source cond) 0))) (incf total new) @@ -1950,9 +1951,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)