tm 7.75.
[elisp/tm.git] / mh-e / tmh-comp.el
index 8f0a385..3e32803 100644 (file)
@@ -10,7 +10,7 @@
 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;;; Created: 1996/2/29 (separated from tm-mh-e.el)
 ;;; Version:
-;;;    $Id: tmh-comp.el,v 7.1 1996/06/05 02:34:06 morioka Exp $
+;;;    $Id: tmh-comp.el,v 7.5 1996/07/31 03:07:43 morioka Exp $
 ;;; Keywords: mail, MH, MIME, multimedia, encoded-word, multilingual
 ;;;
 ;;; This file is part of tm (Tools for MIME).
@@ -44,6 +44,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 +182,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
@@ -419,8 +446,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))
@@ -441,11 +508,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)