+ (insert-buffer buffer) ; mark will be set at the end of article.
+
+ ;; Add new IDs to References field.
+ (when (and message-yank-add-new-references (interactive-p))
+ (save-excursion
+ (save-restriction
+ (narrow-to-region (point) (mark t))
+ (message-narrow-to-head)
+ (setq refs (concat (or (message-fetch-field "References") "")
+ " "
+ (or (message-fetch-field "Message-ID") "")))
+ (unless (string-match "^ +$" refs)
+ (widen)
+ (message-narrow-to-headers)
+ (setq references (message-fetch-field "References"))
+ (when references
+ (setq references (split-string references)))
+ (mapcar
+ (lambda (ref)
+ (or (zerop (length ref))
+ (member ref references)
+ (setq references (append references (list ref)))))
+ (split-string refs))
+ (when references
+ (goto-char (point-min))
+ (let ((case-fold-search t))
+ (if (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-shorten-references)))
+ (list (cons 'References
+ (mapconcat 'identity references " "))))
+ (backward-delete-char 1))))))
+