;;; nnmail.el --- mail support functions for the Gnus mail backends
-;; Copyright (C) 1995-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2015 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news, mail
;;; 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
(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"
((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)
;; 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))
(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))))))
;; 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)
(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)
((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)))
+ (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)) "")))))