1 ;;; mh-comp.el --- MH-E functions for composing messages
3 ;; Copyright (C) 1993, 1995, 1997,
4 ;; 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 ;; Author: Bill Wohler <wohler@newt.com>
7 ;; Maintainer: Bill Wohler <wohler@newt.com>
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
30 ;; Internal support for MH-E package.
36 (eval-when-compile (require 'mh-acros
))
42 (eval-when (compile load eval
)
43 (ignore-errors (require 'mailabbrev
)))
45 ;; Shush the byte-compiler
46 (defvar adaptive-fill-first-line-regexp
)
47 (defvar font-lock-defaults
)
49 (defvar sendmail-coding-system
)
50 (defvar mh-identity-list
)
51 (defvar mh-identity-default
)
52 (defvar mh-mml-mode-default
)
53 (defvar mh-identity-menu
)
56 (autoload 'mail-mode-fill-paragraph
"sendmail")
57 (autoload 'mm-handle-displayed-p
"mm-decode")
59 (autoload 'sc-cite-original
"sc"
60 "Workhorse citing function which performs the initial citation.
61 This is callable from the various mail and news readers' reply
62 function according to the agreed upon standard. See `sc-describe'
63 for more details. `sc-cite-original' does not do any yanking of the
64 original message but it does require a few things:
66 1) The reply buffer is the current buffer.
68 2) The original message has been yanked and inserted into the
71 3) Verbose mail headers from the original message have been
72 inserted into the reply buffer directly before the text of the
75 4) Point is at the beginning of the verbose headers.
77 5) Mark is at the end of the body of text to be cited.
79 For Emacs 19's, the region need not be active (and typically isn't
80 when this function is called. Also, the hook `sc-pre-hook' is run
81 before, and `sc-post-hook' is run after the guts of this function.")
83 ;;; Site customization (see also mh-utils.el):
85 (defvar mh-send-prog
"send"
86 "Name of the MH send program.
87 Some sites need to change this because of a name conflict.")
89 (defvar mh-redist-full-contents nil
90 "Non-nil if the `dist' command needs whole letter for redistribution.
91 This is the case only when `send' is compiled with the BERK option.
92 If MH will not allow you to redist a previously redist'd msg, set to nil.")
94 (defvar mh-redist-background nil
95 "If non-nil redist will be done in background like send.
96 This allows transaction log to be visible if -watch, -verbose or -snoop are
101 (defvar mh-note-repl ?-
102 "Messages that have been replied to are marked by this character.")
104 (defvar mh-note-forw ?F
105 "Messages that have been forwarded are marked by this character.")
107 (defvar mh-note-dist ?R
108 "Messages that have been redistributed are marked by this character.")
110 (defvar mh-yank-hooks nil
111 "Obsolete hook for modifying a citation just inserted in the mail buffer.
112 Each hook function can find the citation between point and mark.
113 And each hook function should leave point and mark around the citation
116 This is a normal hook, misnamed for historical reasons.
117 It is semi-obsolete and is only used if `mail-citation-hook' is nil.")
119 (defvar mh-comp-formfile
"components"
120 "Name of file to be used as a skeleton for composing messages.
121 Default is \"components\". If not an absolute file name, the file
122 is searched for first in the user's MH directory, then in the
123 system MH lib directory.")
125 (defvar mh-repl-formfile
"replcomps"
126 "Name of file to be used as a skeleton for replying to messages.
127 Default is \"replcomps\". If not an absolute file name, the file
128 is searched for first in the user's MH directory, then in the
129 system MH lib directory.")
131 (defvar mh-repl-group-formfile
"replgroupcomps"
132 "Name of file to be used as a skeleton for replying to messages.
133 This file is used to form replies to the sender and all recipients of a
134 message. Only used if `(mh-variant-p 'nmh)' is non-nil.
135 Default is \"replgroupcomps\".
136 If not an absolute file name, the file is searched for first in the user's MH
137 directory, then in the system MH lib directory.")
139 (defvar mh-rejected-letter-start
142 '("Content-Type: message/rfc822" ;MIME MDN
143 "------ This is a copy of the message, including all the headers. ------";from exim
144 "--- Below this line is a copy of the message."; from qmail
145 " ----- Unsent message follows -----" ;from sendmail V5
146 " --------Unsent Message below:" ; from sendmail at BU
147 " ----- Original message follows -----" ;from sendmail V8
148 "------- Unsent Draft" ;from MH itself
149 "---------- Original Message ----------" ;from zmailer
150 " --- The unsent message follows ---" ;from AIX mail system
151 " Your message follows:" ;from MMDF-II
152 "Content-Description: Returned Content" ;1993 KJ sendmail
155 (defvar mh-new-draft-cleaned-headers
156 "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:"
157 "Regexp of header lines to remove before offering a message as a new draft.
158 Used by the \\<mh-folder-mode-map>`\\[mh-edit-again]' and `\\[mh-extract-rejected-mail]' commands.")
160 (defvar mh-to-field-choices
'(("t" .
"To:") ("s" .
"Subject:") ("c" .
"Cc:")
161 ("b" .
"Bcc:") ("f" .
"Fcc:") ("r" .
"From:")
163 "Alist of (final-character . field-name) choices for `mh-to-field'.")
165 (defvar mh-letter-mode-map
(copy-keymap text-mode-map
)
166 "Keymap for composing mail.")
168 (defvar mh-letter-mode-syntax-table nil
169 "Syntax table used by MH-E while in MH-Letter mode.")
171 (if mh-letter-mode-syntax-table
173 (setq mh-letter-mode-syntax-table
174 (make-syntax-table text-mode-syntax-table
))
175 (modify-syntax-entry ?%
"." mh-letter-mode-syntax-table
))
177 (defvar mh-sent-from-folder nil
178 "Folder of msg assoc with this letter.")
180 (defvar mh-sent-from-msg nil
181 "Number of msg assoc with this letter.")
183 (defvar mh-send-args nil
184 "Extra args to pass to \"send\" command.")
186 (defvar mh-annotate-char nil
187 "Character to use to annotate `mh-sent-from-msg'.")
189 (defvar mh-annotate-field nil
190 "Field name for message annotation.")
192 (defvar mh-insert-auto-fields-done-local nil
193 "Buffer-local variable set when `mh-insert-auto-fields' called successfully.")
194 (make-variable-buffer-local 'mh-insert-auto-fields-done-local
)
198 "Compose and send mail with the MH mail system.
199 This function is an entry point to MH-E, the Emacs interface to the MH mail
202 See `mh-send' for more details on composing mail."
205 (call-interactively 'mh-send
))
207 (defvar mh-error-if-no-draft nil
) ;raise error over using old draft
210 (defun mh-smail-batch (&optional to subject other-headers
&rest ignored
)
211 "Set up a mail composition draft with the MH mail system.
212 This function is an entry point to MH-E, the Emacs interface to the MH mail
213 system. This function does not prompt the user for any header fields, and thus
214 is suitable for use by programs that want to create a mail buffer. Users
215 should use `mh-smail' to compose mail.
217 Optional arguments for setting certain fields include TO, SUBJECT, and
218 OTHER-HEADERS. Additional arguments are IGNORED."
220 (let ((mh-error-if-no-draft t
))
221 (mh-send (or to
"") "" (or subject
""))))
223 ;; XEmacs needs this:
225 (defun mh-user-agent-compose (&optional to subject other-headers continue
226 switch-function yank-action
228 "Set up mail composition draft with the MH mail system.
229 This is `mail-user-agent' entry point to MH-E.
231 The optional arguments TO and SUBJECT specify recipients and the
232 initial Subject field, respectively.
234 OTHER-HEADERS is an alist specifying additional
235 header fields. Elements look like (HEADER . VALUE) where both
236 HEADER and VALUE are strings.
238 CONTINUE, SWITCH-FUNCTION, YANK-ACTION and SEND-ACTIONS are ignored."
240 (let ((mh-error-if-no-draft t
))
241 (mh-send to
"" subject
)
243 (mh-insert-fields (concat (car (car other-headers
)) ":")
244 (cdr (car other-headers
)))
245 (setq other-headers
(cdr other-headers
)))))
248 (defun mh-edit-again (msg)
249 "Clean up a draft or a message MSG previously sent and make it resendable.
250 Default is the current message.
251 The variable `mh-new-draft-cleaned-headers' specifies the headers to remove.
254 (interactive (list (mh-get-msg-num t
)))
255 (let* ((from-folder mh-current-folder
)
256 (config (current-window-configuration))
258 (cond ((and mh-draft-folder
(equal from-folder mh-draft-folder
))
259 (pop-to-buffer (find-file-noselect (mh-msg-filename msg
)) t
)
260 (rename-buffer (format "draft-%d" msg
))
261 ;; Make buffer writable...
262 (setq buffer-read-only nil
)
263 ;; If buffer was being used to display the message reinsert
265 (when (eq major-mode
'mh-show-mode
)
267 (insert-file-contents buffer-file-name
))
270 (mh-read-draft "clean-up" (mh-msg-filename msg
) nil
)))))
271 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil
)
272 (mh-insert-header-separator)
273 (goto-char (point-min))
275 (mh-compose-and-send-mail draft
"" from-folder nil nil nil nil nil nil
277 (mh-letter-mode-message)
278 (mh-letter-adjust-point)))
281 (defun mh-extract-rejected-mail (msg)
282 "Extract message MSG returned by the mail system and make it resendable.
283 Default is the current message. The variable `mh-new-draft-cleaned-headers'
284 gives the headers to clean out of the original message.
287 (interactive (list (mh-get-msg-num t
)))
288 (let ((from-folder mh-current-folder
)
289 (config (current-window-configuration))
290 (draft (mh-read-draft "extraction" (mh-msg-filename msg
) nil
)))
291 (goto-char (point-min))
292 (cond ((re-search-forward mh-rejected-letter-start nil t
)
293 (skip-chars-forward " \t\n")
294 (delete-region (point-min) (point))
295 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil
))
297 (message "Does not appear to be a rejected letter")))
298 (mh-insert-header-separator)
299 (goto-char (point-min))
301 (mh-compose-and-send-mail draft
"" from-folder msg
302 (mh-get-header-field "To:")
303 (mh-get-header-field "From:")
304 (mh-get-header-field "Cc:")
306 (mh-letter-mode-message)))
309 (defun mh-forward (to cc
&optional range
)
310 "Forward messages to the recipients TO and CC.
311 Use optional RANGE argument to specify a message or sequence to forward.
312 Default is the displayed message.
314 Check the documentation of `mh-interactive-range' to see how RANGE is read in
318 (interactive (list (mh-interactive-read-address "To: ")
319 (mh-interactive-read-address "Cc: ")
320 (mh-interactive-range "Forward")))
321 (let* ((folder mh-current-folder
)
322 (msgs (mh-range-to-msg-list range
))
323 (config (current-window-configuration))
324 (fwd-msg-file (mh-msg-filename (car msgs
) folder
))
325 ;; forw always leaves file in "draft" since it doesn't have -draft
326 (draft-name (expand-file-name "draft" mh-user-path
))
327 (draft (cond ((or (not (file-exists-p draft-name
))
328 (y-or-n-p "The file 'draft' exists. Discard it? "))
329 (mh-exec-cmd "forw" "-build"
330 (if (and (mh-variant-p 'nmh
)
331 mh-compose-forward-as-mime-flag
)
334 (mh-coalesce-msg-list msgs
))
336 (mh-read-draft "" draft-name t
)
337 (mh-insert-fields "To:" to
"Cc:" cc
)
340 (mh-read-draft "" draft-name nil
)))))
344 (set-buffer (get-buffer-create mh-temp-buffer
))
346 (insert-file-contents fwd-msg-file
)
347 (setq orig-from
(mh-get-header-field "From:"))
348 (setq orig-subject
(mh-get-header-field "Subject:")))
350 (mh-forwarded-letter-subject orig-from orig-subject
)))
351 (mh-insert-fields "Subject:" forw-subject
)
352 (goto-char (point-min))
353 ;; If using MML, translate mhn
354 (if (equal mh-compose-insertion
'gnus
)
356 (goto-char (mh-mail-header-end))
359 "^#forw \\[\\([^]]+\\)\\] \\(+\\S-+\\) \\(.*\\)$"
361 (let ((description (if (equal (match-string 1)
362 "forwarded messages")
363 "forwarded message %d"
365 (msgs (split-string (match-string 3)))
368 (delete-region (point) (progn (forward-line 1) (point)))
371 (mh-mml-forward-message (format description i
)
373 ;; Postition just before forwarded message
374 (if (re-search-forward "^------- Forwarded Message" nil t
)
376 (goto-char (mh-mail-header-end))
378 (delete-other-windows)
379 (mh-add-msgs-to-seq msgs
'forwarded t
)
380 (mh-compose-and-send-mail draft
"" folder msgs
382 mh-note-forw
"Forwarded:"
384 (mh-letter-mode-message)
385 (mh-letter-adjust-point)
386 (run-hooks 'mh-forward-hook
)))))
388 (defun mh-forwarded-letter-subject (from subject
)
389 "Return a Subject suitable for a forwarded message.
390 Original message has headers FROM and SUBJECT."
391 (let ((addr-start (string-match "<" from
))
392 (comment (string-match "(" from
)))
393 (cond ((and addr-start
(> addr-start
0))
394 ;; Full Name <luser@host>
395 (setq from
(substring from
0 (1- addr-start
))))
397 ;; luser@host (Full Name)
398 (setq from
(substring from
(1+ comment
) (1- (length from
)))))))
399 (format mh-forward-subject-format from subject
))
402 (defun mh-smail-other-window ()
403 "Compose and send mail in other window with the MH mail system.
404 This function is an entry point to MH-E, the Emacs interface to the MH mail
407 See `mh-send' for more details on composing mail."
410 (call-interactively 'mh-send-other-window
))
413 (defun mh-redistribute (to cc
&optional msg
)
414 "Redistribute displayed message to recipients TO and CC.
415 Use optional argument MSG to redistribute another message.
416 Depending on how your copy of MH was compiled, you may need to change the
417 setting of the variable `mh-redist-full-contents'. See its documentation."
418 (interactive (list (mh-read-address "Redist-To: ")
419 (mh-read-address "Redist-Cc: ")
422 (setq msg
(mh-get-msg-num t
)))
423 (save-window-excursion
424 (let ((folder mh-current-folder
)
425 (draft (mh-read-draft "redistribution"
426 (if mh-redist-full-contents
427 (mh-msg-filename msg
)
430 (mh-goto-header-end 0)
431 (insert "Resent-To: " to
"\n")
432 (if (not (equal cc
"")) (insert "Resent-cc: " cc
"\n"))
435 "^Message-Id:\\|^Received:\\|^Return-Path:\\|^Sender:\\|^Date:\\|^From:"
438 (message "Redistributing...")
439 (let ((env "mhdist=1"))
440 ;; Setup environment...
441 (setq env
(concat env
" mhaltmsg=" (if mh-redist-full-contents
443 (mh-msg-filename msg folder
))))
444 (unless mh-redist-full-contents
445 (setq env
(concat env
" mhannotate=1")))
447 (if mh-redist-background
448 (mh-exec-cmd-env-daemon env mh-send-prog nil buffer-file-name
)
449 (mh-exec-cmd-error env mh-send-prog
"-push" buffer-file-name
))
451 (mh-annotate-msg msg folder mh-note-dist
452 "-component" "Resent:"
453 "-text" (format "\"%s %s\"" to cc
)))
455 (message "Redistributing...done"))))
457 (defun mh-show-buffer-message-number (&optional buffer
)
458 "Message number of displayed message in corresponding show buffer.
459 Return nil if show buffer not displayed.
460 If in `mh-letter-mode', don't display the message number being replied to,
461 but rather the message number of the show buffer associated with our
462 originating folder buffer.
463 Optional argument BUFFER can be used to specify the buffer."
467 (cond ((eq major-mode
'mh-show-mode
)
468 (let ((number-start (mh-search-from-end ?
/ buffer-file-name
)))
469 (car (read-from-string (substring buffer-file-name
470 (1+ number-start
))))))
471 ((and (eq major-mode
'mh-folder-mode
)
473 (get-buffer mh-show-buffer
))
474 (mh-show-buffer-message-number mh-show-buffer
))
475 ((and (eq major-mode
'mh-letter-mode
)
477 (get-buffer mh-sent-from-folder
))
478 (mh-show-buffer-message-number mh-sent-from-folder
))
483 (defun mh-reply (message &optional reply-to includep
)
485 Default is the displayed message.
486 If the optional argument REPLY-TO is not given, prompts for type of addresses
489 to sender and primary recipients,
490 cc/all sender and all recipients.
491 If optional prefix argument INCLUDEP provided, then include the message
492 in the reply using filter `mhl.reply' in your MH directory.
493 If the file named by `mh-repl-formfile' exists, it is used as a skeleton for
494 the reply. If REPLY-TO is cc or all and you're using either the nmh or GNU
495 mailutils variants and the file names by `mh-repl-group-formfile' exists, it
501 (let ((minibuffer-help-form
502 "from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients"))
503 (or mh-reply-default-reply-to
504 (completing-read "Reply to whom: [from] "
505 '(("from") ("to") ("cc") ("all"))
509 (let* ((folder mh-current-folder
)
510 (show-buffer mh-show-buffer
)
511 (config (current-window-configuration))
512 (group-reply (or (equal reply-to
"cc") (equal reply-to
"all")))
513 (form-file (cond ((and (mh-variant-p 'nmh
'mu-mh
) group-reply
514 (stringp mh-repl-group-formfile
))
515 mh-repl-group-formfile
)
516 ((stringp mh-repl-formfile
) mh-repl-formfile
)
518 (message "Composing a reply...")
519 (mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder"
521 (list "-form" form-file
))
522 mh-current-folder message
523 (cond ((or (equal reply-to
"from") (equal reply-to
""))
525 ((equal reply-to
"to")
527 (group-reply (if (mh-variant-p 'nmh
'mu-mh
)
528 '("-group" "-nocc" "me")
529 '("-cc" "all" "-nocc" "me"))))
530 (cond ((or (eq mh-yank-from-start-of-msg
'autosupercite
)
531 (eq mh-yank-from-start-of-msg
'autoattrib
))
533 (includep '("-filter" "mhl.reply"))
535 (let ((draft (mh-read-draft "reply"
536 (expand-file-name "reply" mh-user-path
)
538 (delete-other-windows)
541 (let ((to (mh-get-header-field "To:"))
542 (subject (mh-get-header-field "Subject:"))
543 (cc (mh-get-header-field "Cc:")))
544 (goto-char (point-min))
545 (mh-goto-header-end 1)
547 (not mh-reply-show-message-flag
)
548 (mh-in-show-buffer (show-buffer)
549 (mh-display-msg message folder
)))
550 (mh-add-msgs-to-seq message
'answered t
)
551 (message "Composing a reply...done")
552 (mh-compose-and-send-mail draft
"" folder message to subject cc
553 mh-note-repl
"Replied:" config
))
554 (when (and (or (eq 'autosupercite mh-yank-from-start-of-msg
)
555 (eq 'autoattrib mh-yank-from-start-of-msg
))
556 (eq (mh-show-buffer-message-number) mh-sent-from-msg
))
559 (mh-letter-mode-message))))
562 (defun mh-send (to cc subject
)
563 "Compose and send a letter.
564 Do not call this function from outside MH-E; use \\[mh-smail] instead.
566 The file named by `mh-comp-formfile' will be used as the form.
567 The letter is composed in `mh-letter-mode'; see its documentation for more
569 If `mh-compose-letter-function' is defined, it is called on the draft and
570 passed three arguments: TO, CC, and SUBJECT."
572 (mh-interactive-read-address "To: ")
573 (mh-interactive-read-address "Cc: ")
574 (mh-interactive-read-string "Subject: ")))
575 (let ((config (current-window-configuration)))
576 (delete-other-windows)
577 (mh-send-sub to cc subject config
)))
580 (defun mh-send-other-window (to cc subject
)
581 "Compose and send a letter in another window.
582 Do not call this function from outside MH-E; use \\[mh-smail-other-window]
585 The file named by `mh-comp-formfile' will be used as the form.
586 The letter is composed in `mh-letter-mode'; see its documentation for more
588 If `mh-compose-letter-function' is defined, it is called on the draft and
589 passed three arguments: TO, CC, and SUBJECT."
591 (mh-interactive-read-address "To: ")
592 (mh-interactive-read-address "Cc: ")
593 (mh-interactive-read-string "Subject: ")))
594 (let ((pop-up-windows t
))
595 (mh-send-sub to cc subject
(current-window-configuration))))
597 (defun mh-send-sub (to cc subject config
)
598 "Do the real work of composing and sending a letter.
599 Expects the TO, CC, and SUBJECT fields as arguments.
600 CONFIG is the window configuration before sending mail."
601 (let ((folder mh-current-folder
)
602 (msg-num (mh-get-msg-num nil
)))
603 (message "Composing a message...")
604 (let ((draft (mh-read-draft
610 (expand-file-name mh-comp-formfile mh-user-path
)))
614 (expand-file-name mh-comp-formfile mh-lib
)))
618 (expand-file-name mh-comp-formfile
619 ;; What is this mh-etc ?? -sm
620 ;; This is dead code, so
622 ;(and (boundp 'mh-etc) mh-etc)
626 (error "Can't find components file \"%s\""
629 (mh-insert-fields "To:" to
"Subject:" subject
"Cc:" cc
)
630 (goto-char (point-max))
631 (mh-compose-and-send-mail draft
"" folder msg-num
634 (mh-letter-mode-message)
635 (mh-letter-adjust-point))))
637 (defun mh-read-draft (use initial-contents delete-contents-file
)
638 "Read draft file into a draft buffer and make that buffer the current one.
639 USE is a message used for prompting about the intended use of the message.
640 INITIAL-CONTENTS is filename that is read into an empty buffer, or nil
641 if buffer should not be modified. Delete the initial-contents file if
642 DELETE-CONTENTS-FILE flag is set.
643 Returns the draft folder's name.
644 If the draft folder facility is enabled in ~/.mh_profile, a new buffer is
645 used each time and saved in the draft folder. The draft file can then be
647 (cond (mh-draft-folder
648 (let ((orig-default-dir default-directory
)
649 (draft-file-name (mh-new-draft-name)))
650 (pop-to-buffer (generate-new-buffer
652 (file-name-nondirectory draft-file-name
))))
654 (insert-file-contents draft-file-name t
)
656 (setq default-directory orig-default-dir
)))
658 (let ((draft-name (expand-file-name "draft" mh-user-path
)))
659 (pop-to-buffer "draft") ; Create if necessary
660 (if (buffer-modified-p)
661 (if (y-or-n-p "Draft has been modified; kill anyway? ")
662 (set-buffer-modified-p nil
)
663 (error "Draft preserved")))
664 (setq buffer-file-name draft-name
)
665 (clear-visited-file-modtime)
667 (cond ((and (file-exists-p draft-name
)
668 (not (equal draft-name initial-contents
)))
669 (insert-file-contents draft-name
)
670 (delete-file draft-name
))))))
671 (cond ((and initial-contents
672 (or (zerop (buffer-size))
674 (format "A draft exists. Use for %s? " use
))
675 (if mh-error-if-no-draft
676 (error "A prior draft exists"))
679 (insert-file-contents initial-contents
)
680 (if delete-contents-file
(delete-file initial-contents
))))
683 (save-buffer)) ; Do not reuse draft name
686 (defun mh-new-draft-name ()
687 "Return the pathname of folder for draft messages."
689 (mh-exec-cmd-quiet t
"mhpath" mh-draft-folder
"new")
690 (buffer-substring (point-min) (1- (point-max)))))
692 (defun mh-annotate-msg (msg buffer note
&rest args
)
693 "Mark MSG in BUFFER with character NOTE and annotate message with ARGS.
694 MSG can be a message number, a list of message numbers, or a sequence."
695 (apply 'mh-exec-cmd
"anno" buffer
696 (if (listp msg
) (append msg args
) (cons msg args
)))
698 (cond ((get-buffer buffer
) ; Buffer may be deleted
700 (mh-iterate-on-range nil msg
701 (mh-notate nil note
(1+ mh-cmd-note
)))))))
703 (defun mh-insert-fields (&rest name-values
)
704 "Insert the NAME-VALUES pairs in the current buffer.
705 If the field exists, append the value to it.
706 Do not insert any pairs whose value is the empty string."
707 (let ((case-fold-search t
))
709 (let ((field-name (car name-values
))
710 (value (car (cdr name-values
))))
711 (if (not (string-match "^.*:$" field-name
))
712 (setq field-name
(concat field-name
":")))
713 (cond ((equal value
"")
715 ((mh-position-on-field field-name
)
716 (insert " " (or value
"")))
718 (insert field-name
" " value
"\n")))
719 (setq name-values
(cdr (cdr name-values
)))))))
721 (defun mh-position-on-field (field &optional ignored
)
722 "Move to the end of the FIELD in the header.
723 Move to end of entire header if FIELD not found.
724 Returns non-nil iff FIELD was found.
725 The optional second arg is for pre-version 4 compatibility and is IGNORED."
726 (cond ((mh-goto-header-field field
)
727 (mh-header-field-end)
729 ((mh-goto-header-end 0)
733 (defun mh-get-header-field (field)
734 "Find and return the body of FIELD in the mail header.
735 Returns the empty string if the field is not in the header of the
737 (if (mh-goto-header-field field
)
739 (skip-chars-forward " \t") ;strip leading white space in body
740 (let ((start (point)))
741 (mh-header-field-end)
742 (buffer-substring-no-properties start
(point))))
745 (fset 'mh-get-field
'mh-get-header-field
) ;MH-E 4 compatibility
747 (defun mh-goto-header-field (field)
748 "Move to FIELD in the message header.
749 Move to the end of the FIELD name, which should end in a colon.
750 Returns t if found, nil if not."
751 (goto-char (point-min))
752 (let ((case-fold-search t
)
753 (headers-end (save-excursion
754 (mh-goto-header-end 0)
756 (re-search-forward (format "^%s" field
) headers-end t
)))
758 (defun mh-goto-header-end (arg)
759 "Move the cursor ARG lines after the header."
760 (if (re-search-forward "^-*$" nil nil
)
763 (defun mh-extract-from-header-value ()
764 "Extract From: string from header."
766 (if (not (mh-goto-header-field "From:"))
768 (skip-chars-forward " \t")
769 (buffer-substring-no-properties
770 (point) (progn (mh-header-field-end)(point))))))
774 ;;; Mode for composing and sending a draft message.
776 (put 'mh-letter-mode
'mode-class
'special
)
778 ;;; Menu extracted from mh-menubar.el V1.1 (31 July 2001)
779 (eval-when-compile (defvar mh-letter-menu nil
))
781 mh-letter-menu mh-letter-mode-map
"Menu for MH-E letter mode."
783 ["Send This Draft" mh-send-letter t
]
784 ["Split Current Line" mh-open-line t
]
785 ["Check Recipient" mh-check-whom t
]
786 ["Yank Current Message" mh-yank-cur-msg t
]
787 ["Insert a Message..." mh-insert-letter t
]
788 ["Insert Signature" mh-insert-signature t
]
789 ("Encrypt/Sign Message"
791 mh-mml-secure-message-sign mh-gnus-pgp-support-flag
]
793 mh-mml-secure-message-encrypt mh-gnus-pgp-support-flag
]
794 ["Sign+Encrypt Message"
795 mh-mml-secure-message-signencrypt mh-gnus-pgp-support-flag
]
797 mh-mml-unsecure-message mh-gnus-pgp-support-flag
]
800 ["PGP (MIME)" (setq mh-mml-method-default
"pgpmime")
802 :selected
(equal mh-mml-method-default
"pgpmime")]
803 ["PGP" (setq mh-mml-method-default
"pgp")
805 :selected
(equal mh-mml-method-default
"pgp")]
806 ["S/MIME" (setq mh-mml-method-default
"smime")
808 :selected
(equal mh-mml-method-default
"smime")]
810 ["Save Method as Default"
811 (customize-save-variable 'mh-mml-method-default mh-mml-method-default
) t
]
813 ["Compose Insertion (MIME)..." mh-compose-insertion t
]
814 ["Compose Compressed tar (MIME)..."
815 mh-mhn-compose-external-compressed-tar t
]
816 ["Compose Get File (MIME)..." mh-mhn-compose-anon-ftp t
]
817 ["Compose Forward (MIME)..." mh-compose-forward t
]
818 ;; The next two will have to be merged. But I also need to make sure the
819 ;; user can't mix directives of both types.
820 ["Pull in All Compositions (mhn)"
821 mh-edit-mhn
(mh-mhn-directive-present-p)]
822 ["Pull in All Compositions (gnus)"
823 mh-mml-to-mime
(mh-mml-directive-present-p)]
824 ["Revert to Non-MIME Edit (mhn)"
825 mh-revert-mhn-edit
(equal mh-compose-insertion
'mhn
)]
826 ["Kill This Draft" mh-fully-kill-draft t
]))
829 ;;; Group messages logically, more or less.
830 (defvar mh-letter-mode-help-messages
832 "Send letter: \\[mh-send-letter]"
833 "\t\tOpen line: \\[mh-open-line]\n"
834 "Kill letter: \\[mh-fully-kill-draft]"
836 "Check recipients: \\[mh-check-whom]"
837 "\t\t Current message: \\[mh-yank-cur-msg]\n"
838 "\t\t Attachment: \\[mh-compose-insertion]\n"
839 "\t\t Message to forward: \\[mh-compose-forward]\n"
842 "\t\t Encrypt message: \\[mh-mml-secure-message-encrypt]"
843 "\t\t Sign+Encrypt message: \\[mh-mml-secure-message-signencrypt]"
844 "\t\t Sign message: \\[mh-mml-secure-message-sign]\n"
846 "\t\t Signature: \\[mh-insert-signature]"))
847 "Key binding cheat sheet.
849 This is an associative array which is used to show the most common commands.
850 The key is a prefix char. The value is one or more strings which are
851 concatenated together and displayed in the minibuffer if ? is pressed after
852 the prefix character. The special key nil is used to display the
853 non-prefixed commands.
855 The substitutions described in `substitute-command-keys' are performed as
859 (defun mh-fill-paragraph-function (arg)
860 "Fill paragraph at or after point.
861 Prefix ARG means justify as well. This function enables `fill-paragraph' to
862 work better in MH-Letter mode."
864 (let ((fill-paragraph-function) (fill-prefix))
866 (mail-mode-fill-paragraph arg
)
867 (fill-paragraph arg
))))
869 ;; Avoid compiler warnings in XEmacs and Emacs 20
871 (defvar tool-bar-mode
)
872 (defvar tool-bar-map
))
875 (define-derived-mode mh-letter-mode text-mode
"MH-Letter"
876 "Mode for composing letters in MH-E.\\<mh-letter-mode-map>
878 When you have finished composing, type \\[mh-send-letter] to send the message
879 using the MH mail handling system.
881 There are two types of MIME directives used by MH-E: Gnus and MH. The option
882 `mh-compose-insertion' controls what type of directives are inserted by MH-E
883 commands. These directives can be converted to MIME body parts by running
884 \\[mh-edit-mhn] for mhn directives or \\[mh-mml-to-mime] for Gnus directives.
885 This step is mandatory if these directives are added manually. If the
886 directives are inserted with MH-E commands such as \\[mh-compose-insertion],
887 the directives are expanded automatically when the letter is sent.
889 Options that control this mode can be changed with
890 \\[customize-group]; specify the \"mh-compose\" group.
892 When a message is composed, the hooks `text-mode-hook' and
893 `mh-letter-mode-hook' are run.
895 \\{mh-letter-mode-map}"
897 (make-local-variable 'mh-send-args
)
898 (make-local-variable 'mh-annotate-char
)
899 (make-local-variable 'mh-annotate-field
)
900 (make-local-variable 'mh-previous-window-config
)
901 (make-local-variable 'mh-sent-from-folder
)
902 (make-local-variable 'mh-sent-from-msg
)
903 ;; Set the local value of mh-mail-header-separator according to what is
904 ;; present in the buffer...
905 (set (make-local-variable 'mh-mail-header-separator
)
907 (goto-char (mh-mail-header-end))
908 (buffer-substring-no-properties (point) (line-end-position))))
909 (make-local-variable 'mail-header-separator
)
910 (setq mail-header-separator mh-mail-header-separator
) ;override sendmail.el
911 (make-local-variable 'mh-help-messages
)
912 (setq mh-help-messages mh-letter-mode-help-messages
)
913 (setq buffer-invisibility-spec
'((vanish . t
) t
))
914 (set (make-local-variable 'line-move-ignore-invisible
) t
)
916 ;; From sendmail.el for proper paragraph fill
917 ;; sendmail.el also sets a normal-auto-fill-function (not done here)
918 (make-local-variable 'paragraph-separate
)
919 (make-local-variable 'paragraph-start
)
920 (make-local-variable 'fill-paragraph-function
)
921 (setq fill-paragraph-function
'mh-fill-paragraph-function
)
922 (make-local-variable 'adaptive-fill-regexp
)
923 (setq adaptive-fill-regexp
924 (concat adaptive-fill-regexp
925 "\\|[ \t]*[-[:alnum:]]*>+[ \t]*"))
926 (make-local-variable 'adaptive-fill-first-line-regexp
)
927 (setq adaptive-fill-first-line-regexp
928 (concat adaptive-fill-first-line-regexp
929 "\\|[ \t]*[-[:alnum:]]*>+[ \t]*"))
930 ;; `-- ' precedes the signature. `-----' appears at the start of the
931 ;; lines that delimit forwarded messages.
932 ;; Lines containing just >= 3 dashes, perhaps after whitespace,
933 ;; are also sometimes used and should be separators.
934 (setq paragraph-start
(concat (regexp-quote mail-header-separator
)
935 "\\|\t*\\([-|#;>* ]\\|(?[0-9]+[.)]\\)+$"
936 "\\|[ \t]*[[:alnum:]]*>+[ \t]*$\\|[ \t]*$\\|"
939 (setq paragraph-separate paragraph-start
)
940 ;; --- End of code from sendmail.el ---
942 ;; Enable undo since a show-mode buffer might have been reused.
944 (set (make-local-variable 'tool-bar-map
) mh-letter-tool-bar-map
)
945 (mh-funcall-if-exists mh-toolbar-init
:letter
)
946 (make-local-variable 'font-lock-defaults
)
948 ((or (equal mh-highlight-citation-p
'font-lock
)
949 (equal mh-highlight-citation-p
'gnus
))
950 ;; Let's use font-lock even if gnus is used in show-mode. The reason
951 ;; is that gnus uses static text properties which are not appropriate
952 ;; for a buffer that will be edited. So the choice here is either fontify
953 ;; the citations and header...
954 (setq font-lock-defaults
'(mh-letter-font-lock-keywords t
)))
956 ;; ...or the header only
957 (setq font-lock-defaults
'(mh-show-font-lock-keywords t
))))
958 (easy-menu-add mh-letter-menu
)
959 (setq fill-column mh-letter-fill-column
)
960 ;; If text-mode-hook turned on auto-fill, tune it for messages
961 (when auto-fill-function
962 (make-local-variable 'auto-fill-function
)
963 (setq auto-fill-function
'mh-auto-fill-for-letter
)))
965 (defun mh-font-lock-field-data (limit)
966 "Find header field region between point and LIMIT."
967 (and (< (point) (mh-letter-header-end))
969 (let ((end (min limit
(mh-letter-header-end)))
971 data-end data-begin field
)
973 (setq data-end
(if (re-search-forward "^[^ \t]" end t
)
976 (goto-char (1- data-end
))
977 (if (not (re-search-backward "\\(^[^ \t][^:]*\\):[ \t]*" nil t
))
978 (setq data-begin
(point-min))
979 (setq data-begin
(match-end 0))
980 (setq field
(match-string 1)))
981 (setq data-begin
(max point data-begin
))
982 (if (and field
(mh-letter-skipped-header-field-p field
))
984 (set-match-data (list data-begin data-end data-begin data-end
)))
985 (goto-char (if (equal point data-end
) (1+ data-end
) data-end
))
988 (defun mh-letter-header-end ()
989 "Find the end of the message header.
990 This function is to be used only for font locking. It works by searching for
991 `mh-mail-header-separator' in the buffer."
993 (goto-char (point-min))
994 (cond ((equal mh-mail-header-separator
"") (point-min))
995 ((search-forward (format "\n%s\n" mh-mail-header-separator
) nil t
)
996 (line-beginning-position 0))
999 (defun mh-auto-fill-for-letter ()
1000 "Perform auto-fill for message.
1001 Header is treated specially by inserting a tab before continuation lines."
1002 (if (mh-in-header-p)
1003 (let ((fill-prefix "\t"))
1007 (defun mh-insert-header-separator ()
1008 "Insert `mh-mail-header-separator', if absent."
1010 (goto-char (point-min))
1012 (if (looking-at "$")
1013 (insert mh-mail-header-separator
))))
1016 (defun mh-to-field ()
1017 "Move point to the end of a specified header field.
1018 The field is indicated by the previous keystroke (the last keystroke
1019 of the command) according to the list in the variable `mh-to-field-choices'.
1020 Create the field if it does not exist. Set the mark to point before moving."
1023 (let ((target (cdr (or (assoc (char-to-string (logior last-input-char ?
`))
1024 mh-to-field-choices
)
1025 ;; also look for a char for version 4 compat
1026 (assoc (logior last-input-char ?
`)
1027 mh-to-field-choices
))))
1028 (case-fold-search t
))
1030 (cond ((mh-position-on-field target
)
1031 (let ((eol (point)))
1032 (skip-chars-backward " \t")
1033 (delete-region (point) eol
))
1034 (if (and (not (eq (logior last-input-char ?
`) ?s
))
1037 (not (looking-at "[:,]"))))
1041 (if (mh-position-on-field "To:")
1043 (insert (format "%s \n" target
))
1044 (backward-char 1)))))
1047 (defun mh-to-fcc (&optional folder
)
1048 "Insert an Fcc: FOLDER field in the current message.
1049 Prompt for the field name with a completion list of the current folders."
1052 (setq folder
(mh-prompt-for-folder
1054 (or (and mh-default-folder-for-message-function
1056 (goto-char (point-min))
1058 mh-default-folder-for-message-function
)))
1061 (let ((last-input-char ?\C-f
))
1065 (insert (if (mh-folder-name-p folder
)
1066 (substring folder
1)
1069 (defun mh-file-is-vcard-p (file)
1070 "Return t if FILE is a .vcf vcard."
1071 (let ((case-fold-search t
))
1073 (file-exists-p file
)
1074 (or (and (not (mh-have-file-command))
1075 (not (null (string-match "\.vcf$" file
))))
1076 (and (mh-have-file-command)
1077 (string-equal "text/x-vcard" (mh-file-mime-type file
)))))))
1080 (defun mh-insert-signature (&optional file
)
1081 "Insert the signature specified by `mh-signature-file-name' or FILE at point.
1082 A signature separator (`-- ') will be added if the signature block does not
1083 contain one and `mh-signature-separator-flag' is on.
1084 The value of `mh-letter-insert-signature-hook' is a list of functions to be
1085 called, with no arguments, after the signature is inserted.
1086 The signature can also be inserted with `mh-identity-list'."
1090 (let ((mh-signature-file-name (or file mh-signature-file-name
))
1091 (mh-mhn-p (mh-mhn-directive-present-p))
1092 (mh-mml-p (mh-mml-directive-present-p)))
1094 (narrow-to-region (point) (point))
1096 ((mh-file-is-vcard-p mh-signature-file-name
)
1097 (if (equal mh-compose-insertion
'gnus
)
1098 (insert "<#part type=\"text/x-vcard\" filename=\""
1099 mh-signature-file-name
1100 "\" disposition=inline description=VCard>\n<#/part>")
1101 (insert "#text/x-vcard; name=\""
1102 (file-name-nondirectory mh-signature-file-name
)
1103 "\" [VCard] " (expand-file-name mh-signature-file-name
))))
1107 (insert "#\n" "Content-Description: Signature\n"))
1109 (mml-insert-tag 'part
'type
"text/plain" 'disposition
"inline"
1110 'description
"Signature")))
1111 (cond ((null mh-signature-file-name
))
1112 ((and (stringp mh-signature-file-name
)
1113 (file-readable-p mh-signature-file-name
))
1114 (insert-file-contents mh-signature-file-name
))
1115 ((functionp mh-signature-file-name
)
1116 (funcall mh-signature-file-name
)))))
1119 (run-hooks 'mh-letter-insert-signature-hook
))
1120 (goto-char (point-min))
1121 (when (and (not (mh-file-is-vcard-p mh-signature-file-name
))
1122 mh-signature-separator-flag
1123 (> (point-max) (point-min))
1124 (not (mh-signature-separator-p)))
1129 (insert mh-signature-separator
))
1130 (if (not (> (point-max) (point-min)))
1131 (message "No signature found")))))
1132 (force-mode-line-update))
1135 (defun mh-check-whom ()
1136 "Verify recipients of the current letter, showing expansion of any aliases."
1138 (let ((file-name buffer-file-name
))
1140 (message "Checking recipients...")
1141 (mh-in-show-buffer (mh-recipients-buffer)
1142 (bury-buffer (current-buffer))
1144 (mh-exec-cmd-output "whom" t file-name
))
1145 (message "Checking recipients...done")))
1147 (defun mh-tidy-draft-buffer ()
1148 "Run when a draft buffer is destroyed."
1149 (let ((buffer (get-buffer mh-recipients-buffer
)))
1151 (kill-buffer buffer
))))
1155 ;;; Routines to compose and send a letter.
1157 (defun mh-insert-x-face ()
1158 "Append X-Face, Face or X-Image-URL field to header.
1159 If the field already exists, this function does nothing."
1160 (when (and (file-exists-p mh-x-face-file
)
1161 (file-readable-p mh-x-face-file
))
1163 (unless (or (mh-position-on-field "X-Face")
1164 (mh-position-on-field "Face")
1165 (mh-position-on-field "X-Image-URL"))
1167 (goto-char (+ (point) (cadr (insert-file-contents mh-x-face-file
))))
1168 (if (not (looking-at "^"))
1170 (unless (looking-at "\\(X-Face\\|Face\\|X-Image-URL\\): ")
1171 (insert "X-Face: "))))))
1173 (defvar mh-x-mailer-string nil
1174 "*String containing the contents of the X-Mailer header field.
1175 If nil, this variable is initialized to show the version of MH-E, Emacs, and
1176 MH the first time a message is composed.")
1178 (defun mh-insert-x-mailer ()
1179 "Append an X-Mailer field to the header.
1180 The versions of MH-E, Emacs, and MH are shown."
1181 ;; Lazily initialize mh-x-mailer-string.
1182 (when (and mh-insert-x-mailer-flag
(null mh-x-mailer-string
))
1183 (setq mh-x-mailer-string
1184 (format "MH-E %s; %s; %sEmacs %s"
1185 mh-version mh-variant-in-use
1186 (if mh-xemacs-flag
"X" "GNU ")
1187 (cond ((not mh-xemacs-flag
) emacs-version
)
1188 ((string-match "[0-9.]*\\( +\([ a-z]+[0-9]+\)\\)?"
1190 (match-string 0 emacs-version
))
1191 (t (format "%s.%s" emacs-major-version
1192 emacs-minor-version
))))))
1193 ;; Insert X-Mailer, but only if it doesn't already exist.
1195 (when (and mh-insert-x-mailer-flag
1196 (null (mh-goto-header-field "X-Mailer")))
1197 (mh-insert-fields "X-Mailer:" mh-x-mailer-string
))))
1199 (defun mh-regexp-in-field-p (regexp &rest fields
)
1200 "Non-nil means REGEXP was found in FIELDS."
1202 (let ((search-result nil
)
1205 (setq field
(car fields
))
1206 (if (and (mh-goto-header-field field
)
1208 regexp
(save-excursion (mh-header-field-end)(point)) t
))
1211 (setq fields
(cdr fields
))))
1215 (defun mh-insert-auto-fields (&optional non-interactive
)
1216 "Insert custom fields if To or Cc match `mh-auto-fields-list'.
1217 Sets buffer-local `mh-insert-auto-fields-done-local' when done and inserted
1218 something. If NON-INTERACTIVE is non-nil, do not be verbose and only
1219 attempt matches if `mh-insert-auto-fields-done-local' is nil.
1221 An `identity' entry is skipped if one was already entered manually.
1223 Return t if fields added; otherwise return nil."
1225 (when (or (not non-interactive
)
1226 (not mh-insert-auto-fields-done-local
))
1228 (when (and (or (mh-goto-header-field "To:")
1229 (mh-goto-header-field "cc:")))
1230 (let ((list mh-auto-fields-list
)
1231 (fields-inserted nil
))
1233 (let ((regexp (nth 0 (car list
)))
1234 (entries (nth 1 (car list
))))
1235 (when (mh-regexp-in-field-p regexp
"To:" "cc:")
1236 (setq mh-insert-auto-fields-done-local t
)
1237 (setq fields-inserted t
)
1238 (if (not non-interactive
)
1239 (message "Fields for %s added" regexp
))
1240 (let ((entry-list entries
))
1242 (let ((field (caar entry-list
))
1243 (value (cdar entry-list
)))
1245 ((equal ":identity" field
)
1246 (when (and (not mh-identity-local
)
1247 (assoc value mh-identity-list
))
1248 (mh-insert-identity value
)))
1250 (mh-modify-header-field field value
1251 (equal field
"From")))))
1252 (setq entry-list
(cdr entry-list
))))))
1253 (setq list
(cdr list
)))
1254 fields-inserted
)))))
1256 (defun mh-modify-header-field (field value
&optional overwrite-flag
)
1257 "To header FIELD add VALUE.
1258 If OVERWRITE-FLAG is non-nil then the old value, if present, is discarded."
1259 (cond ((and overwrite-flag
1260 (mh-goto-header-field (concat field
":")))
1262 (delete-region (point) (line-end-position)))
1263 ((and (not overwrite-flag
)
1264 (mh-regexp-in-field-p (concat "\\b" value
"\\b") field
))
1265 ;; Already there, do nothing.
1267 ((and (not overwrite-flag
)
1268 (mh-goto-header-field (concat field
":")))
1269 (insert " " value
","))
1271 (mh-goto-header-end 0)
1272 (insert field
": " value
"\n"))))
1274 (defun mh-compose-and-send-mail (draft send-args
1275 sent-from-folder sent-from-msg
1277 annotate-char annotate-field
1279 "Edit and compose a draft message in buffer DRAFT and send or save it.
1280 SEND-ARGS is the argument passed to the send command.
1281 SENT-FROM-FOLDER is buffer containing scan listing of current folder, or
1283 SENT-FROM-MSG is the message number or sequence name or nil.
1284 The TO, SUBJECT, and CC fields are passed to the
1285 `mh-compose-letter-function'.
1286 If ANNOTATE-CHAR is non-null, it is used to notate the scan listing of the
1287 message. In that case, the ANNOTATE-FIELD is used to build a string
1288 for `mh-annotate-msg'.
1289 CONFIG is the window configuration to restore after sending the letter."
1290 (pop-to-buffer draft
)
1294 (if (and (boundp 'mh-identity-default
)
1296 (not mh-identity-local
))
1297 (mh-insert-identity mh-identity-default
))
1298 (mh-identity-make-menu)
1299 (easy-menu-add mh-identity-menu
)
1301 ;; Insert extra fields.
1302 (mh-insert-x-mailer)
1305 (mh-letter-hide-all-skipped-fields)
1307 (setq mh-sent-from-folder sent-from-folder
)
1308 (setq mh-sent-from-msg sent-from-msg
)
1309 (setq mh-send-args send-args
)
1310 (setq mh-annotate-char annotate-char
)
1311 (setq mh-annotate-field annotate-field
)
1312 (setq mh-previous-window-config config
)
1313 (setq mode-line-buffer-identification
(list " {%b}"))
1315 (mh-make-local-hook 'kill-buffer-hook
)
1316 (add-hook 'kill-buffer-hook
'mh-tidy-draft-buffer nil t
)
1317 (if (and (boundp 'mh-compose-letter-function
)
1318 mh-compose-letter-function
)
1319 ;; run-hooks will not pass arguments.
1320 (let ((value mh-compose-letter-function
))
1321 (if (and (listp value
) (not (eq (car value
) 'lambda
)))
1323 (funcall (car value
) to subject cc
)
1324 (setq value
(cdr value
)))
1325 (funcall mh-compose-letter-function to subject cc
)))))
1327 (defun mh-letter-mode-message ()
1328 "Display a help message for users of `mh-letter-mode'.
1329 This should be the last function called when composing the draft."
1330 (message "%s" (substitute-command-keys
1331 (concat "Type \\[mh-send-letter] to send message, "
1332 "\\[mh-help] for help"))))
1334 (defun mh-ascii-buffer-p ()
1335 "Check if current buffer is entirely composed of ASCII.
1336 The function doesn't work for XEmacs since `find-charset-region' doesn't exist
1338 (loop for charset in
(mh-funcall-if-exists
1339 find-charset-region
(point-min) (point-max))
1340 unless
(eq charset
'ascii
) return nil
1344 (defun mh-send-letter (&optional arg
)
1345 "Send the draft letter in the current buffer.
1346 If optional prefix argument ARG is provided, monitor delivery.
1347 The value of `mh-before-send-letter-hook' is a list of functions to be called,
1348 with no arguments, before doing anything.
1349 Run `\\[mh-edit-mhn]' if mhn directives are present; otherwise
1350 run `\\[mh-mml-to-mime]' if mml directives are present."
1352 (run-hooks 'mh-before-send-letter-hook
)
1353 (if (and (mh-insert-auto-fields t
)
1354 mh-auto-fields-prompt-flag
1355 (goto-char (point-min)))
1356 (if (not (y-or-n-p "Auto fields inserted, send? "))
1357 (error "Send aborted")))
1358 (cond ((mh-mhn-directive-present-p)
1360 ((or (mh-mml-directive-present-p) (not (mh-ascii-buffer-p)))
1363 (message "Sending...")
1364 (let ((draft-buffer (current-buffer))
1365 (file-name buffer-file-name
)
1366 (config mh-previous-window-config
)
1367 (coding-system-for-write
1368 (if (and (local-variable-p 'buffer-file-coding-system
1369 (current-buffer)) ;XEmacs needs two args
1370 ;; We're not sure why, but buffer-file-coding-system
1371 ;; tends to get set to undecided-unix.
1372 (not (memq buffer-file-coding-system
1373 '(undecided undecided-unix undecided-dos
))))
1374 buffer-file-coding-system
1375 (or (and (boundp 'sendmail-coding-system
) sendmail-coding-system
)
1376 (and (boundp 'default-buffer-file-coding-system
)
1377 default-buffer-file-coding-system
)
1379 ;; The default BCC encapsulation will make a MIME message unreadable.
1380 ;; With nmh use the -mime arg to prevent this.
1381 (if (and (mh-variant-p 'nmh
)
1382 (mh-goto-header-field "Bcc:")
1383 (mh-goto-header-field "Content-Type:"))
1384 (setq mh-send-args
(format "-mime %s" mh-send-args
)))
1386 (pop-to-buffer mh-mail-delivery-buffer
)
1388 (mh-exec-cmd-output mh-send-prog t
"-watch" "-nopush"
1389 "-nodraftfolder" mh-send-args file-name
)
1390 (goto-char (point-max)) ; show the interesting part
1392 (set-buffer draft-buffer
)) ; for annotation below
1394 (mh-exec-cmd-daemon mh-send-prog nil
"-nodraftfolder" "-noverbose"
1395 mh-send-args file-name
)))
1396 (if mh-annotate-char
1397 (mh-annotate-msg mh-sent-from-msg
1400 "-component" mh-annotate-field
1401 "-text" (format "\"%s %s\""
1402 (mh-get-header-field "To:")
1403 (mh-get-header-field "Cc:"))))
1405 (cond ((or (not arg
)
1406 (y-or-n-p "Kill draft buffer? "))
1407 (kill-buffer draft-buffer
)
1409 (set-window-configuration config
))))
1411 (message "Sending...done")
1412 (message "Sending...backgrounded"))))
1415 (defun mh-insert-letter (folder message verbatim
)
1416 "Insert a message into the current letter.
1417 Removes the header fields according to the variable
1418 `mh-invisible-header-fields-compiled'.
1419 Prefixes each non-blank line with `mh-ins-buf-prefix', unless
1420 `mh-yank-from-start-of-msg' is set for supercite in which case supercite is
1421 used to format the message.
1422 Prompts for FOLDER and MESSAGE. If prefix argument VERBATIM provided, do
1423 not indent and do not delete headers. Leaves the mark before the letter
1424 and point after it."
1426 (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil
)
1427 (read-input (format "Message number%s: "
1428 (if (numberp mh-sent-from-msg
)
1429 (format " [%d]" mh-sent-from-msg
)
1431 current-prefix-arg
))
1433 (narrow-to-region (point) (point))
1434 (let ((start (point-min)))
1435 (if (and (equal message
"") (numberp mh-sent-from-msg
))
1436 (setq message
(int-to-string mh-sent-from-msg
)))
1437 (insert-file-contents
1438 (expand-file-name message
(mh-expand-file-name folder
)))
1439 (when (not verbatim
)
1440 (mh-clean-msg-header start mh-invisible-header-fields-compiled nil
)
1441 (goto-char (point-max)) ;Needed for sc-cite-original
1442 (push-mark) ;Needed for sc-cite-original
1443 (goto-char (point-min)) ;Needed for sc-cite-original
1444 (mh-insert-prefix-string mh-ins-buf-prefix
)))))
1446 (defun mh-extract-from-attribution ()
1447 "Extract phrase or comment from From header field."
1449 (if (not (mh-goto-header-field "From: "))
1451 (skip-chars-forward " ")
1453 ((looking-at "\"\\([^\"\n]+\\)\" \\(<.+>\\)")
1454 (format "%s %s " (match-string 1)(match-string 2)))
1455 ((looking-at "\\([^<\n]+<.+>\\)$")
1456 (format "%s " (match-string 1)))
1457 ((looking-at "\\([^ ]+@[^ ]+\\) +(\\(.+\\))$")
1458 (format "%s <%s> " (match-string 2)(match-string 1)))
1459 ((looking-at " *\\(.+\\)$")
1460 (format "%s " (match-string 1)))))))
1463 (defun mh-yank-cur-msg ()
1464 "Insert the current message into the draft buffer.
1465 Prefix each non-blank line in the message with the string in
1466 `mh-ins-buf-prefix'. If a region is set in the message's buffer, then
1467 only the region will be inserted. Otherwise, the entire message will
1468 be inserted if `mh-yank-from-start-of-msg' is non-nil. If this variable
1469 is nil, the portion of the message following the point will be yanked.
1470 If `mh-delete-yanked-msg-window-flag' is non-nil, any window displaying the
1471 yanked message will be deleted."
1473 (if (and mh-sent-from-folder
1474 (save-excursion (set-buffer mh-sent-from-folder
) mh-show-buffer
)
1475 (save-excursion (set-buffer mh-sent-from-folder
)
1476 (get-buffer mh-show-buffer
))
1478 (let ((to-point (point))
1479 (to-buffer (current-buffer)))
1480 (set-buffer mh-sent-from-folder
)
1481 (if mh-delete-yanked-msg-window-flag
1482 (delete-windows-on mh-show-buffer
))
1483 (set-buffer mh-show-buffer
) ; Find displayed message
1484 (let* ((from-attr (mh-extract-from-attribution))
1485 (yank-region (mh-mark-active-p nil
))
1487 (cond ((and yank-region
1488 (or (eq 'supercite mh-yank-from-start-of-msg
)
1489 (eq 'autosupercite mh-yank-from-start-of-msg
)
1490 (eq t mh-yank-from-start-of-msg
)))
1491 ;; supercite needs the full header
1493 (buffer-substring (point-min) (mh-mail-header-end))
1495 (buffer-substring (region-beginning) (region-end))))
1497 (buffer-substring (region-beginning) (region-end)))
1498 ((or (eq 'body mh-yank-from-start-of-msg
)
1500 mh-yank-from-start-of-msg
)
1502 mh-yank-from-start-of-msg
))
1505 (goto-char (point-min))
1506 (mh-goto-header-end 1)
1509 ((or (eq 'supercite mh-yank-from-start-of-msg
)
1510 (eq 'autosupercite mh-yank-from-start-of-msg
)
1511 (eq t mh-yank-from-start-of-msg
))
1512 (buffer-substring (point-min) (point-max)))
1514 (buffer-substring (point) (point-max))))))
1515 (set-buffer to-buffer
)
1517 (narrow-to-region to-point to-point
)
1518 (insert (mh-filter-out-non-text mh-ins-str
))
1519 (goto-char (point-max)) ;Needed for sc-cite-original
1520 (push-mark) ;Needed for sc-cite-original
1521 (goto-char (point-min)) ;Needed for sc-cite-original
1522 (mh-insert-prefix-string mh-ins-buf-prefix
)
1523 (when (or (eq 'attribution mh-yank-from-start-of-msg
)
1524 (eq 'autoattrib mh-yank-from-start-of-msg
))
1526 (mh-identity-insert-attribution-verb nil
)
1528 ;; If the user has selected a region, he has already "edited" the
1529 ;; text, so leave the cursor at the end of the yanked text. In
1530 ;; either case, leave a mark at the opposite end of the included
1531 ;; text to make it easy to jump or delete to the other end of the
1534 (goto-char (point-max))
1535 (if (null yank-region
)
1536 (mh-exchange-point-and-mark-preserving-active-mark)))))
1537 (error "There is no current message")))
1539 (defun mh-filter-out-non-text (string)
1540 "Return STRING but without adornments such as MIME buttons and smileys."
1542 ;; Insert the string to filter
1544 (goto-char (point-min))
1546 ;; Remove the MIME buttons
1547 (let ((can-move-forward t
)
1549 (while can-move-forward
1550 (cond ((and (not (get-text-property (point) 'mh-data
))
1552 (delete-region (1- (point)) (point))
1553 (setq in-button nil
))
1554 ((get-text-property (point) 'mh-data
)
1555 (delete-region (point)
1556 (save-excursion (forward-line) (point)))
1558 (t (setq can-move-forward
(= (forward-line) 0))))))
1560 ;; Return the contents without properties... This gets rid of emphasis
1562 (buffer-substring-no-properties (point-min) (point-max))))
1564 (defun mh-insert-prefix-string (mh-ins-string)
1565 "Insert prefix string before each line in buffer.
1566 The inserted letter is cited using `sc-cite-original' if
1567 `mh-yank-from-start-of-msg' is one of 'supercite or 'autosupercite. Otherwise,
1568 simply insert MH-INS-STRING before each line."
1569 (goto-char (point-min))
1570 (cond ((or (eq mh-yank-from-start-of-msg
'supercite
)
1571 (eq mh-yank-from-start-of-msg
'autosupercite
))
1574 (run-hooks 'mail-citation-hook
))
1575 (mh-yank-hooks ;old hook name
1576 (run-hooks 'mh-yank-hooks
))
1578 (or (bolp) (forward-line 1))
1579 (while (< (point) (point-max))
1580 (insert mh-ins-string
)
1582 (goto-char (point-min))))) ;leave point like sc-cite-original
1585 (defun mh-fully-kill-draft ()
1586 "Kill the draft message file and the draft message buffer.
1587 Use \\[kill-buffer] if you don't want to delete the draft message file."
1589 (if (y-or-n-p "Kill draft message? ")
1590 (let ((config mh-previous-window-config
))
1591 (if (file-exists-p buffer-file-name
)
1592 (delete-file buffer-file-name
))
1593 (set-buffer-modified-p nil
)
1594 (kill-buffer (buffer-name))
1597 (set-window-configuration config
)))
1598 (error "Message not killed")))
1600 (defun mh-current-fill-prefix ()
1601 "Return the `fill-prefix' on the current line as a string."
1604 ;; This assumes that the major-mode sets up adaptive-fill-regexp
1605 ;; correctly such as mh-letter-mode or sendmail.el's mail-mode. But
1606 ;; perhaps I should use the variable and simply inserts its value here,
1607 ;; and set it locally in a let scope. --psg
1608 (if (re-search-forward adaptive-fill-regexp nil t
)
1613 (defun mh-open-line ()
1614 "Insert a newline and leave point after it.
1615 In addition, insert newline and quoting characters before text after point.
1616 This is useful in breaking up paragraphs in replies."
1618 (let ((column (current-column))
1619 (prefix (mh-current-fill-prefix)))
1620 (if (> (length prefix
) column
)
1621 (message "Sorry, point seems to be within the line prefix")
1624 (while (> column
(current-column))
1626 (forward-line -
1))))
1628 (mh-do-in-xemacs (defvar mail-abbrevs
))
1631 (defun mh-complete-word (word choices begin end
)
1632 "Complete WORD at from CHOICES.
1633 Any match found replaces the text from BEGIN to END."
1634 (let ((completion (try-completion word choices
))
1635 (completions-buffer "*Completions*"))
1636 (cond ((eq completion t
)
1638 (kill-buffer completions-buffer
))
1639 (message "Completed: %s" word
))
1642 (kill-buffer completions-buffer
))
1643 (message "No completion for `%s'" word
))
1644 ((stringp completion
)
1645 (if (equal word completion
)
1646 (with-output-to-temp-buffer completions-buffer
1647 (display-completion-list (all-completions word choices
)))
1649 (kill-buffer completions-buffer
))
1650 (delete-region begin end
)
1651 (insert completion
))))))
1654 (defun mh-beginning-of-word (&optional n
)
1655 "Return position of the N th word backwards."
1656 (unless n
(setq n
1))
1657 (let ((syntax-table (syntax-table)))
1660 (mh-mail-abbrev-make-syntax-table)
1661 (set-syntax-table mail-abbrev-syntax-table
)
1664 (set-syntax-table syntax-table
))))
1666 (defun mh-folder-expand-at-point ()
1667 "Do folder name completion in Fcc header field."
1668 (let* ((end (point))
1669 (beg (mh-beginning-of-word))
1670 (folder (buffer-substring beg end
))
1671 (leading-plus (and (> (length folder
) 0) (equal (aref folder
0) ?
+)))
1672 (last-slash (mh-search-from-end ?
/ folder
))
1673 (prefix (and last-slash
(substring folder
0 last-slash
)))
1674 (choices (mapcar #'(lambda (x)
1675 (list (cond (prefix (format "%s/%s" prefix x
))
1676 (leading-plus (format "+%s" x
))
1678 (mh-folder-completion-function folder nil t
))))
1679 (mh-complete-word folder choices beg end
)))
1681 (defvar mh-letter-complete-function-alist
1682 '((cc . mh-alias-letter-expand-alias
)
1683 (bcc . mh-alias-letter-expand-alias
)
1684 (dcc . mh-alias-letter-expand-alias
)
1685 (fcc . mh-folder-expand-at-point
)
1686 (from . mh-alias-letter-expand-alias
)
1687 (mail-followup-to . mh-alias-letter-expand-alias
)
1688 (reply-to . mh-alias-letter-expand-alias
)
1689 (to . mh-alias-letter-expand-alias
))
1690 "Alist of header fields and completion functions to use.")
1692 (defun mh-letter-complete (arg)
1693 "Perform completion on header field or word preceding point.
1694 If the field contains addresses (for example, `To:' or `Cc:') or folders (for
1695 example, `Fcc:') then this function will provide alias completion. Elsewhere,
1696 this function runs `mh-letter-complete-function' instead and passes the prefix
1700 (cond ((not (mh-in-header-p))
1701 (funcall mh-letter-complete-function arg
))
1702 ((setq func
(cdr (assoc (mh-letter-header-field-at-point)
1703 mh-letter-complete-function-alist
)))
1705 (t (funcall mh-letter-complete-function arg
)))))
1707 (defun mh-letter-complete-or-space (arg)
1708 "Perform completion or insert space.
1709 If `mh-compose-space-does-completion-flag' is nil (the default) a space is
1712 Otherwise, if point is in the message header and the preceding character is
1713 not whitespace then do completion. Otherwise insert a space character.
1715 ARG is the number of spaces inserted."
1718 (end-of-prev (save-excursion
1719 (goto-char (mh-beginning-of-word))
1720 (mh-beginning-of-word -
1))))
1721 (cond ((not mh-compose-space-does-completion-flag
)
1722 (self-insert-command arg
))
1723 ((not (mh-in-header-p)) (self-insert-command arg
))
1724 ((> (point) end-of-prev
) (self-insert-command arg
))
1725 ((setq func
(cdr (assoc (mh-letter-header-field-at-point)
1726 mh-letter-complete-function-alist
)))
1728 (t (self-insert-command arg
)))))
1730 (defun mh-letter-confirm-address ()
1731 "Flash alias expansion if `mh-alias-flash-on-comma' is non-nil."
1733 (cond ((not (mh-in-header-p)) (self-insert-command 1))
1734 ((eq (cdr (assoc (mh-letter-header-field-at-point)
1735 mh-letter-complete-function-alist
))
1736 'mh-alias-letter-expand-alias
)
1737 (mh-alias-reload-maybe)
1738 (mh-alias-minibuffer-confirm-address))
1739 (t (self-insert-command 1))))
1741 (defvar mh-letter-header-field-regexp
"^\\([A-Za-z][A-Za-z0-9-]*\\):")
1743 (defun mh-letter-header-field-at-point ()
1744 "Return the header field name at point.
1745 A symbol is returned whose name is the string obtained by downcasing the field
1749 (and (re-search-backward mh-letter-header-field-regexp nil t
)
1750 (intern (downcase (match-string 1))))))
1753 (defun mh-letter-next-header-field-or-indent (arg)
1754 "Move to next field or indent depending on point.
1755 In the message header, go to the next field. Elsewhere call
1756 `indent-relative' as usual with optional prefix ARG."
1758 (let ((header-end (save-excursion
1759 (goto-char (mh-mail-header-end))
1762 (if (> (point) header-end
)
1763 (indent-relative arg
)
1764 (mh-letter-next-header-field))))
1766 (defun mh-letter-next-header-field ()
1767 "Cycle to the next header field.
1768 If we are at the last header field go to the start of the message body."
1769 (let ((header-end (mh-mail-header-end)))
1770 (cond ((>= (point) header-end
) (goto-char (point-min)))
1773 (re-search-forward mh-letter-header-field-regexp
1774 (line-end-position) t
)
1776 (beginning-of-line))
1778 (cond ((re-search-forward mh-letter-header-field-regexp header-end t
)
1779 (if (mh-letter-skipped-header-field-p (match-string 1))
1780 (mh-letter-next-header-field)
1781 (mh-letter-skip-leading-whitespace-in-header-field)))
1782 (t (goto-char header-end
)
1786 (defun mh-letter-previous-header-field ()
1787 "Cycle to the previous header field.
1788 If we are at the first header field go to the start of the message body."
1790 (let ((header-end (mh-mail-header-end)))
1791 (if (>= (point) header-end
)
1792 (goto-char header-end
)
1793 (mh-header-field-beginning))
1794 (cond ((re-search-backward mh-letter-header-field-regexp nil t
)
1795 (if (mh-letter-skipped-header-field-p (match-string 1))
1796 (mh-letter-previous-header-field)
1797 (goto-char (match-end 0))
1798 (mh-letter-skip-leading-whitespace-in-header-field)))
1799 (t (goto-char header-end
)
1802 (defun mh-letter-skipped-header-field-p (field)
1803 "Check if FIELD is to be skipped."
1804 (let ((field (downcase field
)))
1805 (loop for x in mh-compose-skipped-header-fields
1806 when
(equal (downcase x
) field
) return t
1807 finally return nil
)))
1809 (defun mh-letter-skip-leading-whitespace-in-header-field ()
1810 "Skip leading whitespace in a header field.
1811 If the header field doesn't have at least one space after the colon then a
1812 space character is added."
1813 (let ((need-space t
))
1814 (while (memq (char-after) '(?
\t ?\
))
1816 (setq need-space nil
))
1817 (when need-space
(insert " "))))
1819 (defvar mh-hidden-header-keymap
1820 (let ((map (make-sparse-keymap)))
1822 (define-key map
[mouse-2
] 'mh-letter-toggle-header-field-display-button
))
1824 (define-key map
'(button2)
1825 'mh-letter-toggle-header-field-display-button
))
1828 (defun mh-letter-toggle-header-field-display-button (event)
1829 "Toggle header field display at location of EVENT.
1830 This function does the same thing as `mh-letter-toggle-header-field-display'
1831 except that it is callable from a mouse button."
1833 (mh-do-at-event-location event
1834 (mh-letter-toggle-header-field-display nil
)))
1836 (defun mh-letter-toggle-header-field-display (arg)
1837 "Toggle display of header field at point.
1838 If the header is long or spread over multiple lines then hiding it will show
1839 the first few characters and replace the rest with an ellipsis.
1841 If ARG is negative then header is hidden, if positive it is displayed. If ARG
1842 is the symbol `long' then keep at most the first 4 lines."
1843 (interactive (list nil
))
1844 (when (and (mh-in-header-p)
1847 (re-search-backward mh-letter-header-field-regexp nil t
)))
1848 (let ((buffer-read-only nil
)
1849 (modified-flag (buffer-modified-p))
1853 (setq end
(1- (if (re-search-forward "^[^ \t]" nil t
)
1857 ;; Make it clickable...
1858 (add-text-properties begin end
`(keymap ,mh-hidden-header-keymap
1859 mouse-face highlight
))
1861 (cond ((or (and (not arg
)
1862 (text-property-any begin end
'invisible
'vanish
))
1863 (and (numberp arg
) (>= arg
0))
1864 (and (eq arg
'long
) (> (line-beginning-position 5) end
)))
1865 (remove-text-properties begin end
'(invisible nil
))
1866 (search-forward ":" (line-end-position) t
)
1867 (mh-letter-skip-leading-whitespace-in-header-field))
1870 (mh-letter-truncate-header-field end
)
1871 (beginning-of-line))
1873 (mh-letter-truncate-header-field end
)
1874 (beginning-of-line)))
1875 (set-buffer-modified-p modified-flag
)))))
1877 (defun mh-letter-truncate-header-field (end)
1878 "Replace text from current line till END with an ellipsis.
1879 If the current line is too long truncate a part of it as well."
1880 (let ((max-len (min (window-width) 62)))
1881 (when (> (+ (current-column) 4) max-len
)
1882 (backward-char (- (+ (current-column) 5) max-len
)))
1883 (when (> end
(point))
1884 (add-text-properties (point) end
'(invisible vanish
)))))
1886 (defun mh-letter-hide-all-skipped-fields ()
1887 "Hide all skipped fields."
1889 (goto-char (point-min))
1891 (narrow-to-region (point) (mh-mail-header-end))
1892 (while (re-search-forward mh-letter-header-field-regexp nil t
)
1893 (if (mh-letter-skipped-header-field-p (match-string 1))
1894 (mh-letter-toggle-header-field-display -
1)
1895 (mh-letter-toggle-header-field-display 'long
))
1896 (beginning-of-line 2)))))
1898 (defun mh-interactive-read-address (prompt)
1900 If `mh-compose-prompt-flag' is non-nil, then read an address with PROMPT.
1901 Otherwise return the empty string."
1902 (if mh-compose-prompt-flag
(mh-read-address prompt
) ""))
1904 (defun mh-interactive-read-string (prompt)
1906 If `mh-compose-prompt-flag' is non-nil, then read a string with PROMPT.
1907 Otherwise return the empty string."
1908 (if mh-compose-prompt-flag
(read-string prompt
) ""))
1910 (defun mh-letter-adjust-point ()
1911 "Move cursor to first header field if are using the no prompt mode."
1912 (unless mh-compose-prompt-flag
1913 (goto-char (point-max))
1914 (mh-letter-next-header-field)))
1916 ;;; Build the letter-mode keymap:
1917 ;;; If this changes, modify mh-letter-mode-help-messages accordingly, above.
1918 (gnus-define-keys mh-letter-mode-map
1919 " " mh-letter-complete-or-space
1920 "," mh-letter-confirm-address
1922 "\C-c\C-\\" mh-fully-kill-draft
;if no C-q
1923 "\C-c\C-^" mh-insert-signature
;if no C-s
1924 "\C-c\C-c" mh-send-letter
1925 "\C-c\C-d" mh-insert-identity
1926 "\C-c\C-e" mh-edit-mhn
1927 "\C-c\C-f\C-b" mh-to-field
1928 "\C-c\C-f\C-c" mh-to-field
1929 "\C-c\C-f\C-d" mh-to-field
1930 "\C-c\C-f\C-f" mh-to-fcc
1931 "\C-c\C-f\C-r" mh-to-field
1932 "\C-c\C-f\C-s" mh-to-field
1933 "\C-c\C-f\C-t" mh-to-field
1934 "\C-c\C-fb" mh-to-field
1935 "\C-c\C-fc" mh-to-field
1936 "\C-c\C-fd" mh-to-field
1937 "\C-c\C-ff" mh-to-fcc
1938 "\C-c\C-fr" mh-to-field
1939 "\C-c\C-fs" mh-to-field
1940 "\C-c\C-ft" mh-to-field
1941 "\C-c\C-i" mh-insert-letter
1942 "\C-c\C-m\C-e" mh-mml-secure-message-encrypt
1943 "\C-c\C-m\C-f" mh-compose-forward
1944 "\C-c\C-m\C-g" mh-mhn-compose-anon-ftp
1945 "\C-c\C-m\C-i" mh-compose-insertion
1946 "\C-c\C-m\C-m" mh-mml-to-mime
1947 "\C-c\C-m\C-n" mh-mml-unsecure-message
1948 "\C-c\C-m\C-s" mh-mml-secure-message-sign
1949 "\C-c\C-m\C-t" mh-mhn-compose-external-compressed-tar
1950 "\C-c\C-m\C-u" mh-revert-mhn-edit
1951 "\C-c\C-m\C-x" mh-mhn-compose-external-type
1952 "\C-c\C-mee" mh-mml-secure-message-encrypt
1953 "\C-c\C-mes" mh-mml-secure-message-signencrypt
1954 "\C-c\C-mf" mh-compose-forward
1955 "\C-c\C-mg" mh-mhn-compose-anon-ftp
1956 "\C-c\C-mi" mh-compose-insertion
1957 "\C-c\C-mm" mh-mml-to-mime
1958 "\C-c\C-mn" mh-mml-unsecure-message
1959 "\C-c\C-mse" mh-mml-secure-message-signencrypt
1960 "\C-c\C-mss" mh-mml-secure-message-sign
1961 "\C-c\C-mt" mh-mhn-compose-external-compressed-tar
1962 "\C-c\C-mu" mh-revert-mhn-edit
1963 "\C-c\C-mx" mh-mhn-compose-external-type
1964 "\C-c\C-o" mh-open-line
1965 "\C-c\C-q" mh-fully-kill-draft
1966 "\C-c\C-s" mh-insert-signature
1967 "\C-c\C-t" mh-letter-toggle-header-field-display
1968 "\C-c\C-w" mh-check-whom
1969 "\C-c\C-y" mh-yank-cur-msg
1970 "\C-c\M-d" mh-insert-auto-fields
1971 "\M-\t" mh-letter-complete
1972 "\t" mh-letter-next-header-field-or-indent
1973 [backtab] mh-letter-previous-header-field)
1975 ;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el.
1979 ;;; Local Variables:
1980 ;;; indent-tabs-mode: nil
1981 ;;; sentence-end-double-space: nil
1984 ;;; arch-tag: 62865511-e610-4923-b0b5-f45a8ab70a34
1985 ;;; mh-comp.el ends here