tm 7.54.
[elisp/tm.git] / mh-e / tm-mh-e3.el
1 ;;;
2 ;;; $Id: tm-mh-e3.el,v 7.1 1995/12/04 03:43:30 morioka Exp $
3 ;;;
4 ;;; This is a part of tm-mh-e.el which is a module for old mh-e
5 ;;; to emulate mh-e 4.*.
6 ;;;
7 ;;; This module imports from mh-e 4.1.
8 ;;;
9
10 (require 'mh-e)
11
12
13 (defvar mail-citation-hook nil
14   "*Hook for modifying a citation just inserted in the mail buffer.
15 Each hook function can find the citation between point and mark.
16 And each hook function should leave point and mark around the citation
17 text as modified.")
18
19
20 ;;; Ensure new buffers won't get this mode if default-major-mode is nil.
21 (put 'mh-show-mode 'mode-class 'special)
22
23 (defun mh-show-mode ()
24   "Major mode for showing messages in mh-e.
25 The value of mh-show-mode-hook is called when a new message is displayed."
26   (kill-all-local-variables)
27   (setq major-mode 'mh-show-mode)
28   (mh-set-mode-name "MH-Show")
29   (run-hooks 'mh-show-mode-hook))
30
31 (defun mh-start-of-uncleaned-message ()
32   ;; position uninteresting headers off the top of the window
33   (let ((case-fold-search t))
34     (re-search-forward
35      "^To:\\|^From:\\|^Subject:\\|^Date:" nil t)
36     (beginning-of-line)
37     (mh-recenter 0)))
38
39 (fset 'mh-show-msg (symbol-function 'mh-show))
40
41
42 ;;; @ mh-comp definitions
43 ;;;
44
45 (provide 'mh-comp)
46
47 (defun mh-read-address (prompt)
48   ;; Read a To: or Cc: address, prompting in the minibuffer with PROMPT.
49   ;; May someday do completion on aliases.
50   (read-string prompt))
51
52 (defvar mh-forward-subject-format "%s: %s"
53   "*Format to generate the Subject: line contents for a forwarded message.
54 The two string arguments to the format are the sender of the original
55 message and the original subject line.")
56
57 (defun mh-forwarded-letter-subject (from subject)
58   ;; Return a Subject suitable for a forwarded message.
59   ;; Original message has headers FROM and SUBJECT.
60   (let ((addr-start (string-match "<" from))
61         (comment (string-match "(" from)))
62     (cond ((and addr-start (> addr-start 0))
63            ;; Full Name <luser@host>
64            (setq from (substring from 0 (1- addr-start))))
65           (comment
66            ;; luser@host (Full Name)
67            (setq from (substring from (1+ comment) (1- (length from)))))))
68   (format mh-forward-subject-format from subject))
69
70
71 ;;; @ end
72 ;;;
73
74 (provide 'tm-mh-e3)