1 ; This file implements a "mail draft mode" for composition of messages in
2 ; the MH mail handler (q.v.). When MH calls Emacs, its customary call
4 ; emacs ./reply ./message -lmh-mode -email-draft-mode
5 ; for the case of a reply, and
6 ; emacs ./draft -lmh-mode -email-draft-mode
7 ; for a newly originated message.
9 ; For use from mhe, in which Emacs calls MH instead of vice versa, it will
10 ; work fine as long as the function mail-draft-mode is not called.
12 ; Brian Reid, December 1981
15 (dot-in-header wasdot ; return True iff cursor in message hdr
19 (re-search-forward "^-*$")
20 (beginning-of-line) (backward-character)
24 (header-line-position ; position cursor w.r.t. header line
29 (& (!= (following-char) ' ')
30 (!= (following-char) '\t'))
32 (progn (beginning-of-line)
33 (error-occured (search-forward ":"))
35 (insert-character ' ')
46 (header-next ; modified ^N command.
48 (header-line-position)
51 (header-previous ; modified ^P command
53 (header-line-position)
56 (find-starting-line ; back cursor up to first line of this para.
60 (!= (following-char) ' ')
61 (! (looking-at "^-*$"))
67 (justify-mail-paragraph ; like ordinary justify-para, but
68 (error-occured ; avoids trashing mail header.
69 (if (! (dot-in-header))
73 (if (& (! (eolp)) (! (eobp)))
77 (backward-word) (forward-word)
80 (error-occured (justify-mail-region))
89 (justify-mail-region ; justify the entire buffer
93 (while (progn ; Turn it all into 1 long line....
99 (delete-previous-character)
104 (while (save-excursion
106 (> (current-column) right-margin)
108 (goto-character (+ (dot) right-margin))
109 (forward-character) (backward-word)
112 (& (!= (following-char) ' ')
113 (!= (following-char) '\t')
114 (!= (following-char) '\n')
119 (delete-next-character) (newline)
126 (set "right-margin" 72)
127 (local-bind-to-key "header-next" '
\ e')
128 (local-bind-to-key "header-previous" '
\10')
129 (local-bind-to-key "justify-mail-paragraph" "\ej")
130 (use-syntax-table "text-mode")
131 (setq mode-string "mh-mail")
138 (visit-file (argv 1))
140 (visit-file (argv 2))
142 (visit-file (argv 1))
146 (visit-file (argv 1))
149 (header-line-position)