;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
;; Katsumi Yamaoka <yamaoka@jpl.org>
+;; Kiyokazu SUTO <suto@merry.xmath.ous.ac.jp>
;; Keywords: mail, news, MIME
;; This file is part of GNU Emacs.
(gnus-summary-followup (gnus-summary-work-articles arg) t))
(defun gnus-inews-yank-articles (articles)
- (let ((frame (when (and message-use-multi-frames
- (> (length articles) 1))
- (window-frame (get-buffer-window (current-buffer)))))
- beg article)
+ (let* ((more-than-one (> (length articles) 1))
+ (frame (when (and message-use-multi-frames more-than-one)
+ (window-frame (get-buffer-window (current-buffer)))))
+ (refs "")
+ beg article references)
(message-goto-body)
(while (setq article (pop articles))
(save-window-excursion
(gnus-summary-remove-process-mark article))
(when frame
(select-frame frame))
- (gnus-copy-article-buffer)
+
+ ;; 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") "")
+ " ")))))
+
(let ((message-reply-buffer gnus-article-copy)
(message-reply-headers gnus-current-headers))
(message-yank-original)
(when articles
(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
+ (save-restriction
+ (message-narrow-to-headers)
+ (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-fill-references)))
+ (list (cons 'References
+ (mapconcat 'identity references " "))))
+ (backward-delete-char 1)))
+
(goto-char beg)))
(defun gnus-summary-cancel-article (&optional n symp)
"Digest and forwards all articles in this series to a newsgroup."
(interactive "P")
(gnus-summary-mail-digest n t))
-
+
(defun gnus-summary-resend-message (address n)
"Resend the current article to ADDRESS."
(interactive "sResend message(s) to: \nP")
;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
;; Keiichi Suzuki <kei-suzu@mail.wbs.ne.jp>
+;; Tatsuya Ichikawa <t-ichi@po.shiojiri.ne.jp>
;; Katsumi Yamaoka <yamaoka@jpl.org>
;; Keywords: mail, news, MIME
:group 'message-forwarding
:type 'boolean)
-(defcustom message-ignored-resent-headers "^Return-receipt"
+(defcustom message-ignored-resent-headers "^Return-Receipt"
"*All headers that match this regexp will be deleted when resending a message."
:group 'message-interface
:type 'regexp)
:type 'string
:group 'message-insertion)
+(defcustom message-yank-add-new-references t
+ "*Non-nil means new IDs will be added to \"References\" field when an
+article is yanked by the command `message-yank-original' interactively."
+ :type 'boolean
+ :group 'message-insertion)
+
(defcustom message-indentation-spaces 3
"*Number of spaces to insert at the beginning of each cited line.
Used by `message-yank-original' via `message-yank-cite'."
This function uses `message-cite-function' to do the actual citing.
Just \\[universal-argument] as argument means don't indent, insert no
-prefix, and don't delete any headers."
+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."
(interactive "P")
(let ((modified (buffer-modified-p))
- (buffer (message-eval-parameter message-reply-buffer)))
+ (buffer (message-eval-parameter message-reply-buffer))
+ refs references)
(when (and buffer
message-cite-function)
(delete-windows-on buffer t)
- (insert-buffer buffer)
+ (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-fill-references)))
+ (list (cons 'References
+ (mapconcat 'identity references " "))))
+ (backward-delete-char 1))))))
+
(funcall message-cite-function)
(message-exchange-point-and-mark)
(unless (bolp)