tm 7.94.
[elisp/tm.git] / mh-e / tm-mh-e3.el
index a5b3d6d..0ac7f9c 100644 (file)
@@ -1,13 +1,46 @@
 ;;;
-;;; $Id: tm-mh-e3.el,v 1.2 1994/11/01 18:06:16 morioka Exp $
+;;; tm-mh-e3.el --- tm-mh-e module for mh-e 3.* to emulate mh-e 4.*.
 ;;;
-;;; This is a part of tm-mh-e.el which is a module for old mh-e
-;;; to emulate mh-e 4.0.
+;;; Copyright (C) 1995 Free Software Foundation, Inc.
+;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko
 ;;;
-;;; This module imports from mh-e 3.8 and 4.0.
+;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;;        (This module was imported from mh-e 4.1)
+;;; Created: 1994/7/10
+;;; Version:
+;;;    $Id: tm-mh-e3.el,v 7.2 1996/07/22 18:24:08 morioka Exp $
+;;; Keywords: mail, MH, mh-e 3, 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.
+;;;
+;;; Code:
+
+(require 'mh-e)
+
+(defvar mh-send-prog "send"
+  "Name of the MH send program.
+Some sites need to change this because of a name conflict.")
+
+(defvar mail-citation-hook nil
+  "*Hook for modifying a citation just inserted in the mail buffer.
+Each hook function can find the citation between point and mark.
+And each hook function should leave point and mark around the citation
+text as modified.")
 
-(provide 'tm-mh-e3)
 
 ;;; Ensure new buffers won't get this mode if default-major-mode is nil.
 (put 'mh-show-mode 'mode-class 'special)
@@ -20,54 +53,49 @@ The value of mh-show-mode-hook is called when a new message is displayed."
   (mh-set-mode-name "MH-Show")
   (run-hooks 'mh-show-mode-hook))
 
-(defun mh-display-msg (msg-num folder &optional show-buffer)
-  ;; Display message NUMBER of FOLDER.
-  ;; Sets the current buffer to the show buffer.
-  (set-buffer folder)
-  (or show-buffer
-      (setq show-buffer mh-show-buffer))
-  ;; Bind variables in folder buffer in case they are local
-  (let ((formfile mhl-formfile)
-       (clean-message-header mh-clean-message-header)
-       (invisible-headers mh-invisible-headers)
-       (visible-headers mh-visible-headers)
-       (msg-filename (mh-msg-filename msg-num))
-       (folder mh-current-folder))
-    (if (not (file-exists-p msg-filename))
-       (error "Message %d does not exist" msg-num))
-    (switch-to-buffer show-buffer)
-    (if mh-bury-show-buffer (bury-buffer (current-buffer)))
-    (mh-when (or (not (equal msg-filename buffer-file-name)))
-            ;; Buffer does not yet contain message.
-            (clear-visited-file-modtime)
-            (unlock-buffer)
-            (setq buffer-file-name nil)        ; no locking during setup
-            (erase-buffer)
-            (if formfile
-                (if (stringp formfile)
-                    (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
-                                            "-form" formfile msg-filename)
-                  (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
-                                          msg-filename))
-              (insert-file-contents msg-filename))
-            (goto-char (point-min))
-            (cond (clean-message-header
-                   (mh-clean-msg-header (point-min)
-                                        invisible-headers
-                                        visible-headers)
-                   (goto-char (point-min)))
-                  (t
-                   (let ((case-fold-search t))
-                     (re-search-forward
-                      "^To:\\|^From:\\|^Subject:\\|^Date:" nil t)
-                     (beginning-of-line)
-                     (mh-recenter 0))))
-            (set-buffer-modified-p nil)
-            (setq buffer-file-name msg-filename)
-            (set-mark nil)
-            (mh-show-mode)
-            (setq mode-line-buffer-identification
-                  (list (format mh-show-buffer-mode-line-buffer-id
-                                folder msg-num))))))
-
-(fset 'mh-show-msg 'mh-show)
+(defun mh-start-of-uncleaned-message ()
+  ;; position uninteresting headers off the top of the window
+  (let ((case-fold-search t))
+    (re-search-forward
+     "^To:\\|^From:\\|^Subject:\\|^Date:" nil t)
+    (beginning-of-line)
+    (mh-recenter 0)))
+
+(fset 'mh-show-msg (symbol-function 'mh-show))
+
+
+;;; @ mh-comp definitions
+;;;
+
+(provide 'mh-comp)
+
+(defun mh-read-address (prompt)
+  ;; Read a To: or Cc: address, prompting in the minibuffer with PROMPT.
+  ;; May someday do completion on aliases.
+  (read-string prompt))
+
+(defvar mh-forward-subject-format "%s: %s"
+  "*Format to generate the Subject: line contents for a forwarded message.
+The two string arguments to the format are the sender of the original
+message and the original subject line.")
+
+(defun mh-forwarded-letter-subject (from subject)
+  ;; Return a Subject suitable for a forwarded message.
+  ;; Original message has headers FROM and SUBJECT.
+  (let ((addr-start (string-match "<" from))
+       (comment (string-match "(" from)))
+    (cond ((and addr-start (> addr-start 0))
+          ;; Full Name <luser@host>
+          (setq from (substring from 0 (1- addr-start))))
+         (comment
+          ;; luser@host (Full Name)
+          (setq from (substring from (1+ comment) (1- (length from)))))))
+  (format mh-forward-subject-format from subject))
+
+
+;;; @ end
+;;;
+
+(provide 'tm-mh-e3)
+
+;;; tm-mh-e3.el ends here