Mercurial > emacs
annotate lisp/mail/mh-comp.el @ 11779:6234b3610a6f
Vdefault_minibuffer_frame is now part of KBOARD instead
of a variable. All references changed.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 09 May 1995 05:17:02 +0000 |
parents | d8480e4513ea |
children | c0249fda1691 |
rev | line source |
---|---|
6365 | 1 ;;; mh-comp --- mh-e functions for composing messages |
11507 | 2 ;; Time-stamp: <95/04/20 19:16:23 gildea> |
6365 | 3 |
11332 | 4 ;; Copyright (C) 1993, 1995 Free Software Foundation, Inc. |
6365 | 5 |
11333 | 6 ;; This file is part of GNU Emacs. |
6365 | 7 |
11333 | 8 ;; GNU Emacs is free software; you can redistribute it and/or modify |
6365 | 9 ;; it under the terms of the GNU General Public License as published by |
10 ;; the Free Software Foundation; either version 2, or (at your option) | |
11 ;; any later version. | |
12 | |
11333 | 13 ;; GNU Emacs is distributed in the hope that it will be useful, |
6365 | 14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 ;; GNU General Public License for more details. | |
17 | |
18 ;; You should have received a copy of the GNU General Public License | |
11333 | 19 ;; along with GNU Emacs; see the file COPYING. If not, write to |
6365 | 20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
22 ;;; Commentary: | |
23 | |
24 ;; Internal support for mh-e package. | |
25 | |
11332 | 26 ;;; Change Log: |
27 | |
11578
d8480e4513ea
(mh-insert-signature): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
11507
diff
changeset
|
28 ;; $Id: mh-comp.el,v 1.5 1995/04/20 23:35:49 kwzh Exp kwzh $ |
11332 | 29 |
6365 | 30 ;;; Code: |
31 | |
32 (provide 'mh-comp) | |
33 (require 'mh-utils) | |
34 | |
11332 | 35 ;;; Site customization (see also mh-utils.el): |
36 | |
37 (defvar mh-send-prog "send" | |
38 "Name of the MH send program. | |
39 Some sites need to change this because of a name conflict.") | |
40 | |
41 (defvar mh-redist-full-contents nil | |
42 "Non-nil if the `dist' command needs whole letter for redistribution. | |
43 This is the case only when `send' is compiled with the BERK option. | |
44 If MH will not allow you to redist a previously redist'd msg, set to nil.") | |
45 | |
46 | |
6365 | 47 (defvar mh-note-repl "-" |
48 "String whose first character is used to notate replied to messages.") | |
49 | |
50 (defvar mh-note-forw "F" | |
51 "String whose first character is used to notate forwarded messages.") | |
52 | |
53 (defvar mh-note-dist "R" | |
54 "String whose first character is used to notate redistributed messages.") | |
55 | |
56 (defvar mh-yank-hooks nil | |
57 "Obsolete hook for modifying a citation just inserted in the mail buffer. | |
58 Each hook function can find the citation between point and mark. | |
59 And each hook function should leave point and mark around the citation | |
60 text as modified. | |
61 | |
62 This is a normal hook, misnamed for historical reasons. | |
63 It is semi-obsolete and is only used if mail-citation-hook is nil.") | |
64 | |
65 (defvar mail-citation-hook nil | |
66 "*Hook for modifying a citation just inserted in the mail buffer. | |
67 Each hook function can find the citation between point and mark. | |
68 And each hook function should leave point and mark around the citation | |
69 text as modified. | |
70 | |
71 If this hook is entirely empty (nil), the text of the message is inserted | |
72 with mh-ins-buf-prefix prefixed to each line. | |
73 | |
74 See also the variable mh-yank-from-start-of-msg, which controls how | |
75 much of the message passed to the hook.") | |
76 | |
77 ;;; Copied from sendmail.el for Hyperbole | |
78 (defvar mail-header-separator "--------" | |
79 "*Line used by MH to separate headers from text in messages being composed.") | |
80 | |
81 ;;; Personal preferences: | |
82 | |
83 (defvar mh-delete-yanked-msg-window nil | |
84 "*Controls window display when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg]. | |
85 If non-nil, yanking the current message into a draft letter deletes any | |
86 windows displaying the message.") | |
87 | |
88 (defvar mh-yank-from-start-of-msg t | |
89 "*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg]. | |
90 If non-nil, include the entire message. If the symbol `body', then yank the | |
91 message minus the header. If nil, yank only the portion of the message | |
92 following the point. If the show buffer has a region, this variable is | |
93 ignored.") | |
94 | |
11332 | 95 (defvar mh-ins-buf-prefix "> " |
96 "*String to put before each non-blank line of a yanked or inserted message. | |
97 \\<mh-letter-mode-map>Used when the message is inserted into an outgoing letter | |
98 by \\[mh-insert-letter] or \\[mh-yank-cur-msg].") | |
99 | |
6365 | 100 (defvar mh-reply-default-reply-to nil |
101 "*Sets the person or persons to whom a reply will be sent. | |
102 If nil, prompt for recipient. If non-nil, then \\<mh-folder-mode-map>`\\[mh-reply]' will use this | |
11332 | 103 value and it should be one of \"from\", \"to\", \"cc\", or \"all\". |
104 The values \"cc\" and \"all\" do the same thing.") | |
6365 | 105 |
106 (defvar mh-signature-file-name "~/.signature" | |
107 "*Name of file containing the user's signature. | |
108 Inserted into message by \\<mh-letter-mode-map>\\[mh-insert-signature].") | |
109 | |
110 (defvar mh-forward-subject-format "%s: %s" | |
111 "*Format to generate the Subject: line contents for a forwarded message. | |
112 The two string arguments to the format are the sender of the original | |
113 message and the original subject line.") | |
114 | |
115 (defvar mh-comp-formfile "components" | |
116 "Name of file to be used as a skeleton for composing messages. | |
117 Default is \"components\". If not a complete path name, the file | |
118 is searched for first in the user's MH directory, then in the | |
119 system MH lib directory.") | |
120 | |
11332 | 121 (defvar mh-repl-formfile "replcomps" |
122 "Name of file to be used as a skeleton for replying to messages. | |
123 Default is \"replcomps\". If not a complete path name, the file | |
124 is searched for first in the user's MH directory, then in the | |
125 system MH lib directory.") | |
126 | |
6365 | 127 ;;; Hooks: |
128 | |
129 (defvar mh-letter-mode-hook nil | |
130 "Invoked in `mh-letter-mode' on a new letter.") | |
131 | |
132 (defvar mh-compose-letter-function nil | |
11332 | 133 "Invoked when setting up a letter draft. |
6365 | 134 It is passed three arguments: TO recipients, SUBJECT, and CC recipients.") |
135 | |
136 (defvar mh-before-send-letter-hook nil | |
137 "Invoked at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command.") | |
138 | |
139 | |
140 (defvar mh-rejected-letter-start | |
11332 | 141 (concat "^ ----- Unsent message follows -----$" ;from sendmail V5 |
142 "\\|^ ----- Original message follows -----$" ;from sendmail V8 | |
143 "\\|^------- Unsent Draft$" ;from MH itself | |
6365 | 144 "\\|^---------- Original Message ----------$" ;from zmailer |
11332 | 145 "\\|^ --- The unsent message follows ---$" ;from AIX mail system |
146 "\\|^ Your message follows:$" ;from MMDF-II | |
147 "\\|^Content-Description: Returned Content$" ;1993 KJ sendmail | |
148 ) | |
6365 | 149 "Regexp specifying the beginning of the wrapper around a returned letter. |
150 This wrapper is generated by the mail system when rejecting a letter.") | |
151 | |
152 (defvar mh-new-draft-cleaned-headers | |
11332 | 153 "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:" |
6365 | 154 "Regexp of header lines to remove before offering a message as a new draft. |
155 Used by the \\<mh-folder-mode-map>`\\[mh-edit-again]' and `\\[mh-extract-rejected-mail]' commands.") | |
156 | |
11332 | 157 (defvar mh-to-field-choices '(("t" . "To:") ("s" . "Subject:") ("c" . "Cc:") |
158 ("b" . "Bcc:") ("f" . "Fcc:") ("r" . "From:") | |
159 ("d" . "Dcc:")) | |
6365 | 160 "Alist of (final-character . field-name) choices for mh-to-field.") |
161 | |
162 (defvar mh-letter-mode-map (copy-keymap text-mode-map) | |
163 "Keymap for composing mail.") | |
164 | |
165 (defvar mh-letter-mode-syntax-table nil | |
166 "Syntax table used by mh-e while in MH-Letter mode.") | |
167 | |
168 (if mh-letter-mode-syntax-table | |
169 () | |
170 (setq mh-letter-mode-syntax-table | |
171 (make-syntax-table text-mode-syntax-table)) | |
172 (modify-syntax-entry ?% "." mh-letter-mode-syntax-table)) | |
173 | |
174 | |
175 ;;;###autoload | |
176 (defun mh-smail () | |
177 "Compose and send mail with the MH mail system. | |
178 This function is an entry point to mh-e, the Emacs front end | |
11332 | 179 to the MH mail system. |
180 | |
181 See documentation of `\\[mh-send]' for more details on composing mail." | |
6365 | 182 (interactive) |
183 (mh-find-path) | |
184 (call-interactively 'mh-send)) | |
185 | |
186 | |
187 (defun mh-edit-again (msg) | |
188 "Clean-up a draft or a message previously sent and make it resendable. | |
11332 | 189 Default is the current message. |
6365 | 190 The variable mh-new-draft-cleaned-headers specifies the headers to remove. |
191 See also documentation for `\\[mh-send]' function." | |
192 (interactive (list (mh-get-msg-num t))) | |
193 (let* ((from-folder mh-current-folder) | |
194 (config (current-window-configuration)) | |
195 (draft | |
196 (cond ((and mh-draft-folder (equal from-folder mh-draft-folder)) | |
197 (pop-to-buffer (find-file-noselect (mh-msg-filename msg)) t) | |
198 (rename-buffer (format "draft-%d" msg)) | |
199 (buffer-name)) | |
200 (t | |
201 (mh-read-draft "clean-up" (mh-msg-filename msg) nil))))) | |
202 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil) | |
203 (goto-char (point-min)) | |
204 (set-buffer-modified-p nil) | |
205 (mh-compose-and-send-mail draft "" from-folder nil nil nil nil nil nil | |
206 config))) | |
207 | |
208 | |
209 (defun mh-extract-rejected-mail (msg) | |
210 "Extract a letter returned by the mail system and make it resendable. | |
11332 | 211 Default is the current message. The variable mh-new-draft-cleaned-headers |
6365 | 212 gives the headers to clean out of the original message. |
213 See also documentation for `\\[mh-send]' function." | |
214 (interactive (list (mh-get-msg-num t))) | |
215 (let ((from-folder mh-current-folder) | |
216 (config (current-window-configuration)) | |
217 (draft (mh-read-draft "extraction" (mh-msg-filename msg) nil))) | |
218 (goto-char (point-min)) | |
219 (cond ((re-search-forward mh-rejected-letter-start nil t) | |
220 (skip-chars-forward " \t\n") | |
221 (delete-region (point-min) (point)) | |
222 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)) | |
223 (t | |
224 (message "Does not appear to be a rejected letter."))) | |
225 (goto-char (point-min)) | |
226 (set-buffer-modified-p nil) | |
11332 | 227 (mh-compose-and-send-mail draft "" from-folder msg |
228 (mh-get-header-field "To:") | |
229 (mh-get-header-field "From:") | |
230 (mh-get-header-field "Cc:") | |
6365 | 231 nil nil config))) |
232 | |
233 | |
234 (defun mh-forward (to cc &optional msg-or-seq) | |
235 "Forward a message or message sequence. Defaults to displayed message. | |
236 If optional prefix argument provided, then prompt for the message sequence. | |
237 See also documentation for `\\[mh-send]' function." | |
238 (interactive (list (mh-read-address "To: ") | |
239 (mh-read-address "Cc: ") | |
240 (if current-prefix-arg | |
241 (mh-read-seq-default "Forward" t) | |
11332 | 242 (mh-get-msg-num t)))) |
6365 | 243 (or msg-or-seq |
244 (setq msg-or-seq (mh-get-msg-num t))) | |
245 (let* ((folder mh-current-folder) | |
246 (config (current-window-configuration)) | |
247 ;; forw always leaves file in "draft" since it doesn't have -draft | |
248 (draft-name (expand-file-name "draft" mh-user-path)) | |
249 (draft (cond ((or (not (file-exists-p draft-name)) | |
250 (y-or-n-p "The file 'draft' exists. Discard it? ")) | |
11332 | 251 (mh-exec-cmd "forw" "-build" |
252 mh-current-folder msg-or-seq) | |
6365 | 253 (prog1 |
254 (mh-read-draft "" draft-name t) | |
255 (mh-insert-fields "To:" to "Cc:" cc) | |
256 (set-buffer-modified-p nil))) | |
257 (t | |
258 (mh-read-draft "" draft-name nil))))) | |
11332 | 259 (let (orig-from |
260 orig-subject) | |
261 (goto-char (point-min)) | |
262 (re-search-forward "^------- Forwarded Message") | |
263 (forward-line 1) | |
264 (skip-chars-forward " \t\n") | |
265 (save-restriction | |
266 (narrow-to-region (point) (point-max)) | |
267 (setq orig-from (mh-get-header-field "From:")) | |
268 (setq orig-subject (mh-get-header-field "Subject:"))) | |
6365 | 269 (let ((forw-subject |
270 (mh-forwarded-letter-subject orig-from orig-subject))) | |
11332 | 271 (mh-insert-fields "Subject:" forw-subject) |
272 (goto-char (point-min)) | |
273 (re-search-forward "^------- Forwarded Message") | |
274 (forward-line -1) | |
275 (delete-other-windows) | |
276 (if (numberp msg-or-seq) | |
277 (mh-add-msgs-to-seq msg-or-seq 'forwarded t) | |
6365 | 278 (mh-add-msgs-to-seq (mh-seq-to-msgs msg-or-seq) 'forwarded t)) |
11332 | 279 (mh-compose-and-send-mail draft "" folder msg-or-seq |
280 to forw-subject cc | |
281 mh-note-forw "Forwarded:" | |
282 config))))) | |
6365 | 283 |
284 (defun mh-forwarded-letter-subject (from subject) | |
285 ;; Return a Subject suitable for a forwarded message. | |
286 ;; Original message has headers FROM and SUBJECT. | |
287 (let ((addr-start (string-match "<" from)) | |
288 (comment (string-match "(" from))) | |
289 (cond ((and addr-start (> addr-start 0)) | |
290 ;; Full Name <luser@host> | |
291 (setq from (substring from 0 (1- addr-start)))) | |
292 (comment | |
293 ;; luser@host (Full Name) | |
294 (setq from (substring from (1+ comment) (1- (length from))))))) | |
295 (format mh-forward-subject-format from subject)) | |
296 | |
297 | |
298 ;;;###autoload | |
299 (defun mh-smail-other-window () | |
300 "Compose and send mail in other window with the MH mail system. | |
301 This function is an entry point to mh-e, the Emacs front end | |
11332 | 302 to the MH mail system. |
303 | |
304 See documentation of `\\[mh-send]' for more details on composing mail." | |
6365 | 305 (interactive) |
306 (mh-find-path) | |
307 (call-interactively 'mh-send-other-window)) | |
308 | |
309 | |
310 (defun mh-redistribute (to cc &optional msg) | |
311 "Redistribute a letter. | |
312 Depending on how your copy of MH was compiled, you may need to change the | |
313 setting of the variable mh-redist-full-contents. See its documentation." | |
314 (interactive (list (mh-read-address "Redist-To: ") | |
315 (mh-read-address "Redist-Cc: ") | |
316 (mh-get-msg-num t))) | |
317 (or msg | |
318 (setq msg (mh-get-msg-num t))) | |
319 (save-window-excursion | |
320 (let ((folder mh-current-folder) | |
321 (draft (mh-read-draft "redistribution" | |
322 (if mh-redist-full-contents | |
323 (mh-msg-filename msg) | |
324 nil) | |
325 nil))) | |
326 (mh-goto-header-end 0) | |
327 (insert "Resent-To: " to "\n") | |
328 (if (not (equal cc "")) (insert "Resent-cc: " cc "\n")) | |
329 (mh-clean-msg-header (point-min) | |
330 "^Message-Id:\\|^Received:\\|^Return-Path:\\|^Sender:\\|^Date:\\|^From:" | |
331 nil) | |
332 (save-buffer) | |
333 (message "Redistributing...") | |
334 (if mh-redist-full-contents | |
335 (call-process "/bin/sh" nil 0 nil "-c" | |
336 (format "mhdist=1 mhaltmsg=%s %s -push %s" | |
11332 | 337 buffer-file-name |
6365 | 338 (expand-file-name mh-send-prog mh-progs) |
11332 | 339 buffer-file-name)) |
6365 | 340 (call-process "/bin/sh" nil 0 nil "-c" |
341 (format "mhdist=1 mhaltmsg=%s mhannotate=1 %s -push %s" | |
342 (mh-msg-filename msg folder) | |
343 (expand-file-name mh-send-prog mh-progs) | |
11332 | 344 buffer-file-name))) |
6365 | 345 (mh-annotate-msg msg folder mh-note-dist |
346 "-component" "Resent:" | |
347 "-text" (format "\"%s %s\"" to cc)) | |
348 (kill-buffer draft) | |
349 (message "Redistributing...done")))) | |
350 | |
351 | |
11332 | 352 (defun mh-reply (message &optional includep) |
353 "Reply to MESSAGE (default: current message). | |
6365 | 354 If optional prefix argument INCLUDEP provided, then include the message |
355 in the reply using filter mhl.reply in your MH directory. | |
356 Prompts for type of addresses to reply to: | |
357 from sender only, | |
358 to sender and primary recipients, | |
359 cc/all sender and all recipients. | |
11332 | 360 If the file named by `mh-repl-formfile' exists, it is used as a skeleton |
361 for the reply. See also documentation for `\\[mh-send]' function." | |
6365 | 362 (interactive (list (mh-get-msg-num t) current-prefix-arg)) |
363 (let ((minibuffer-help-form | |
364 "from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients")) | |
365 (let ((reply-to (or mh-reply-default-reply-to | |
366 (completing-read "Reply to whom: " | |
367 '(("from") ("to") ("cc") ("all")) | |
368 nil | |
369 t))) | |
370 (folder mh-current-folder) | |
371 (show-buffer mh-show-buffer) | |
372 (config (current-window-configuration))) | |
373 (message "Composing a reply...") | |
374 (mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder" | |
11332 | 375 (if (stringp mh-repl-formfile) ;must be string, but we're paranoid |
376 (list "-form" mh-repl-formfile)) | |
377 mh-current-folder message | |
6365 | 378 (cond ((or (equal reply-to "from") (equal reply-to "")) |
379 '("-nocc" "all")) | |
380 ((equal reply-to "to") | |
381 '("-cc" "to")) | |
382 ((or (equal reply-to "cc") (equal reply-to "all")) | |
383 '("-cc" "all" "-nocc" "me"))) | |
384 (if includep | |
385 '("-filter" "mhl.reply"))) | |
386 (let ((draft (mh-read-draft "reply" | |
387 (expand-file-name "reply" mh-user-path) | |
388 t))) | |
389 (delete-other-windows) | |
390 (set-buffer-modified-p nil) | |
391 | |
11332 | 392 (let ((to (mh-get-header-field "To:")) |
393 (subject (mh-get-header-field "Subject:")) | |
394 (cc (mh-get-header-field "Cc:"))) | |
6365 | 395 (goto-char (point-min)) |
396 (mh-goto-header-end 1) | |
397 (or includep | |
398 (mh-in-show-buffer (show-buffer) | |
11332 | 399 (mh-display-msg message folder))) |
400 (mh-add-msgs-to-seq message 'answered t) | |
6365 | 401 (message "Composing a reply...done") |
11332 | 402 (mh-compose-and-send-mail draft "" folder message to subject cc |
6365 | 403 mh-note-repl "Replied:" config)))))) |
404 | |
405 | |
406 (defun mh-send (to cc subject) | |
407 "Compose and send a letter. | |
408 The file named by `mh-comp-formfile' will be used as the form. | |
11332 | 409 Do not call this function from outside mh-e; use \\[mh-smail] instead. |
410 | |
6365 | 411 The letter is composed in mh-letter-mode; see its documentation for more |
412 details. If `mh-compose-letter-function' is defined, it is called on the | |
11332 | 413 draft and passed three arguments: to, subject, and cc." |
6365 | 414 (interactive (list |
415 (mh-read-address "To: ") | |
416 (mh-read-address "Cc: ") | |
417 (read-string "Subject: "))) | |
418 (let ((config (current-window-configuration))) | |
419 (delete-other-windows) | |
420 (mh-send-sub to cc subject config))) | |
421 | |
422 | |
423 (defun mh-send-other-window (to cc subject) | |
424 "Compose and send a letter in another window. | |
425 Do not call this function from outside mh-e; | |
426 use \\[mh-smail-other-window] instead. | |
427 See also documentation for `\\[mh-send]' function." | |
428 (interactive (list | |
429 (mh-read-address "To: ") | |
430 (mh-read-address "Cc: ") | |
431 (read-string "Subject: "))) | |
432 (let ((pop-up-windows t)) | |
433 (mh-send-sub to cc subject (current-window-configuration)))) | |
434 | |
435 | |
436 (defun mh-send-sub (to cc subject config) | |
11332 | 437 ;; Do the real work of composing and sending a letter. |
438 ;; Expects the TO, CC, and SUBJECT fields as arguments. | |
439 ;; CONFIG is the window configuration before sending mail. | |
6365 | 440 (let ((folder mh-current-folder) |
441 (msg-num (mh-get-msg-num nil))) | |
442 (message "Composing a message...") | |
443 (let ((draft (mh-read-draft | |
444 "message" | |
445 (let (components) | |
446 (cond | |
447 ((file-exists-p | |
448 (setq components | |
449 (expand-file-name mh-comp-formfile mh-user-path))) | |
450 components) | |
451 ((file-exists-p | |
452 (setq components | |
453 (expand-file-name mh-comp-formfile mh-lib))) | |
454 components) | |
455 (t | |
456 (error (format "Can't find components file \"%s\"" | |
457 components))))) | |
458 nil))) | |
459 (mh-insert-fields "To:" to "Subject:" subject "Cc:" cc) | |
460 (goto-char (point-max)) | |
461 (message "Composing a message...done") | |
462 (mh-compose-and-send-mail draft "" folder msg-num | |
463 to subject cc | |
464 nil nil config)))) | |
465 | |
466 | |
467 (defun mh-read-draft (use initial-contents delete-contents-file) | |
468 ;; Read draft file into a draft buffer and make that buffer the current one. | |
469 ;; USE is a message used for prompting about the intended use of the message. | |
470 ;; INITIAL-CONTENTS is filename that is read into an empty buffer, or NIL | |
471 ;; if buffer should not be modified. Delete the initial-contents file if | |
472 ;; DELETE-CONTENTS-FILE flag is set. | |
473 ;; Returns the draft folder's name. | |
474 ;; If the draft folder facility is enabled in ~/.mh_profile, a new buffer is | |
475 ;; used each time and saved in the draft folder. The draft file can then be | |
476 ;; reused. | |
477 (cond (mh-draft-folder | |
478 (let ((orig-default-dir default-directory) | |
479 (draft-file-name (mh-new-draft-name))) | |
480 (pop-to-buffer (generate-new-buffer | |
481 (format "draft-%s" | |
482 (file-name-nondirectory draft-file-name)))) | |
483 (condition-case () | |
484 (insert-file-contents draft-file-name t) | |
485 (file-error)) | |
486 (setq default-directory orig-default-dir))) | |
487 (t | |
488 (let ((draft-name (expand-file-name "draft" mh-user-path))) | |
489 (pop-to-buffer "draft") ; Create if necessary | |
490 (if (buffer-modified-p) | |
491 (if (y-or-n-p "Draft has been modified; kill anyway? ") | |
492 (set-buffer-modified-p nil) | |
493 (error "Draft preserved"))) | |
494 (setq buffer-file-name draft-name) | |
495 (clear-visited-file-modtime) | |
496 (unlock-buffer) | |
497 (cond ((and (file-exists-p draft-name) | |
498 (not (equal draft-name initial-contents))) | |
499 (insert-file-contents draft-name) | |
500 (delete-file draft-name)))))) | |
501 (cond ((and initial-contents | |
502 (or (zerop (buffer-size)) | |
503 (not (y-or-n-p | |
504 (format "A draft exists. Use for %s? " use))))) | |
505 (erase-buffer) | |
506 (insert-file-contents initial-contents) | |
507 (if delete-contents-file (delete-file initial-contents)))) | |
508 (auto-save-mode 1) | |
509 (if mh-draft-folder | |
510 (save-buffer)) ; Do not reuse draft name | |
511 (buffer-name)) | |
512 | |
513 | |
514 (defun mh-new-draft-name () | |
515 ;; Returns the pathname of folder for draft messages. | |
516 (save-excursion | |
517 (mh-exec-cmd-quiet t "mhpath" mh-draft-folder "new") | |
518 (buffer-substring (point-min) (1- (point-max))))) | |
519 | |
520 | |
521 (defun mh-annotate-msg (msg buffer note &rest args) | |
522 ;; Mark the MESSAGE in BUFFER listing with the character NOTE and annotate | |
523 ;; the saved message with ARGS. | |
524 (apply 'mh-exec-cmd "anno" buffer msg args) | |
525 (save-excursion | |
526 (cond ((get-buffer buffer) ; Buffer may be deleted | |
527 (set-buffer buffer) | |
528 (if (symbolp msg) | |
529 (mh-notate-seq msg note (1+ mh-cmd-note)) | |
530 (mh-notate msg note (1+ mh-cmd-note))))))) | |
531 | |
532 | |
533 (defun mh-insert-fields (&rest name-values) | |
534 ;; Insert the NAME-VALUE pairs in the current buffer. | |
535 ;; If field NAME exists, append VALUE to it. | |
536 ;; Do not insert any pairs whose value is the empty string. | |
537 (let ((case-fold-search t)) | |
538 (while name-values | |
539 (let ((field-name (car name-values)) | |
540 (value (car (cdr name-values)))) | |
541 (cond ((equal value "") | |
542 nil) | |
543 ((mh-position-on-field field-name) | |
544 (insert " " value)) | |
545 (t | |
546 (insert field-name " " value "\n"))) | |
547 (setq name-values (cdr (cdr name-values))))))) | |
548 | |
549 | |
550 (defun mh-position-on-field (field &optional ignore) | |
551 ;; Move to the end of the FIELD in the header. | |
552 ;; Move to end of entire header if FIELD not found. | |
553 ;; Returns non-nil iff FIELD was found. | |
554 ;; The optional second arg is for pre-version 4 compatibility. | |
11332 | 555 (if (mh-goto-header-field field) |
556 (progn | |
557 (mh-header-field-end) | |
558 t))) | |
559 | |
560 | |
561 (defun mh-get-header-field (field) | |
562 ;; Find and return the body of FIELD in the mail header. | |
563 ;; Returns the empty string if the field is not in the header of the | |
564 ;; current buffer. | |
565 (if (mh-goto-header-field field) | |
566 (progn | |
567 (skip-chars-forward " \t") ;strip leading white space in body | |
568 (let ((start (point))) | |
569 (mh-header-field-end) | |
570 (buffer-substring start (point)))) | |
571 "")) | |
572 | |
573 (fset 'mh-get-field 'mh-get-header-field) ;mh-e 4 compatibility | |
6365 | 574 |
11332 | 575 (defun mh-goto-header-field (field) |
576 ;; Move to FIELD in the message header. | |
577 ;; Move to the end of the FIELD name, which should end in a colon. | |
578 ;; Returns T if found, NIL if not. | |
579 (goto-char (point-min)) | |
580 (let ((case-fold-search t) | |
581 (headers-end (save-excursion | |
582 (mh-goto-header-end 0) | |
583 (point)))) | |
584 (re-search-forward (format "^%s" field) headers-end t))) | |
585 | |
586 (defun mh-header-field-end () | |
587 ;; Move to the end of the current header field. | |
588 ;; Handles RFC 822 continuation lines. | |
589 (forward-line 1) | |
590 (while (looking-at "^[ \t]") | |
591 (forward-line 1)) | |
592 (backward-char 1)) ;to end of previous line | |
593 | |
6365 | 594 |
595 (defun mh-goto-header-end (arg) | |
596 ;; Find the end of the message header in the current buffer and position | |
597 ;; the cursor at the ARG'th newline after the header. | |
11507 | 598 (if (re-search-forward "^-*$" nil nil) |
6365 | 599 (forward-line arg))) |
600 | |
601 | |
602 (defun mh-read-address (prompt) | |
603 ;; Read a To: or Cc: address, prompting in the minibuffer with PROMPT. | |
604 ;; May someday do completion on aliases. | |
605 (read-string prompt)) | |
606 | |
607 | |
608 | |
609 ;;; Mode for composing and sending a draft message. | |
610 | |
11332 | 611 (defvar mh-sent-from-folder nil) ;Folder of msg assoc with this letter. |
6365 | 612 |
11332 | 613 (defvar mh-sent-from-msg nil) ;Number of msg assoc with this letter. |
6365 | 614 |
11332 | 615 (defvar mh-send-args nil) ;Extra args to pass to "send" command. |
6365 | 616 |
11332 | 617 (defvar mh-annotate-char nil) ;Character to use to annotate mh-sent-from-msg. |
6365 | 618 |
11332 | 619 (defvar mh-annotate-field nil) ;Field name for message annotation. |
6365 | 620 |
621 (put 'mh-letter-mode 'mode-class 'special) | |
622 | |
623 ;;;###autoload | |
624 (defun mh-letter-mode () | |
625 "Mode for composing letters in mh-e.\\<mh-letter-mode-map> | |
11332 | 626 When you have finished composing, type \\[mh-send-letter] to send the message |
627 using the MH mail handling system. | |
628 See the documentation for \\[mh-edit-mhn] for information on composing MIME | |
629 messages. | |
6365 | 630 |
631 \\{mh-letter-mode-map} | |
632 | |
633 Variables controlling this mode (defaults in parentheses): | |
634 | |
635 mh-delete-yanked-msg-window (nil) | |
636 If non-nil, \\[mh-yank-cur-msg] will delete any windows displaying | |
637 the yanked message. | |
638 | |
639 mh-yank-from-start-of-msg (t) | |
640 If non-nil, \\[mh-yank-cur-msg] will include the entire message. | |
641 If `body', just yank the body (no header). | |
642 If nil, only the portion of the message following the point will be yanked. | |
643 If there is a region, this variable is ignored. | |
644 | |
11332 | 645 mh-ins-buf-prefix (\"> \") |
646 String to insert before each non-blank line of a message as it is | |
647 inserted in a draft letter. | |
648 | |
6365 | 649 mh-signature-file-name (\"~/.signature\") |
650 File to be inserted into message by \\[mh-insert-signature]. | |
651 | |
652 Upon invoking mh-letter-mode, text-mode-hook and mh-letter-mode-hook are | |
653 invoked with no args, if those values are non-nil." | |
654 | |
655 (interactive) | |
656 (or mh-user-path (mh-find-path)) | |
657 (make-local-variable 'paragraph-start) | |
11332 | 658 (setq paragraph-start (concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-start)) |
6365 | 659 (make-local-variable 'paragraph-separate) |
660 (setq paragraph-separate | |
11332 | 661 (concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-separate)) |
6365 | 662 (make-local-variable 'mh-send-args) |
663 (make-local-variable 'mh-annotate-char) | |
664 (make-local-variable 'mh-annotate-field) | |
665 (make-local-variable 'mh-previous-window-config) | |
666 (make-local-variable 'mh-sent-from-folder) | |
667 (make-local-variable 'mh-sent-from-msg) | |
668 (make-local-variable 'mail-header-separator) | |
669 (setq mail-header-separator "--------") ;for Hyperbole | |
670 (use-local-map mh-letter-mode-map) | |
671 (setq major-mode 'mh-letter-mode) | |
672 (mh-set-mode-name "MH-Letter") | |
673 (set-syntax-table mh-letter-mode-syntax-table) | |
674 (run-hooks 'text-mode-hook) | |
675 ;; if text-mode-hook turned on auto-fill, tune it for messages | |
676 (cond ((and (boundp 'auto-fill-hook) auto-fill-hook) ;emacs 18 | |
677 (make-local-variable 'auto-fill-hook) | |
678 (setq auto-fill-hook 'mh-auto-fill-for-letter))) | |
679 (cond ((and (boundp 'auto-fill-function) auto-fill-function) ;emacs 19 | |
680 (make-local-variable 'auto-fill-function) | |
681 (setq auto-fill-function 'mh-auto-fill-for-letter))) | |
682 (run-hooks 'mh-letter-mode-hook)) | |
683 | |
684 | |
685 (defun mh-auto-fill-for-letter () | |
686 ;; Auto-fill in letters treats the header specially by inserting a tab | |
687 ;; before continuation line. | |
688 (if (mh-in-header-p) | |
11507 | 689 (let ((fill-prefix "\t")) |
690 (do-auto-fill)) | |
691 (do-auto-fill))) | |
6365 | 692 |
693 | |
694 (defun mh-in-header-p () | |
695 ;; Return non-nil if the point is in the header of a draft message. | |
696 (save-excursion | |
697 (let ((cur-point (point))) | |
698 (goto-char (point-min)) | |
699 (re-search-forward "^-*$" nil t) | |
700 (< cur-point (point))))) | |
701 | |
702 | |
703 (defun mh-to-field () | |
704 "Move point to the end of a specified header field. | |
705 The field is indicated by the previous keystroke (the last keystroke | |
11332 | 706 of the command) according to the list in the variable mh-to-field-choices. |
6365 | 707 Create the field if it does not exist. Set the mark to point before moving." |
708 (interactive) | |
709 (expand-abbrev) | |
11332 | 710 (let ((target (cdr (or (assoc (char-to-string (logior last-input-char ?`)) |
711 mh-to-field-choices) | |
712 ;; also look for a char for version 4 compat | |
713 (assoc (logior last-input-char ?`) mh-to-field-choices)))) | |
6365 | 714 (case-fold-search t)) |
715 (push-mark) | |
716 (cond ((mh-position-on-field target) | |
717 (let ((eol (point))) | |
718 (skip-chars-backward " \t") | |
719 (delete-region (point) eol)) | |
720 (if (and (not (eq (logior last-input-char ?`) ?s)) | |
721 (save-excursion | |
722 (backward-char 1) | |
723 (not (looking-at "[:,]")))) | |
724 (insert ", ") | |
725 (insert " "))) | |
726 (t | |
727 (if (mh-position-on-field "To:") | |
728 (forward-line 1)) | |
729 (insert (format "%s \n" target)) | |
730 (backward-char 1))))) | |
731 | |
732 | |
733 (defun mh-to-fcc (&optional folder) | |
734 "Insert an Fcc: FOLDER field in the current message. | |
735 Prompt for the field name with a completion list of the current folders." | |
736 (interactive) | |
737 (or folder | |
738 (setq folder (mh-prompt-for-folder | |
739 "Fcc" | |
11332 | 740 (or (and mh-default-folder-for-message-function |
6365 | 741 (save-excursion |
742 (goto-char (point-min)) | |
11332 | 743 (funcall mh-default-folder-for-message-function))) |
6365 | 744 "") |
745 t))) | |
746 (let ((last-input-char ?\C-f)) | |
747 (expand-abbrev) | |
748 (save-excursion | |
749 (mh-to-field) | |
750 (insert (if (mh-folder-name-p folder) | |
751 (substring folder 1) | |
752 folder))))) | |
753 | |
754 | |
755 (defun mh-insert-signature () | |
756 "Insert the file named by mh-signature-file-name at the current point." | |
757 (interactive) | |
758 (insert-file-contents mh-signature-file-name) | |
11578
d8480e4513ea
(mh-insert-signature): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
11507
diff
changeset
|
759 (force-mode-line-update)) |
6365 | 760 |
761 | |
762 (defun mh-check-whom () | |
11332 | 763 "Verify recipients of the current letter, showing expansion of any aliases." |
6365 | 764 (interactive) |
11332 | 765 (let ((file-name buffer-file-name)) |
6365 | 766 (save-buffer) |
767 (message "Checking recipients...") | |
768 (mh-in-show-buffer ("*Recipients*") | |
769 (bury-buffer (current-buffer)) | |
770 (erase-buffer) | |
771 (mh-exec-cmd-output "whom" t file-name)) | |
772 (message "Checking recipients...done"))) | |
773 | |
774 | |
775 | |
776 ;;; Routines to compose and send a letter. | |
777 | |
778 (defun mh-compose-and-send-mail (draft send-args | |
779 sent-from-folder sent-from-msg | |
780 to subject cc | |
781 annotate-char annotate-field | |
782 config) | |
783 ;; Edit and compose a draft message in buffer DRAFT and send or save it. | |
784 ;; SENT-FROM-FOLDER is buffer containing scan listing of current folder, or | |
785 ;; nil if none exists. | |
786 ;; SENT-FROM-MSG is the message number or sequence name or nil. | |
787 ;; SEND-ARGS is an optional argument passed to the send command. | |
788 ;; The TO, SUBJECT, and CC fields are passed to the | |
789 ;; mh-compose-letter-function. | |
790 ;; If ANNOTATE-CHAR is non-null, it is used to notate the scan listing of the | |
791 ;; message. In that case, the ANNOTATE-FIELD is used to build a string | |
792 ;; for mh-annotate-msg. | |
793 ;; CONFIG is the window configuration to restore after sending the letter. | |
794 (pop-to-buffer draft) | |
795 (mh-letter-mode) | |
796 (setq mh-sent-from-folder sent-from-folder) | |
797 (setq mh-sent-from-msg sent-from-msg) | |
798 (setq mh-send-args send-args) | |
799 (setq mh-annotate-char annotate-char) | |
800 (setq mh-annotate-field annotate-field) | |
801 (setq mh-previous-window-config config) | |
802 (setq mode-line-buffer-identification (list "{%b}")) | |
803 (if (and (boundp 'mh-compose-letter-function) | |
11332 | 804 mh-compose-letter-function) |
6365 | 805 ;; run-hooks will not pass arguments. |
11332 | 806 (let ((value mh-compose-letter-function)) |
6365 | 807 (if (and (listp value) (not (eq (car value) 'lambda))) |
808 (while value | |
809 (funcall (car value) to subject cc) | |
810 (setq value (cdr value))) | |
811 (funcall mh-compose-letter-function to subject cc))))) | |
812 | |
813 | |
814 (defun mh-send-letter (&optional arg) | |
815 "Send the draft letter in the current buffer. | |
816 If optional prefix argument is provided, monitor delivery. | |
817 Run mh-before-send-letter-hook before doing anything." | |
818 (interactive "P") | |
819 (run-hooks 'mh-before-send-letter-hook) | |
820 (set-buffer-modified-p t) ; Make sure buffer is written | |
821 (save-buffer) | |
822 (message "Sending...") | |
823 (let ((draft-buffer (current-buffer)) | |
11332 | 824 (file-name buffer-file-name) |
6365 | 825 (config mh-previous-window-config)) |
826 (cond (arg | |
827 (pop-to-buffer "MH mail delivery") | |
828 (erase-buffer) | |
829 (mh-exec-cmd-output mh-send-prog t "-watch" "-nopush" | |
830 "-nodraftfolder" mh-send-args file-name) | |
831 (goto-char (point-max)) ; show the interesting part | |
832 (recenter -1) | |
833 (set-buffer draft-buffer)) ; for annotation below | |
834 (t | |
835 (mh-exec-cmd-daemon mh-send-prog "-nodraftfolder" "-noverbose" | |
836 mh-send-args file-name))) | |
837 (if mh-annotate-char | |
838 (mh-annotate-msg mh-sent-from-msg | |
839 mh-sent-from-folder | |
840 mh-annotate-char | |
841 "-component" mh-annotate-field | |
842 "-text" (format "\"%s %s\"" | |
11332 | 843 (mh-get-header-field "To:") |
844 (mh-get-header-field "Cc:")))) | |
6365 | 845 |
846 (cond ((or (not arg) | |
847 (y-or-n-p "Kill draft buffer? ")) | |
848 (kill-buffer draft-buffer) | |
849 (if config | |
850 (set-window-configuration config)))) | |
851 (if arg | |
852 (message "Sending...done") | |
853 (message "Sending...backgrounded")))) | |
854 | |
855 | |
11332 | 856 (defun mh-insert-letter (folder message verbatim) |
857 "Insert a message into the current letter. | |
858 Removes the message's headers using mh-invisible-headers. Prefixes | |
859 each non-blank line with mh-ins-buf-prefix. Prompts for FOLDER and | |
860 MESSAGE. If prefix argument VERBATIM provided, do not indent and do | |
861 not delete headers. Leaves the mark before the letter and point after it." | |
6365 | 862 (interactive |
11332 | 863 (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil) |
864 (read-input (format "Message number%s: " | |
6365 | 865 (if mh-sent-from-msg |
866 (format " [%d]" mh-sent-from-msg) | |
11332 | 867 ""))) |
6365 | 868 current-prefix-arg)) |
869 (save-restriction | |
870 (narrow-to-region (point) (point)) | |
871 (let ((start (point-min))) | |
11332 | 872 (if (equal message "") (setq message (int-to-string mh-sent-from-msg))) |
6365 | 873 (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" |
11332 | 874 (expand-file-name message |
6365 | 875 (mh-expand-file-name folder))) |
11332 | 876 (cond ((not verbatim) |
6365 | 877 (mh-clean-msg-header start mh-invisible-headers mh-visible-headers) |
878 (set-mark start) ; since mh-clean-msg-header moves it | |
879 (mh-insert-prefix-string mh-ins-buf-prefix)))))) | |
880 | |
881 | |
882 (defun mh-yank-cur-msg () | |
883 "Insert the current message into the draft buffer. | |
884 Prefix each non-blank line in the message with the string in | |
885 `mh-ins-buf-prefix'. If a region is set in the message's buffer, then | |
886 only the region will be inserted. Otherwise, the entire message will | |
887 be inserted if `mh-yank-from-start-of-msg' is non-nil. If this variable | |
888 is nil, the portion of the message following the point will be yanked. | |
889 If `mh-delete-yanked-msg-window' is non-nil, any window displaying the | |
890 yanked message will be deleted." | |
891 (interactive) | |
892 (if (and mh-sent-from-folder mh-sent-from-msg) | |
893 (let ((to-point (point)) | |
894 (to-buffer (current-buffer))) | |
895 (set-buffer mh-sent-from-folder) | |
896 (if mh-delete-yanked-msg-window | |
897 (delete-windows-on mh-show-buffer)) | |
898 (set-buffer mh-show-buffer) ; Find displayed message | |
899 (let ((mh-ins-str (cond ((if (boundp 'mark-active) | |
11332 | 900 mark-active ;Emacs 19 |
901 (mark)) ;Emacs 18 | |
6365 | 902 (buffer-substring (region-beginning) |
903 (region-end))) | |
904 ((eq 'body mh-yank-from-start-of-msg) | |
905 (buffer-substring | |
906 (save-excursion | |
907 (goto-char (point-min)) | |
908 (mh-goto-header-end 1) | |
909 (point)) | |
910 (point-max))) | |
911 (mh-yank-from-start-of-msg | |
912 (buffer-substring (point-min) (point-max))) | |
913 (t | |
914 (buffer-substring (point) (point-max)))))) | |
915 (set-buffer to-buffer) | |
11332 | 916 (save-restriction |
917 (narrow-to-region to-point to-point) | |
918 (push-mark) | |
919 (insert mh-ins-str) | |
920 (mh-insert-prefix-string mh-ins-buf-prefix) | |
921 (insert "\n")))) | |
922 (error "There is no current message"))) | |
6365 | 923 |
924 | |
925 (defun mh-insert-prefix-string (mh-ins-string) | |
11332 | 926 ;; Run mail-citation-hook to insert a prefix string before each line |
6365 | 927 ;; in the buffer. Generality for supercite users. |
11332 | 928 (set-mark (point-max)) |
929 (goto-char (point-min)) | |
930 (cond (mail-citation-hook | |
931 (run-hooks 'mail-citation-hook)) | |
932 (mh-yank-hooks ;old hook name | |
933 (run-hooks 'mh-yank-hooks)) | |
934 (t | |
935 (or (bolp) (forward-line 1)) | |
936 (let ((zmacs-regions nil)) ;so "(mark)" works in XEmacs | |
6365 | 937 (while (< (point) (mark)) |
938 (insert mh-ins-string) | |
939 (forward-line 1)))))) | |
940 | |
941 | |
942 (defun mh-fully-kill-draft () | |
943 "Kill the draft message file and the draft message buffer. | |
944 Use \\[kill-buffer] if you don't want to delete the draft message file." | |
945 (interactive) | |
946 (if (y-or-n-p "Kill draft message? ") | |
947 (let ((config mh-previous-window-config)) | |
11332 | 948 (if (file-exists-p buffer-file-name) |
949 (delete-file buffer-file-name)) | |
6365 | 950 (set-buffer-modified-p nil) |
951 (kill-buffer (buffer-name)) | |
952 (message "") | |
953 (if config | |
954 (set-window-configuration config))) | |
955 (error "Message not killed"))) | |
956 | |
11332 | 957 |
6365 | 958 ;;; Build the letter-mode keymap: |
959 | |
960 (define-key mh-letter-mode-map "\C-c\C-f\C-b" 'mh-to-field) | |
961 (define-key mh-letter-mode-map "\C-c\C-f\C-c" 'mh-to-field) | |
11332 | 962 (define-key mh-letter-mode-map "\C-c\C-f\C-d" 'mh-to-field) |
6365 | 963 (define-key mh-letter-mode-map "\C-c\C-f\C-f" 'mh-to-fcc) |
11332 | 964 (define-key mh-letter-mode-map "\C-c\C-f\C-r" 'mh-to-field) |
6365 | 965 (define-key mh-letter-mode-map "\C-c\C-f\C-s" 'mh-to-field) |
966 (define-key mh-letter-mode-map "\C-c\C-f\C-t" 'mh-to-field) | |
967 (define-key mh-letter-mode-map "\C-c\C-fb" 'mh-to-field) | |
968 (define-key mh-letter-mode-map "\C-c\C-fc" 'mh-to-field) | |
11332 | 969 (define-key mh-letter-mode-map "\C-c\C-fd" 'mh-to-field) |
6365 | 970 (define-key mh-letter-mode-map "\C-c\C-ff" 'mh-to-fcc) |
11332 | 971 (define-key mh-letter-mode-map "\C-c\C-fr" 'mh-to-field) |
6365 | 972 (define-key mh-letter-mode-map "\C-c\C-fs" 'mh-to-field) |
973 (define-key mh-letter-mode-map "\C-c\C-ft" 'mh-to-field) | |
11332 | 974 (define-key mh-letter-mode-map "\C-c\C-i" 'mh-insert-letter) |
6365 | 975 (define-key mh-letter-mode-map "\C-c\C-q" 'mh-fully-kill-draft) |
11332 | 976 (define-key mh-letter-mode-map "\C-c\C-\\" 'mh-fully-kill-draft) ;if no C-q |
977 (define-key mh-letter-mode-map "\C-c\C-s" 'mh-insert-signature) | |
978 (define-key mh-letter-mode-map "\C-c\C-^" 'mh-insert-signature) ;if no C-s | |
6365 | 979 (define-key mh-letter-mode-map "\C-c\C-w" 'mh-check-whom) |
980 (define-key mh-letter-mode-map "\C-c\C-y" 'mh-yank-cur-msg) | |
981 (define-key mh-letter-mode-map "\C-c\C-c" 'mh-send-letter) | |
982 (define-key mh-letter-mode-map "\C-c\C-m\C-f" 'mh-mhn-compose-forw) | |
983 (define-key mh-letter-mode-map "\C-c\C-m\C-e" 'mh-mhn-compose-anon-ftp) | |
984 (define-key mh-letter-mode-map "\C-c\C-m\C-t" 'mh-mhn-compose-external-compressed-tar) | |
985 (define-key mh-letter-mode-map "\C-c\C-m\C-i" 'mh-mhn-compose-insertion) | |
986 (define-key mh-letter-mode-map "\C-c\C-e" 'mh-edit-mhn) | |
987 (define-key mh-letter-mode-map "\C-c\C-m\C-u" 'mh-revert-mhn-edit) | |
988 | |
989 | |
990 ;;; autoloads from mh-mime | |
991 | |
992 (autoload 'mh-mhn-compose-insertion "mh-mime" | |
11507 | 993 "Add a directive to insert a MIME message part from a file. |
11332 | 994 This is the typical way to insert non-text parts in a message. |
995 See also \\[mh-edit-mhn]." t) | |
996 | |
6365 | 997 (autoload 'mh-mhn-compose-anon-ftp "mh-mime" |
11507 | 998 "Add a directive for a MIME anonymous ftp external body part. |
11332 | 999 This directive tells MH to include a reference to a |
1000 message/external-body part retrievable by anonymous FTP. | |
1001 See also \\[mh-edit-mhn]." t) | |
1002 | |
6365 | 1003 (autoload 'mh-mhn-compose-external-compressed-tar "mh-mime" |
11507 | 1004 "Add a directive to include a MIME reference to a compressed tar file. |
11332 | 1005 The file should be available via anonymous ftp. This directive |
1006 tells MH to include a reference to a message/external-body part. | |
1007 See also \\[mh-edit-mhn]." t) | |
1008 | |
6365 | 1009 (autoload 'mh-mhn-compose-forw "mh-mime" |
11507 | 1010 "Add a forw directive to this message, to forward a message with MIME. |
11332 | 1011 This directive tells MH to include another message in this one. |
1012 See also \\[mh-edit-mhn]." t) | |
1013 | |
6365 | 1014 (autoload 'mh-edit-mhn "mh-mime" |
11332 | 1015 "Format the current draft for MIME, expanding any mhn directives. |
1016 Process the current draft with the mhn program, which, | |
1017 using directives already inserted in the draft, fills in | |
6365 | 1018 all the MIME components and header fields. |
1019 This step should be done last just before sending the message. | |
1020 The mhn program is part of MH version 6.8 or later. | |
1021 The `\\[mh-revert-mhn-edit]' command undoes this command. | |
11332 | 1022 For assistance with creating mhn directives to insert |
6365 | 1023 various types of components in a message, see |
1024 \\[mh-mhn-compose-insertion] (generic insertion from a file), | |
1025 \\[mh-mhn-compose-anon-ftp] (external reference to file via anonymous ftp), | |
1026 \\[mh-mhn-compose-external-compressed-tar] \ | |
1027 \(reference to compressed tar file via anonymous ftp), and | |
1028 \\[mh-mhn-compose-forw] (forward message)." t) | |
1029 | |
1030 (autoload 'mh-revert-mhn-edit "mh-mime" | |
11332 | 1031 "Undoes the effect of \\[mh-edit-mhn] by reverting to the backup file. |
1032 Optional non-nil argument means don't ask for confirmation." t) |