* Append SUTO-san to the authors list.
[elisp/gnus.git-] / lisp / gnus-msg.el
index f72d759..c4bf6bf 100644 (file)
@@ -352,11 +352,10 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
   (gnus-summary-followup (gnus-summary-work-articles arg) t))
 
 (defun gnus-inews-yank-articles (articles)
-  (let* ((more-than-one (> (length articles) 1))
+  (let* ((more-than-one (cdr articles))
         (frame (when (and message-use-multi-frames more-than-one)
                  (window-frame (get-buffer-window (current-buffer)))))
-        (refs "")
-        beg article references)
+        refs beg article)
     (message-goto-body)
     (while (setq article (pop articles))
       (save-window-excursion
@@ -368,16 +367,12 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
 
       ;; Gathering references.
       (when more-than-one
-       (save-current-buffer
-         (set-buffer (gnus-copy-article-buffer))
-         (save-restriction
-           (message-narrow-to-head)
-           (setq refs (concat refs
-                              (or (message-fetch-field "references") "")
-                              " "
-                              (or (message-fetch-field "message-id") "")
-                              " ")))))
+       (setq refs (message-list-references
+                   refs
+                   (mail-header-references gnus-current-headers)
+                   (mail-header-message-id gnus-current-headers))))
 
+      (gnus-copy-article-buffer)
       (let ((message-reply-buffer gnus-article-copy)
            (message-reply-headers gnus-current-headers))
        (message-yank-original)
@@ -386,17 +381,9 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
        (insert "\n")))
     (push-mark)
 
-    ;; Eliminate duplicated references.
-    (unless (string-match "^ *$" refs)
-      (mapcar
-       (lambda (ref)
-        (or (zerop (length ref))
-            (member ref references)
-            (setq references (append references (list ref)))))
-       (split-string refs)))
-
     ;; Replace with the gathered references.
-    (when references
+    (when refs
+      (push-mark beg)
       (save-restriction
        (message-narrow-to-headers)
        (let ((case-fold-search t))
@@ -407,8 +394,10 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
         (list (or (assq 'References message-header-format-alist)
                   '(References . message-shorten-references)))
         (list (cons 'References
-                    (mapconcat 'identity references " "))))
-       (backward-delete-char 1)))
+                    (mapconcat 'identity (nreverse refs) " "))))
+       (backward-delete-char 1))
+      (setq beg (mark t))
+      (pop-mark))
 
     (goto-char beg)))