* message.el (message-yank-original): Check not only the References field but
authoryamaoka <yamaoka>
Mon, 24 Mar 2003 12:24:56 +0000 (12:24 +0000)
committeryamaoka <yamaoka>
Mon, 24 Mar 2003 12:24:56 +0000 (12:24 +0000)
 the `message-reply-headers' variable.

ChangeLog
lisp/message.el

index b316707..cf6061d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-24  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * lisp/message.el (message-yank-original): Check not only the
+       References field but the `message-reply-headers' variable.
+
 2003-03-18  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * lisp/gnus-vers.el: T-gnus 6.15.16 revision 00.
index 7abec7f..7c0d3d7 100644 (file)
@@ -3234,7 +3234,6 @@ to REFS-LIST."
       (push (pop saved-id) refs-list))
     refs-list))
 
-(defvar gnus-article-copy)
 (defun message-yank-original (&optional arg)
   "Insert the message being replied to, if any.
 Puts point before the text and mark after.
@@ -3248,51 +3247,61 @@ prefix, and don't delete any headers.
 
 In addition, if `message-yank-add-new-references' is non-nil and this
 command is called interactively, new IDs from the yanked article will
-be added to \"References\" field.
-\(See also `message-yank-add-new-references'.)"
+be added to the \"References\" field."
   (interactive "P")
-  (let ((modified (buffer-modified-p))
-       (buffer (message-eval-parameter message-reply-buffer))
-       start end refs)
-    (when (and buffer
-              message-cite-function)
-      (delete-windows-on buffer t)
-      (insert-buffer buffer) ; mark will be set at the end of article.
-      (setq start (point)
-           end (mark t))
-
-      ;; Add new IDs to References field.
-      (when (and message-yank-add-new-references (interactive-p))
-       (save-excursion
-         (save-restriction
-           (message-narrow-to-headers)
-           (setq refs (message-list-references
-                       nil
-                       (message-fetch-field "References")))
-           (widen)
-           (narrow-to-region start end)
-           (std11-narrow-to-header)
-           (when (setq refs (message-list-references
-                             refs
-                             (unless (eq message-yank-add-new-references
-                                         'message-id-only)
-                               (or (message-fetch-field "References")
-                                   (message-fetch-field "In-Reply-To")))
-                             (message-fetch-field "Message-ID")))
+  (let ((modified (buffer-modified-p)))
+    (when (let ((buffer (message-eval-parameter message-reply-buffer)))
+           (and buffer
+                message-cite-function
+                (prog1
+                    t
+                  (delete-windows-on buffer t)
+                  ; The mark will be set at the end of the article.
+                  (insert-buffer buffer))))
+      ;; Add new IDs to the References field.
+      (when (and message-yank-add-new-references
+                (interactive-p))
+       (let ((start (point))
+             (end (mark t))
+             refs newrefs)
+         (save-excursion
+           (save-restriction
              (widen)
-             (message-narrow-to-headers)
-             (goto-char (point-min))
-             (let ((case-fold-search t))
-               (if (re-search-forward "^References:\\([\t ]+.+\n\\)+" nil t)
+             (setq refs (message-list-references
+                         nil
+                         (or (message-make-references)
+                             (prog2
+                                 (message-narrow-to-headers)
+                                 (message-fetch-field "References")
+                               (widen)))))
+             (narrow-to-region start end)
+             (std11-narrow-to-header)
+             (unless (equal (setq newrefs
+                                  (message-list-references
+                                   (copy-sequence refs)
+                                   (unless (eq message-yank-add-new-references
+                                               'message-id-only)
+                                     (or (message-fetch-field "References")
+                                         (message-fetch-field "In-Reply-To")))
+                                   (message-fetch-field "Message-ID")))
+                            refs)
+               ;; If the References field has been changed, we make it
+               ;; visible in the header.
+               (mail-header-set-message-id message-reply-headers nil)
+               (mail-header-set-references message-reply-headers nil)
+               (widen)
+               (message-narrow-to-headers)
+               (if (let ((case-fold-search t))
+                     (re-search-forward "^References:\\([\t ]+.+\n\\)+"
+                                        nil t))
                    (replace-match "")
-                 (goto-char (point-max))))
-             (mail-header-format
-              (list (or (assq 'References message-header-format-alist)
-                        '(References . message-fill-references)))
-              (list (cons 'References
-                          (mapconcat 'identity (nreverse refs) " "))))
-             (backward-delete-char 1)))))
-
+                 (goto-char (point-max)))
+               (mail-header-format
+                (list (or (assq 'References message-header-format-alist)
+                          '(References . message-fill-references)))
+                (list (cons 'References (mapconcat 'identity
+                                                   (nreverse newrefs) " "))))
+               (backward-delete-char 1))))))
       (unless arg
        (if (and message-suspend-font-lock-when-citing
                 (boundp 'font-lock-mode)