diff lisp/gnus/message.el @ 118:7d55a9ba150c r20-1b11

Import from CVS: tag r20-1b11
author cvs
date Mon, 13 Aug 2007 09:24:17 +0200
parents 9f59509498e1
children cca96a509cfe
line wrap: on
line diff
--- a/lisp/gnus/message.el	Mon Aug 13 09:23:08 2007 +0200
+++ b/lisp/gnus/message.el	Mon Aug 13 09:24:17 2007 +0200
@@ -928,6 +928,19 @@
     (when value
       (nnheader-replace-chars-in-string value ?\n ? ))))
 
+(defun message-add-header (&rest headers)
+  "Add the HEADERS to the message header, skipping those already present."
+  (while headers
+    (let (hclean)
+      (unless (string-match "^\\([^:]+\\):[ \t]*[^ \t]" (car headers))
+	(error "Invalid header `%s'" (car headers)))
+      (setq hclean (match-string 1 (car headers)))
+    (save-restriction
+      (message-narrow-to-headers)
+      (unless (re-search-forward (concat "^" (regexp-quote hclean) ":") nil t)
+	(insert (car headers) ?\n))))
+    (setq headers (cdr headers))))
+
 (defun message-fetch-reply-field (header)
   "Fetch FIELD from the message we're replying to."
   (when (and message-reply-buffer
@@ -948,7 +961,8 @@
 (defun message-functionp (form)
   "Return non-nil if FORM is funcallable."
   (or (and (symbolp form) (fboundp form))
-      (and (listp form) (eq (car form) 'lambda))))
+      (and (listp form) (eq (car form) 'lambda))
+      (compiled-function-p form)))
 
 (defun message-strip-subject-re (subject)
   "Remove \"Re:\" from subject lines."
@@ -1316,7 +1330,7 @@
 (defun message-insert-to ()
   "Insert a To header that points to the author of the article being replied to."
   (interactive)
-  (let ((co (message-fetch-field "courtesy-copies-to")))
+  (let ((co (message-fetch-field "mail-copies-to")))
     (when (and co
 	       (equal (downcase co) "never"))
       (error "The user has requested not to have copies sent via mail")))
@@ -3005,7 +3019,7 @@
 	      (message-set-work-buffer)
 	      (unless never-mct
 		(insert (or reply-to from "")))
-	      (insert (if (bolp) "" ", ") (or to ""))
+	      (insert (if to (concat (if (bolp) "" ", ") to "") ""))
 	      (insert (if mct (concat (if (bolp) "" ", ") mct) ""))
 	      (insert (if cc (concat (if (bolp) "" ", ") cc) ""))
 	      (goto-char (point-min))
@@ -3378,8 +3392,7 @@
 	     (forward-line 2))
 	(and (re-search-forward message-unsent-separator nil t)
 	     (forward-line 1))
-	(and (search-forward "\n\n" nil t)
-	     (re-search-forward "^Return-Path:.*\n" nil t)))
+	(re-search-forward "^Return-Path:.*\n" nil t))
     ;; We remove everything before the bounced mail.
     (delete-region
      (point-min)