This commit was generated by cvs2svn to compensate for changes in r377,
[elisp/tm.git] / tm-vm.el
index 3e6479c..dd876f7 100644 (file)
--- a/tm-vm.el
+++ b/tm-vm.el
@@ -9,20 +9,18 @@
 ;;; Author: MASUTANI Yasuhiro <masutani@me.es.osaka-u.ac.jp>
 ;;;         Kenji Wakamiya <wkenji@flab.fujitsu.co.jp>
 ;;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;;;         Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
+;;;         KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>
 ;;;         Oscar Figueiredo <figueire@lspsun2.epfl.ch>
 ;;; modified by SHIONO Jun'ichi <jun@case.nm.fujitsu.co.jp>
 ;;;             ISHIHARA Akito <aki@bpel.tutics.tut.ac.jp>
 ;;;             Rob Kooper <kooper@cc.gatech.edu>
 ;;; Maintainer: KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>
 ;;; Created: 1994/10/29
-;;; Version: $Revision: 7.51 $
+;;; Version: $Revision: 7.52 $
 ;;; Keywords: mail, MIME, multimedia, multilingual, encoded-word
 ;;;
 ;;; This file is part of tm (Tools for MIME).
 ;;;
-;;; Plese insert `(require 'tm-vm)' in your ~/.vm file.
-;;;
 ;;; This program is free software; you can redistribute it and/or
 ;;; modify it under the terms of the GNU General Public License as
 ;;; published by the Free Software Foundation; either version 2, or
 ;;; along with This program.  If not, write to the Free Software
 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 ;;;
+;;; Commentary:
+;;; 
+;;; Plese insert `(require 'tm-vm)' in your ~/.vm file.
+;;;
 ;;; Code:
 
 (require 'tm-view)
 (require 'vm)
 
 (defconst tm-vm/RCS-ID
-  "$Id: tm-vm.el,v 7.51 1996/04/16 18:26:13 morioka Exp $")
+  "$Id: tm-vm.el,v 7.52 1996/04/19 18:49:19 shuhei-k Exp $")
 (defconst tm-vm/version (get-version-string tm-vm/RCS-ID))
 
 (define-key vm-mode-map "Z" 'tm-vm/view-message)
@@ -564,12 +566,20 @@ tm-vm uses `vm-select-message-hook', use this hook instead.")
 ;;; @@ vm-yank-message
 ;;;
 ;; 1996/3/28 by Oscar Figueiredo <figueire@lspsun16.epfl.ch>
+
+(require 'vm-reply)
+
 (defun vm-yank-message (message)
   "Yank message number N into the current buffer at point.
 When called interactively N is always read from the minibuffer.  When
 called non-interactively the first argument is expected to be a
 message struct.
 
+This function originally provided by vm-reply has been patched for TM in
+order to provide better citation of MIME messages : if a MIME Preview
+buffer is displayed for the message then its contents are inserted
+instead of the raw message.
+
 This command is meant to be used in VM created Mail mode buffers; the
 yanked message comes from the mail buffer containing the message you
 are replying to, forwarding, or invoked VM's mail command from.
@@ -751,7 +761,7 @@ created to send a digest in multipart/digest type format.
 If `vm-digest-send-type' is \"rfc1521\", tm-vm runs this hook
 instead of `vm-send-digest-hook'.")
 
-(defun tm-vm/enclose-messages (mlist)
+(defun tm-vm/enclose-messages (mlist &optional preamble)
   "Enclose the messages in MLIST as multipart/digest.
 The resulting digest is inserted at point in the current buffer.
 
@@ -759,6 +769,7 @@ MLIST should be a list of message structs (real or virtual).
 These are the messages that will be enclosed."
   (if mlist
       (let ((digest (consp (cdr mlist)))
+            (mp mlist)
             m)
        (save-restriction
          (narrow-to-region (point) (point))
@@ -768,6 +779,21 @@ These are the messages that will be enclosed."
             (tm-mail/insert-message m)
             (goto-char (point-max))
            (setq mlist (cdr mlist)))
+          (if preamble
+              (progn
+                (goto-char (point-min))
+                (mime-editor/insert-tag "text" "plain")
+                (vm-unsaved-message "Building digest preamble...")
+                (while mp
+                  (let ((vm-summary-uninteresting-senders nil))
+                    (insert
+                     (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
+                  (if vm-digest-center-preamble
+                      (progn
+                        (forward-char -1)
+                        (center-line)
+                        (forward-char 1)))
+                  (setq mp (cdr mp)))))
           (if digest
               (mime-editor/enclose-digest-region (point-min) (point-max)))
           ))))
@@ -812,7 +838,7 @@ Subject: header manually."
         (run-hooks 'tm-vm/forward-message-hook)
         (run-hooks 'vm-mail-mode-hook)))))
 
-(defun tm-vm/send-digest (&optional prefix)
+(defun tm-vm/send-digest (&optional arg)
   "Send a digest of all messages in the current folder to recipients.
 The type of the digest is specified by the variable vm-digest-send-type.
 You will be placed in a Mail mode buffer as is usual with replies, but you
@@ -822,45 +848,26 @@ If invoked on marked messages (via vm-next-command-uses-marks),
 only marked messages will be put into the digest."
   (interactive "P")
   (if (not (equal vm-digest-send-type "rfc1521"))
-      (vm-send-digest prefix)
+      (vm-send-digest arg)
     (vm-select-folder-buffer)
     (vm-check-for-killed-summary)
     (vm-error-if-folder-empty)
     (let ((dir default-directory)
-          (mp vm-message-pointer)
-          (mlist (if (eq last-command 'vm-next-command-uses-marks)
-                     (vm-select-marked-or-prefixed-messages 0)
-                   vm-message-list))
+          (vm-forward-list (if (eq last-command 'vm-next-command-uses-marks)
+                               (vm-select-marked-or-prefixed-messages 0)
+                             vm-message-list))
           start)
       (save-restriction
         (widen)
         (vm-mail-internal (format "digest from %s" (buffer-name)))
         (setq vm-system-state 'forwarding
-              vm-forward-list mlist
               default-directory dir)
         (goto-char (point-min))
         (re-search-forward (concat "^" (regexp-quote mail-header-separator)
                                    "\n"))
         (goto-char (match-end 0))
-        (setq start (point)
-              mp mlist)
         (vm-unsaved-message "Building %s digest..." vm-digest-send-type)
-        (tm-vm/enclose-messages mlist)
-        (goto-char start)
-        (setq mp mlist)
-        (if prefix
-         (progn
-            (mime-editor/insert-tag "text" "plain")
-           (vm-unsaved-message "Building digest preamble...")
-           (while mp
-             (let ((vm-summary-uninteresting-senders nil))
-               (insert (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
-             (if vm-digest-center-preamble
-                 (progn
-                   (forward-char -1)
-                   (center-line)
-                   (forward-char 1)))
-             (setq mp (cdr mp)))))
+        (tm-vm/enclose-messages vm-forward-list arg)
         (mail-position-on-field "To")
         (message "Building %s digest... done" vm-digest-send-type)))
     (run-hooks 'tm-vm/send-digest-hook)
@@ -870,9 +877,6 @@ only marked messages will be put into the digest."
                           'tm-vm/forward-message vm-mode-map)
 (substitute-key-definition 'vm-send-digest
                           'tm-vm/send-digest vm-mode-map)
-
-;;; @@ for message/rfc822
-;;;
 \f
 
 ;;; @@ setting