tm 7.73.
[elisp/tm.git] / mh-e / tm-mh-e3.el
1 ;;;
2 ;;; tm-mh-e3.el --- tm-mh-e module for mh-e 3.* to emulate mh-e 4.*.
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;;         (This module was imported from mh-e 4.1)
9 ;;; Created: 1994/7/10
10 ;;; Version:
11 ;;;     $Id: tm-mh-e3.el,v 7.2 1996/07/22 18:24:08 morioka Exp $
12 ;;; Keywords: mail, MH, mh-e 3, MIME, multimedia, encoded-word, multilingual
13 ;;;
14 ;;; This file is part of tm (Tools for MIME).
15 ;;;
16 ;;; This program is free software; you can redistribute it and/or
17 ;;; modify it under the terms of the GNU General Public License as
18 ;;; published by the Free Software Foundation; either version 2, or
19 ;;; (at your option) any later version.
20 ;;;
21 ;;; This program is distributed in the hope that it will be useful,
22 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24 ;;; General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with This program.  If not, write to the Free Software
28 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 ;;;
30 ;;; Code:
31
32 (require 'mh-e)
33
34 (defvar mh-send-prog "send"
35   "Name of the MH send program.
36 Some sites need to change this because of a name conflict.")
37
38 (defvar mail-citation-hook nil
39   "*Hook for modifying a citation just inserted in the mail buffer.
40 Each hook function can find the citation between point and mark.
41 And each hook function should leave point and mark around the citation
42 text as modified.")
43
44
45 ;;; Ensure new buffers won't get this mode if default-major-mode is nil.
46 (put 'mh-show-mode 'mode-class 'special)
47
48 (defun mh-show-mode ()
49   "Major mode for showing messages in mh-e.
50 The value of mh-show-mode-hook is called when a new message is displayed."
51   (kill-all-local-variables)
52   (setq major-mode 'mh-show-mode)
53   (mh-set-mode-name "MH-Show")
54   (run-hooks 'mh-show-mode-hook))
55
56 (defun mh-start-of-uncleaned-message ()
57   ;; position uninteresting headers off the top of the window
58   (let ((case-fold-search t))
59     (re-search-forward
60      "^To:\\|^From:\\|^Subject:\\|^Date:" nil t)
61     (beginning-of-line)
62     (mh-recenter 0)))
63
64 (fset 'mh-show-msg (symbol-function 'mh-show))
65
66
67 ;;; @ mh-comp definitions
68 ;;;
69
70 (provide 'mh-comp)
71
72 (defun mh-read-address (prompt)
73   ;; Read a To: or Cc: address, prompting in the minibuffer with PROMPT.
74   ;; May someday do completion on aliases.
75   (read-string prompt))
76
77 (defvar mh-forward-subject-format "%s: %s"
78   "*Format to generate the Subject: line contents for a forwarded message.
79 The two string arguments to the format are the sender of the original
80 message and the original subject line.")
81
82 (defun mh-forwarded-letter-subject (from subject)
83   ;; Return a Subject suitable for a forwarded message.
84   ;; Original message has headers FROM and SUBJECT.
85   (let ((addr-start (string-match "<" from))
86         (comment (string-match "(" from)))
87     (cond ((and addr-start (> addr-start 0))
88            ;; Full Name <luser@host>
89            (setq from (substring from 0 (1- addr-start))))
90           (comment
91            ;; luser@host (Full Name)
92            (setq from (substring from (1+ comment) (1- (length from)))))))
93   (format mh-forward-subject-format from subject))
94
95
96 ;;; @ end
97 ;;;
98
99 (provide 'tm-mh-e3)
100
101 ;;; tm-mh-e3.el ends here