This commit was generated by cvs2svn to compensate for changes in r488,
[elisp/tm.git] / mh-e / tmh-comp.el
index 4309a14..4eea5ef 100644 (file)
@@ -1,34 +1,32 @@
-;;;
 ;;; tm-mh-e.el --- tm-mh-e functions for composing messages
-;;;
-;;; Copyright (C) 1995 Free Software Foundation, Inc.
-;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko
-;;; Copyright (C) 1995,1996 OKABE Yasuo
-;;;
-;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;;;         OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
-;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;;; Created: 1996/2/29 (separated from tm-mh-e.el)
-;;; Version:
-;;;    $Id: tmh-comp.el,v 7.0 1996/05/15 15:39:54 morioka Exp $
-;;; Keywords: mail, MH, MIME, multimedia, encoded-word, multilingual
-;;;
-;;; This file is part of tm (Tools for MIME).
-;;;
-;;; 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
-;;; (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with This program.  If not, write to the Free Software
-;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
+
+;; Copyright (C) 1993,1994,1995,1996 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;         OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
+;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1996/2/29 (separated from tm-mh-e.el)
+;; Version:
+;;     $Id: tmh-comp.el,v 7.6 1996/09/03 15:27:18 morioka Exp $
+;; Keywords: mail, MH, MIME, multimedia, encoded-word, multilingual
+
+;; This file is part of tm (Tools for MIME).
+
+;; 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 (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with This program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
 ;;; Code:
 
 (require 'mh-comp)
@@ -44,6 +42,8 @@ Default is \"forwcomps\".  If not a complete path name, the file
 is searched for first in the user's MH directory, then in the
 system MH lib directory.")
 
+(defvar tm-mh-e/message-yank-function 'mh-yank-cur-msg)
+
 
 ;;; @ for tm-edit
 ;;;
@@ -180,6 +180,31 @@ system MH lib directory.")
           'mh-letter-mode (function tm-mh-e/insert-mail))
 (set-alist 'mime-editor/mail-inserter-alist
           'news-reply-mode (function tm-mh-e/insert-mail))
+(set-alist
+ 'mime-editor/split-message-sender-alist
+ 'mh-letter-mode
+ (function
+  (lambda (&optional arg)
+    (interactive "P")
+    (write-region (point-min) (point-max)
+                 mime-editor/draft-file-name nil 'no-message)
+    (cond (arg
+          (pop-to-buffer "MH mail delivery")
+          (erase-buffer)
+          (mh-exec-cmd-output mh-send-prog t "-watch" "-nopush"
+                              "-nodraftfolder"
+                              mh-send-args
+                              mime-editor/draft-file-name)
+          (goto-char (point-max))      ; show the interesting part
+          (recenter -1)
+          (sit-for 1))
+         (t
+          (apply 'mh-exec-cmd-quiet t mh-send-prog 
+                 (mh-list-to-string
+                  (list "-nopush" "-nodraftfolder"
+                        "-noverbose" "-nowatch"
+                        mh-send-args mime-editor/draft-file-name)))))
+    )))
 
 
 ;;; @ commands using tm-edit features
@@ -391,12 +416,13 @@ then prompt for the message sequence. See also documentation for
                                  mh-note-forw "Forwarded:"
                                  config)))))
 
-(cond ((not (boundp 'mh-e-version))
+(cond ((not (featurep 'mh-utils))
        (defun tm-mh-e::insert-letter (folder number verbatim)
         (mh-insert-letter verbatim folder number)
         )
        )
-      ((string-lessp mh-e-version "5")
+      ((and (boundp 'mh-e-version)
+           (string-lessp mh-e-version "5"))
        (defun tm-mh-e::insert-letter (folder number verbatim)
         (mh-insert-letter number folder verbatim)
         )
@@ -418,8 +444,48 @@ then prompt for the message sequence. See also documentation for
        (number (tm-mh-e/prompt-for-message "Message number: " folder)))
     (tm-mh-e::insert-letter folder number verbatim)))
 
-(defun tm-mh-e/yank-cur-msg ()
-  "Interface to mh-yank-cur-msg."
+(defun tm-mh-e/yank-cur-msg-with-no-filter ()
+  "Insert the current message into the draft buffer.
+This function makes new show-buffer from article-buffer to disable
+variable `mime-viewer/plain-text-preview-hook'. If you don't want to
+use text filters for replying message, please set it to
+`tm-mh-e/message-yank-function'.
+Prefix each non-blank line in the message with the string in
+`mh-ins-buf-prefix'. The entire message will be inserted if
+`mh-yank-from-start-of-msg' is non-nil. If this variable is nil, the
+portion of the message following the point will be yanked.  If
+`mh-delete-yanked-msg-window' is non-nil, any window displaying the
+yanked message will be deleted."
+  (interactive)
+  (if (and mh-sent-from-folder mh-sent-from-msg)
+      (let ((to-point (point))
+           (to-buffer (current-buffer)))
+       (set-buffer mh-sent-from-folder)
+       (if mh-delete-yanked-msg-window
+           (delete-windows-on mh-show-buffer))
+       (set-buffer mh-show-buffer)     ; Find displayed message
+       (let ((mh-ins-str
+              (let (mime-viewer/plain-text-preview-hook buf)
+                (prog1
+                    (save-window-excursion
+                      (set-buffer mime::preview/article-buffer)
+                      (setq buf (mime/viewer-mode))
+                      (buffer-string)
+                      )
+                  (kill-buffer buf)))))
+         (set-buffer to-buffer)
+         (save-restriction
+           (narrow-to-region to-point to-point)
+           (push-mark)
+           (insert mh-ins-str)
+           (mh-insert-prefix-string mh-ins-buf-prefix)
+           (insert "\n"))))
+    (error "There is no current message")))
+
+(defun tm-mh-e/yank-current-message ()
+  "Insert the current message into the draft buffer.
+It uses variable `tm-mh-e/message-yank-function'
+to select message yanking function."
   (interactive)
   (let ((mh-sent-from-folder mh-sent-from-folder)
        (mh-sent-from-msg mh-sent-from-msg))
@@ -440,11 +506,11 @@ then prompt for the message sequence. See also documentation for
            (set-buffer gnus-article-buffer)
            (setq mh-show-buffer (current-buffer))
            )))
-    (mh-yank-cur-msg)
+    (funcall tm-mh-e/message-yank-function)
     ))
 
 (substitute-key-definition
- 'mh-yank-cur-msg 'tm-mh-e/yank-cur-msg mh-letter-mode-map)
+ 'mh-yank-cur-msg 'tm-mh-e/yank-current-message mh-letter-mode-map)
 (substitute-key-definition
  'mh-insert-letter 'tm-mh-e/insert-letter mh-letter-mode-map)