+;;; based on vm-do-reply [vm-reply.el]
+(defun tm-vm/do-reply (buf to-all include-text)
+ (save-excursion
+ (set-buffer buf)
+ (let ((dir default-directory)
+ to cc subject mp in-reply-to references newsgroups)
+ (cond ((setq to
+ (let ((reply-to (std11-field-body "Reply-To")))
+ (if (vm-ignored-reply-to reply-to)
+ nil
+ reply-to))))
+ ((setq to (std11-field-body "From")))
+ ;; (t (error "No From: or Reply-To: header in message"))
+ )
+ (if to-all
+ (setq cc (delq nil (cons cc (std11-field-bodies '("To" "Cc"))))
+ cc (mapconcat 'identity cc ","))
+ )
+ (setq subject (std11-field-body "Subject"))
+ (and subject vm-reply-subject-prefix
+ (let ((case-fold-search t))
+ (not
+ (equal
+ (string-match (regexp-quote vm-reply-subject-prefix)
+ subject)
+ 0)))
+ (setq subject (concat vm-reply-subject-prefix subject)))
+ (setq in-reply-to (std11-field-body "Message-Id")
+ references (nconc
+ (std11-field-bodies '("References" "In-Reply-To"))
+ (list in-reply-to))
+ newsgroups (list (or (and to-all
+ (std11-field-body "Followup-To"))
+ (std11-field-body "Newsgroups"))))
+ (setq to (vm-parse-addresses to)
+ cc (vm-parse-addresses cc))
+ (if vm-reply-ignored-addresses
+ (setq to (vm-strip-ignored-addresses to)
+ cc (vm-strip-ignored-addresses cc)))
+ (setq to (vm-delete-duplicates to nil t))
+ (setq cc (vm-delete-duplicates
+ (append (vm-delete-duplicates cc nil t)
+ to (copy-sequence to))
+ t t))
+ (and to (setq to (mapconcat 'identity to ",\n ")))
+ (and cc (setq cc (mapconcat 'identity cc ",\n ")))
+ (and (null to) (setq to cc cc nil))
+ (setq references (delq nil references)
+ references (mapconcat 'identity references " ")
+ references (vm-parse references "[^<]*\\(<[^>]+>\\)")
+ references (vm-delete-duplicates references)
+ references (if references (mapconcat 'identity references "\n\t")))
+ (setq newsgroups (delq nil newsgroups)
+ newsgroups (mapconcat 'identity newsgroups ",")
+ newsgroups (vm-parse newsgroups "[ \t\f\r\n,]*\\([^ \t\f\r\n,]+\\)")
+ newsgroups (vm-delete-duplicates newsgroups)
+ newsgroups (if newsgroups (mapconcat 'identity newsgroups ",")))
+ (vm-mail-internal
+ (if to
+ (format "reply to %s%s"
+ (std11-full-name-string
+ (car (std11-parse-address-string to)))
+ (if cc ", ..." "")))
+ to subject in-reply-to cc references newsgroups)
+ (setq mail-reply-buffer buf
+ ;; vm-system-state 'replying
+ default-directory dir))
+ (if include-text
+ (save-excursion
+ (goto-char (point-min))
+ (let ((case-fold-search nil))
+ (re-search-forward
+ (concat "^" (regexp-quote mail-header-separator) "$") nil 0))
+ (forward-char 1)
+ (tm-vm/yank-content)))
+ (run-hooks 'vm-reply-hook)
+ (run-hooks 'vm-mail-mode-hook)
+ ))
+
+(defun tm-vm/following-method (buf)
+ (tm-vm/do-reply buf 'to-all 'include-text)
+ )
+
+(defun tm-vm/yank-content ()
+ (interactive)
+ (let ((this-command 'vm-yank-message))
+ (vm-display nil nil '(vm-yank-message)
+ '(vm-yank-message composing-message))
+ (save-restriction
+ (narrow-to-region (point)(point))
+ (insert-buffer mail-reply-buffer)
+ (goto-char (point-max))
+ (push-mark)
+ (goto-char (point-min)))
+ (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
+ (mail-yank-hooks (run-hooks 'mail-yank-hooks))
+ (t (mail-indent-citation)))
+ ))
+
+(set-alist 'mime-viewer/following-method-alist
+ 'vm-mode
+ (function tm-vm/following-method))
+(set-alist 'mime-viewer/following-method-alist
+ 'vm-virtual-mode
+ (function tm-vm/following-method))
+
+