summaryrefslogtreecommitdiff
path: root/lisp/mail/mh-comp.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-04-09 22:31:08 +0000
committerKarl Heuer <kwzh@gnu.org>1995-04-09 22:31:08 +0000
commit60ef881016160cd3697f3fc2c4cdcd1c2783c65d (patch)
treec71d2c5300eb1ff56b48fa32b552ebf59430e88a /lisp/mail/mh-comp.el
parent9a4c860aebe8489a333c5a80ab933b9d818159f8 (diff)
downloademacs-60ef881016160cd3697f3fc2c4cdcd1c2783c65d.tar.gz
New version from author.
Diffstat (limited to 'lisp/mail/mh-comp.el')
-rw-r--r--lisp/mail/mh-comp.el371
1 files changed, 235 insertions, 136 deletions
diff --git a/lisp/mail/mh-comp.el b/lisp/mail/mh-comp.el
index af816c38a8a..c9a7681744a 100644
--- a/lisp/mail/mh-comp.el
+++ b/lisp/mail/mh-comp.el
@@ -1,7 +1,7 @@
;;; mh-comp --- mh-e functions for composing messages
-;; Time-stamp: <94/03/08 10:05:20 gildea>
+;; Time-stamp: <94/12/31 14:07:28 gildea>
-;; Copyright 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995 Free Software Foundation, Inc.
;; This file is part of mh-e.
@@ -23,11 +23,27 @@
;; Internal support for mh-e package.
+;;; Change Log:
+
+;; $Id: mh-comp.el,v 1.8 94/12/31 19:11:42 gildea Exp $
+
;;; Code:
(provide 'mh-comp)
(require 'mh-utils)
+;;; Site customization (see also mh-utils.el):
+
+(defvar mh-send-prog "send"
+ "Name of the MH send program.
+Some sites need to change this because of a name conflict.")
+
+(defvar mh-redist-full-contents nil
+ "Non-nil if the `dist' command needs whole letter for redistribution.
+This is the case only when `send' is compiled with the BERK option.
+If MH will not allow you to redist a previously redist'd msg, set to nil.")
+
+
(defvar mh-note-repl "-"
"String whose first character is used to notate replied to messages.")
@@ -37,10 +53,6 @@
(defvar mh-note-dist "R"
"String whose first character is used to notate redistributed messages.")
-(defvar mh-send-prog "send"
- "Name of the MH send program.
-Some sites need to change this because of a name conflict.")
-
(defvar mh-yank-hooks nil
"Obsolete hook for modifying a citation just inserted in the mail buffer.
Each hook function can find the citation between point and mark.
@@ -80,10 +92,16 @@ message minus the header. If nil, yank only the portion of the message
following the point. If the show buffer has a region, this variable is
ignored.")
+(defvar mh-ins-buf-prefix "> "
+ "*String to put before each non-blank line of a yanked or inserted message.
+\\<mh-letter-mode-map>Used when the message is inserted into an outgoing letter
+by \\[mh-insert-letter] or \\[mh-yank-cur-msg].")
+
(defvar mh-reply-default-reply-to nil
"*Sets the person or persons to whom a reply will be sent.
If nil, prompt for recipient. If non-nil, then \\<mh-folder-mode-map>`\\[mh-reply]' will use this
-value and it should be one of \"from\", \"to\", or \"cc\".")
+value and it should be one of \"from\", \"to\", \"cc\", or \"all\".
+The values \"cc\" and \"all\" do the same thing.")
(defvar mh-signature-file-name "~/.signature"
"*Name of file containing the user's signature.
@@ -100,13 +118,19 @@ Default is \"components\". If not a complete path name, the file
is searched for first in the user's MH directory, then in the
system MH lib directory.")
+(defvar mh-repl-formfile "replcomps"
+ "Name of file to be used as a skeleton for replying to messages.
+Default is \"replcomps\". If not a complete path name, the file
+is searched for first in the user's MH directory, then in the
+system MH lib directory.")
+
;;; Hooks:
(defvar mh-letter-mode-hook nil
"Invoked in `mh-letter-mode' on a new letter.")
(defvar mh-compose-letter-function nil
- "Invoked in `mh-compose-and-send-mail' on a draft letter.
+ "Invoked when setting up a letter draft.
It is passed three arguments: TO recipients, SUBJECT, and CC recipients.")
(defvar mh-before-send-letter-hook nil
@@ -114,21 +138,25 @@ It is passed three arguments: TO recipients, SUBJECT, and CC recipients.")
(defvar mh-rejected-letter-start
- (concat "^ ----- Unsent message follows -----$" ;from mail system
- "\\|^------- Unsent Draft$" ;from MH itself
+ (concat "^ ----- Unsent message follows -----$" ;from sendmail V5
+ "\\|^ ----- Original message follows -----$" ;from sendmail V8
+ "\\|^------- Unsent Draft$" ;from MH itself
"\\|^---------- Original Message ----------$" ;from zmailer
- "\\|^ --- The unsent message follows ---$" ;from AIX mail system
- "\\|^ Your message follows:$") ;from MMDF-II
+ "\\|^ --- The unsent message follows ---$" ;from AIX mail system
+ "\\|^ Your message follows:$" ;from MMDF-II
+ "\\|^Content-Description: Returned Content$" ;1993 KJ sendmail
+ )
"Regexp specifying the beginning of the wrapper around a returned letter.
This wrapper is generated by the mail system when rejecting a letter.")
(defvar mh-new-draft-cleaned-headers
- "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Delivery-Date:\\|^Return-Path:"
+ "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:"
"Regexp of header lines to remove before offering a message as a new draft.
Used by the \\<mh-folder-mode-map>`\\[mh-edit-again]' and `\\[mh-extract-rejected-mail]' commands.")
-(defvar mh-to-field-choices '((?t . "To:") (?s . "Subject:") (?c . "Cc:")
- (?b . "Bcc:") (?f . "Fcc:"))
+(defvar mh-to-field-choices '(("t" . "To:") ("s" . "Subject:") ("c" . "Cc:")
+ ("b" . "Bcc:") ("f" . "Fcc:") ("r" . "From:")
+ ("d" . "Dcc:"))
"Alist of (final-character . field-name) choices for mh-to-field.")
(defvar mh-letter-mode-map (copy-keymap text-mode-map)
@@ -148,7 +176,9 @@ Used by the \\<mh-folder-mode-map>`\\[mh-edit-again]' and `\\[mh-extract-rejecte
(defun mh-smail ()
"Compose and send mail with the MH mail system.
This function is an entry point to mh-e, the Emacs front end
-to the MH mail system."
+to the MH mail system.
+
+See documentation of `\\[mh-send]' for more details on composing mail."
(interactive)
(mh-find-path)
(call-interactively 'mh-send))
@@ -156,6 +186,7 @@ to the MH mail system."
(defun mh-edit-again (msg)
"Clean-up a draft or a message previously sent and make it resendable.
+Default is the current message.
The variable mh-new-draft-cleaned-headers specifies the headers to remove.
See also documentation for `\\[mh-send]' function."
(interactive (list (mh-get-msg-num t)))
@@ -177,7 +208,7 @@ See also documentation for `\\[mh-send]' function."
(defun mh-extract-rejected-mail (msg)
"Extract a letter returned by the mail system and make it resendable.
-Default is the displayed message. The variable mh-new-draft-cleaned-headers
+Default is the current message. The variable mh-new-draft-cleaned-headers
gives the headers to clean out of the original message.
See also documentation for `\\[mh-send]' function."
(interactive (list (mh-get-msg-num t)))
@@ -193,8 +224,10 @@ See also documentation for `\\[mh-send]' function."
(message "Does not appear to be a rejected letter.")))
(goto-char (point-min))
(set-buffer-modified-p nil)
- (mh-compose-and-send-mail draft "" from-folder msg (mh-get-field "To:")
- (mh-get-field "From:") (mh-get-field "Cc:")
+ (mh-compose-and-send-mail draft "" from-folder msg
+ (mh-get-header-field "To:")
+ (mh-get-header-field "From:")
+ (mh-get-header-field "Cc:")
nil nil config)))
@@ -206,7 +239,7 @@ See also documentation for `\\[mh-send]' function."
(mh-read-address "Cc: ")
(if current-prefix-arg
(mh-read-seq-default "Forward" t)
- (mh-get-msg-num t))))
+ (mh-get-msg-num t))))
(or msg-or-seq
(setq msg-or-seq (mh-get-msg-num t)))
(let* ((folder mh-current-folder)
@@ -215,32 +248,38 @@ See also documentation for `\\[mh-send]' function."
(draft-name (expand-file-name "draft" mh-user-path))
(draft (cond ((or (not (file-exists-p draft-name))
(y-or-n-p "The file 'draft' exists. Discard it? "))
- (mh-exec-cmd "forw"
- "-build" mh-current-folder msg-or-seq)
+ (mh-exec-cmd "forw" "-build"
+ mh-current-folder msg-or-seq)
(prog1
(mh-read-draft "" draft-name t)
(mh-insert-fields "To:" to "Cc:" cc)
(set-buffer-modified-p nil)))
(t
(mh-read-draft "" draft-name nil)))))
- (goto-char (point-min))
- (re-search-forward "^------- Forwarded Message")
- (forward-line -1)
- (narrow-to-region (point) (point-max))
- (let ((orig-from (save-excursion (mh-get-field "From:")))
- (orig-subject (save-excursion (mh-get-field "Subject:"))))
- (widen)
+ (let (orig-from
+ orig-subject)
+ (goto-char (point-min))
+ (re-search-forward "^------- Forwarded Message")
+ (forward-line 1)
+ (skip-chars-forward " \t\n")
+ (save-restriction
+ (narrow-to-region (point) (point-max))
+ (setq orig-from (mh-get-header-field "From:"))
+ (setq orig-subject (mh-get-header-field "Subject:")))
(let ((forw-subject
(mh-forwarded-letter-subject orig-from orig-subject)))
- (save-excursion (mh-insert-fields "Subject:" forw-subject))
- (delete-other-windows)
- (if (numberp msg-or-seq)
- (mh-add-msgs-to-seq msg-or-seq 'forwarded t)
+ (mh-insert-fields "Subject:" forw-subject)
+ (goto-char (point-min))
+ (re-search-forward "^------- Forwarded Message")
+ (forward-line -1)
+ (delete-other-windows)
+ (if (numberp msg-or-seq)
+ (mh-add-msgs-to-seq msg-or-seq 'forwarded t)
(mh-add-msgs-to-seq (mh-seq-to-msgs msg-or-seq) 'forwarded t))
- (mh-compose-and-send-mail draft "" folder msg-or-seq
- to forw-subject cc
- mh-note-forw "Forwarded:"
- config)))))
+ (mh-compose-and-send-mail draft "" folder msg-or-seq
+ to forw-subject cc
+ mh-note-forw "Forwarded:"
+ config)))))
(defun mh-forwarded-letter-subject (from subject)
;; Return a Subject suitable for a forwarded message.
@@ -260,7 +299,9 @@ See also documentation for `\\[mh-send]' function."
(defun mh-smail-other-window ()
"Compose and send mail in other window with the MH mail system.
This function is an entry point to mh-e, the Emacs front end
-to the MH mail system."
+to the MH mail system.
+
+See documentation of `\\[mh-send]' for more details on composing mail."
(interactive)
(mh-find-path)
(call-interactively 'mh-send-other-window))
@@ -293,14 +334,14 @@ setting of the variable mh-redist-full-contents. See its documentation."
(if mh-redist-full-contents
(call-process "/bin/sh" nil 0 nil "-c"
(format "mhdist=1 mhaltmsg=%s %s -push %s"
- (buffer-file-name)
+ buffer-file-name
(expand-file-name mh-send-prog mh-progs)
- (buffer-file-name)))
+ buffer-file-name))
(call-process "/bin/sh" nil 0 nil "-c"
(format "mhdist=1 mhaltmsg=%s mhannotate=1 %s -push %s"
(mh-msg-filename msg folder)
(expand-file-name mh-send-prog mh-progs)
- (buffer-file-name))))
+ buffer-file-name)))
(mh-annotate-msg msg folder mh-note-dist
"-component" "Resent:"
"-text" (format "\"%s %s\"" to cc))
@@ -308,15 +349,16 @@ setting of the variable mh-redist-full-contents. See its documentation."
(message "Redistributing...done"))))
-(defun mh-reply (msg &optional includep)
- "Reply to a MESSAGE (default: displayed message).
+(defun mh-reply (message &optional includep)
+ "Reply to MESSAGE (default: current message).
If optional prefix argument INCLUDEP provided, then include the message
in the reply using filter mhl.reply in your MH directory.
Prompts for type of addresses to reply to:
from sender only,
to sender and primary recipients,
cc/all sender and all recipients.
-See also documentation for `\\[mh-send]' function."
+If the file named by `mh-repl-formfile' exists, it is used as a skeleton
+for the reply. See also documentation for `\\[mh-send]' function."
(interactive (list (mh-get-msg-num t) current-prefix-arg))
(let ((minibuffer-help-form
"from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients"))
@@ -330,7 +372,9 @@ See also documentation for `\\[mh-send]' function."
(config (current-window-configuration)))
(message "Composing a reply...")
(mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder"
- mh-current-folder msg
+ (if (stringp mh-repl-formfile) ;must be string, but we're paranoid
+ (list "-form" mh-repl-formfile))
+ mh-current-folder message
(cond ((or (equal reply-to "from") (equal reply-to ""))
'("-nocc" "all"))
((equal reply-to "to")
@@ -345,27 +389,28 @@ See also documentation for `\\[mh-send]' function."
(delete-other-windows)
(set-buffer-modified-p nil)
- (let ((to (mh-get-field "To:"))
- (subject (mh-get-field "Subject:"))
- (cc (mh-get-field "Cc:")))
+ (let ((to (mh-get-header-field "To:"))
+ (subject (mh-get-header-field "Subject:"))
+ (cc (mh-get-header-field "Cc:")))
(goto-char (point-min))
(mh-goto-header-end 1)
(or includep
(mh-in-show-buffer (show-buffer)
- (mh-display-msg msg folder)))
- (mh-add-msgs-to-seq msg 'answered t)
+ (mh-display-msg message folder)))
+ (mh-add-msgs-to-seq message 'answered t)
(message "Composing a reply...done")
- (mh-compose-and-send-mail draft "" folder msg to subject cc
+ (mh-compose-and-send-mail draft "" folder message to subject cc
mh-note-repl "Replied:" config))))))
(defun mh-send (to cc subject)
"Compose and send a letter.
The file named by `mh-comp-formfile' will be used as the form.
+Do not call this function from outside mh-e; use \\[mh-smail] instead.
+
The letter is composed in mh-letter-mode; see its documentation for more
details. If `mh-compose-letter-function' is defined, it is called on the
-draft and passed three arguments: to, subject, and cc.
-Do not call this function from outside mh-e; use \\[mh-smail] instead."
+draft and passed three arguments: to, subject, and cc."
(interactive (list
(mh-read-address "To: ")
(mh-read-address "Cc: ")
@@ -389,9 +434,9 @@ See also documentation for `\\[mh-send]' function."
(defun mh-send-sub (to cc subject config)
- "Do the real work of composing and sending a letter.
-Expects the TO, CC, and SUBJECT fields as arguments.
-CONFIG is the window configuration before sending mail."
+ ;; Do the real work of composing and sending a letter.
+ ;; Expects the TO, CC, and SUBJECT fields as arguments.
+ ;; CONFIG is the window configuration before sending mail.
(let ((folder mh-current-folder)
(msg-num (mh-get-msg-num nil)))
(message "Composing a message...")
@@ -507,18 +552,45 @@ CONFIG is the window configuration before sending mail."
;; Move to end of entire header if FIELD not found.
;; Returns non-nil iff FIELD was found.
;; The optional second arg is for pre-version 4 compatibility.
- (let ((case-fold-search t))
- (goto-char (point-min))
- (mh-goto-header-end 0)
- (if (re-search-backward (format "^%s" field) nil t)
- (progn
- (forward-line 1)
- (while (looking-at "^[ \t]")
- (forward-line 1))
- (backward-char 1) ;to end of previous line
- t)
- nil)))
-
+ (if (mh-goto-header-field field)
+ (progn
+ (mh-header-field-end)
+ t)))
+
+
+(defun mh-get-header-field (field)
+ ;; Find and return the body of FIELD in the mail header.
+ ;; Returns the empty string if the field is not in the header of the
+ ;; current buffer.
+ (if (mh-goto-header-field field)
+ (progn
+ (skip-chars-forward " \t") ;strip leading white space in body
+ (let ((start (point)))
+ (mh-header-field-end)
+ (buffer-substring start (point))))
+ ""))
+
+(fset 'mh-get-field 'mh-get-header-field) ;mh-e 4 compatibility
+
+(defun mh-goto-header-field (field)
+ ;; Move to FIELD in the message header.
+ ;; Move to the end of the FIELD name, which should end in a colon.
+ ;; Returns T if found, NIL if not.
+ (goto-char (point-min))
+ (let ((case-fold-search t)
+ (headers-end (save-excursion
+ (mh-goto-header-end 0)
+ (point))))
+ (re-search-forward (format "^%s" field) headers-end t)))
+
+(defun mh-header-field-end ()
+ ;; Move to the end of the current header field.
+ ;; Handles RFC 822 continuation lines.
+ (forward-line 1)
+ (while (looking-at "^[ \t]")
+ (forward-line 1))
+ (backward-char 1)) ;to end of previous line
+
(defun mh-goto-header-end (arg)
;; Find the end of the message header in the current buffer and position
@@ -536,27 +608,25 @@ CONFIG is the window configuration before sending mail."
;;; Mode for composing and sending a draft message.
-(defvar mh-sent-from-folder nil
- "Folder of msg associated with this letter.")
+(defvar mh-sent-from-folder nil) ;Folder of msg assoc with this letter.
-(defvar mh-sent-from-msg nil
- "Number of msg associated with this letter.")
+(defvar mh-sent-from-msg nil) ;Number of msg assoc with this letter.
-(defvar mh-send-args nil
- "Extra arguments to pass to \"send\" command.")
+(defvar mh-send-args nil) ;Extra args to pass to "send" command.
-(defvar mh-annotate-char nil
- "Character to use to annotate mh-sent-from-msg.")
+(defvar mh-annotate-char nil) ;Character to use to annotate mh-sent-from-msg.
-(defvar mh-annotate-field nil
- "Field name for message annotation.")
+(defvar mh-annotate-field nil) ;Field name for message annotation.
(put 'mh-letter-mode 'mode-class 'special)
;;;###autoload
(defun mh-letter-mode ()
"Mode for composing letters in mh-e.\\<mh-letter-mode-map>
-When you have finished composing, type \\[mh-send-letter] to send the letter.
+When you have finished composing, type \\[mh-send-letter] to send the message
+using the MH mail handling system.
+See the documentation for \\[mh-edit-mhn] for information on composing MIME
+messages.
\\{mh-letter-mode-map}
@@ -572,6 +642,10 @@ Variables controlling this mode (defaults in parentheses):
If nil, only the portion of the message following the point will be yanked.
If there is a region, this variable is ignored.
+ mh-ins-buf-prefix (\"> \")
+ String to insert before each non-blank line of a message as it is
+ inserted in a draft letter.
+
mh-signature-file-name (\"~/.signature\")
File to be inserted into message by \\[mh-insert-signature].
@@ -580,12 +654,11 @@ invoked with no args, if those values are non-nil."
(interactive)
(or mh-user-path (mh-find-path))
- (kill-all-local-variables)
(make-local-variable 'paragraph-start)
- (setq paragraph-start (concat "[ \t]*[-_][-_][-_]+$\\|" paragraph-start))
+ (setq paragraph-start (concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-start))
(make-local-variable 'paragraph-separate)
(setq paragraph-separate
- (concat "[ \t]*[-_][-_][-_]+$\\|" paragraph-separate))
+ (concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-separate))
(make-local-variable 'mh-send-args)
(make-local-variable 'mh-annotate-char)
(make-local-variable 'mh-annotate-field)
@@ -631,11 +704,14 @@ invoked with no args, if those values are non-nil."
(defun mh-to-field ()
"Move point to the end of a specified header field.
The field is indicated by the previous keystroke (the last keystroke
-of the command) according to the list in mh-to-field-choices.
+of the command) according to the list in the variable mh-to-field-choices.
Create the field if it does not exist. Set the mark to point before moving."
(interactive)
(expand-abbrev)
- (let ((target (cdr (assoc (logior last-input-char ?`) mh-to-field-choices)))
+ (let ((target (cdr (or (assoc (char-to-string (logior last-input-char ?`))
+ mh-to-field-choices)
+ ;; also look for a char for version 4 compat
+ (assoc (logior last-input-char ?`) mh-to-field-choices))))
(case-fold-search t))
(push-mark)
(cond ((mh-position-on-field target)
@@ -662,10 +738,10 @@ Prompt for the field name with a completion list of the current folders."
(or folder
(setq folder (mh-prompt-for-folder
"Fcc"
- (or (and mh-msg-folder-hook
+ (or (and mh-default-folder-for-message-function
(save-excursion
(goto-char (point-min))
- (funcall mh-msg-folder-hook)))
+ (funcall mh-default-folder-for-message-function)))
"")
t)))
(let ((last-input-char ?\C-f))
@@ -685,9 +761,9 @@ Prompt for the field name with a completion list of the current folders."
(defun mh-check-whom ()
- "Verify recipients of the current letter."
+ "Verify recipients of the current letter, showing expansion of any aliases."
(interactive)
- (let ((file-name (buffer-file-name)))
+ (let ((file-name buffer-file-name))
(save-buffer)
(message "Checking recipients...")
(mh-in-show-buffer ("*Recipients*")
@@ -726,9 +802,9 @@ Prompt for the field name with a completion list of the current folders."
(setq mh-previous-window-config config)
(setq mode-line-buffer-identification (list "{%b}"))
(if (and (boundp 'mh-compose-letter-function)
- (symbol-value 'mh-compose-letter-function))
+ mh-compose-letter-function)
;; run-hooks will not pass arguments.
- (let ((value (symbol-value 'mh-compose-letter-function)))
+ (let ((value mh-compose-letter-function))
(if (and (listp value) (not (eq (car value) 'lambda)))
(while value
(funcall (car value) to subject cc)
@@ -746,7 +822,7 @@ Run mh-before-send-letter-hook before doing anything."
(save-buffer)
(message "Sending...")
(let ((draft-buffer (current-buffer))
- (file-name (buffer-file-name))
+ (file-name buffer-file-name)
(config mh-previous-window-config))
(cond (arg
(pop-to-buffer "MH mail delivery")
@@ -765,8 +841,8 @@ Run mh-before-send-letter-hook before doing anything."
mh-annotate-char
"-component" mh-annotate-field
"-text" (format "\"%s %s\""
- (mh-get-field "To:")
- (mh-get-field "Cc:"))))
+ (mh-get-header-field "To:")
+ (mh-get-header-field "Cc:"))))
(cond ((or (not arg)
(y-or-n-p "Kill draft buffer? "))
@@ -778,27 +854,27 @@ Run mh-before-send-letter-hook before doing anything."
(message "Sending...backgrounded"))))
-(defun mh-insert-letter (msg folder verbatum)
- "Insert a MESSAGE from any FOLDER into the current letter.
-Removes the message's headers using mh-invisible-headers.
-Prefixes each non-blank line with mh-ins-buf-prefix (default \"> \").
-If prefix argument VERBATUM provided, do not indent and do not delete
-headers. Leaves the mark before the letter and point after it."
+(defun mh-insert-letter (folder message verbatim)
+ "Insert a message into the current letter.
+Removes the message's headers using mh-invisible-headers. Prefixes
+each non-blank line with mh-ins-buf-prefix. Prompts for FOLDER and
+MESSAGE. If prefix argument VERBATIM provided, do not indent and do
+not delete headers. Leaves the mark before the letter and point after it."
(interactive
- (list (read-input (format "Message number%s: "
+ (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
+ (read-input (format "Message number%s: "
(if mh-sent-from-msg
(format " [%d]" mh-sent-from-msg)
- "")))
- (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
+ "")))
current-prefix-arg))
(save-restriction
(narrow-to-region (point) (point))
(let ((start (point-min)))
- (if (equal msg "") (setq msg (int-to-string mh-sent-from-msg)))
+ (if (equal message "") (setq message (int-to-string mh-sent-from-msg)))
(mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
- (expand-file-name msg
+ (expand-file-name message
(mh-expand-file-name folder)))
- (cond ((not verbatum)
+ (cond ((not verbatim)
(mh-clean-msg-header start mh-invisible-headers mh-visible-headers)
(set-mark start) ; since mh-clean-msg-header moves it
(mh-insert-prefix-string mh-ins-buf-prefix))))))
@@ -822,8 +898,8 @@ yanked message will be deleted."
(delete-windows-on mh-show-buffer))
(set-buffer mh-show-buffer) ; Find displayed message
(let ((mh-ins-str (cond ((if (boundp 'mark-active)
- mark-active ;Emacs 19
- (mark)) ;Emacs 18
+ mark-active ;Emacs 19
+ (mark)) ;Emacs 18
(buffer-substring (region-beginning)
(region-end)))
((eq 'body mh-yank-from-start-of-msg)
@@ -838,27 +914,27 @@ yanked message will be deleted."
(t
(buffer-substring (point) (point-max))))))
(set-buffer to-buffer)
- (narrow-to-region to-point to-point)
- (push-mark)
- (insert mh-ins-str)
- (mh-insert-prefix-string mh-ins-buf-prefix)
- (insert "\n")
- (widen)))
- (error "There is no current message")))
+ (save-restriction
+ (narrow-to-region to-point to-point)
+ (push-mark)
+ (insert mh-ins-str)
+ (mh-insert-prefix-string mh-ins-buf-prefix)
+ (insert "\n"))))
+ (error "There is no current message")))
(defun mh-insert-prefix-string (mh-ins-string)
- ;; Run MAIL-CITATION-HOOK to insert a prefix string before each line
+ ;; Run mail-citation-hook to insert a prefix string before each line
;; in the buffer. Generality for supercite users.
- (save-excursion
- (set-mark (point-max))
- (goto-char (point-min))
- (cond (mail-citation-hook
- (run-hooks 'mail-citation-hook))
- (mh-yank-hooks ;old hook name
- (run-hooks 'mh-yank-hooks))
- (t
- (or (bolp) (forward-line 1))
+ (set-mark (point-max))
+ (goto-char (point-min))
+ (cond (mail-citation-hook
+ (run-hooks 'mail-citation-hook))
+ (mh-yank-hooks ;old hook name
+ (run-hooks 'mh-yank-hooks))
+ (t
+ (or (bolp) (forward-line 1))
+ (let ((zmacs-regions nil)) ;so "(mark)" works in XEmacs
(while (< (point) (mark))
(insert mh-ins-string)
(forward-line 1))))))
@@ -870,8 +946,8 @@ Use \\[kill-buffer] if you don't want to delete the draft message file."
(interactive)
(if (y-or-n-p "Kill draft message? ")
(let ((config mh-previous-window-config))
- (if (file-exists-p (buffer-file-name))
- (delete-file (buffer-file-name)))
+ (if (file-exists-p buffer-file-name)
+ (delete-file buffer-file-name))
(set-buffer-modified-p nil)
(kill-buffer (buffer-name))
(message "")
@@ -879,23 +955,30 @@ Use \\[kill-buffer] if you don't want to delete the draft message file."
(set-window-configuration config)))
(error "Message not killed")))
+
;;; Build the letter-mode keymap:
(define-key mh-letter-mode-map "\C-c\C-f\C-b" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-f\C-c" 'mh-to-field)
+(define-key mh-letter-mode-map "\C-c\C-f\C-d" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-f\C-f" 'mh-to-fcc)
+(define-key mh-letter-mode-map "\C-c\C-f\C-r" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-f\C-s" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-f\C-t" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-fb" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-fc" 'mh-to-field)
+(define-key mh-letter-mode-map "\C-c\C-fd" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-ff" 'mh-to-fcc)
+(define-key mh-letter-mode-map "\C-c\C-fr" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-fs" 'mh-to-field)
(define-key mh-letter-mode-map "\C-c\C-ft" 'mh-to-field)
+(define-key mh-letter-mode-map "\C-c\C-i" 'mh-insert-letter)
(define-key mh-letter-mode-map "\C-c\C-q" 'mh-fully-kill-draft)
+(define-key mh-letter-mode-map "\C-c\C-\\" 'mh-fully-kill-draft) ;if no C-q
+(define-key mh-letter-mode-map "\C-c\C-s" 'mh-insert-signature)
+(define-key mh-letter-mode-map "\C-c\C-^" 'mh-insert-signature) ;if no C-s
(define-key mh-letter-mode-map "\C-c\C-w" 'mh-check-whom)
-(define-key mh-letter-mode-map "\C-c\C-i" 'mh-insert-letter)
(define-key mh-letter-mode-map "\C-c\C-y" 'mh-yank-cur-msg)
-(define-key mh-letter-mode-map "\C-c\C-s" 'mh-insert-signature)
(define-key mh-letter-mode-map "\C-c\C-c" 'mh-send-letter)
(define-key mh-letter-mode-map "\C-c\C-m\C-f" 'mh-mhn-compose-forw)
(define-key mh-letter-mode-map "\C-c\C-m\C-e" 'mh-mhn-compose-anon-ftp)
@@ -908,21 +991,36 @@ Use \\[kill-buffer] if you don't want to delete the draft message file."
;;; autoloads from mh-mime
(autoload 'mh-mhn-compose-insertion "mh-mime"
- "Add a directive to insert a message part from a file." t)
+ "Add a directive to insert a message part from a file.
+This is the typical way to insert non-text parts in a message.
+See also \\[mh-edit-mhn]." t)
+
(autoload 'mh-mhn-compose-anon-ftp "mh-mime"
- "Add a directive for an anonymous ftp external body part." t)
+ "Add a directive for an anonymous ftp external body part.
+This directive tells MH to include a reference to a
+message/external-body part retrievable by anonymous FTP.
+See also \\[mh-edit-mhn]." t)
+
(autoload 'mh-mhn-compose-external-compressed-tar "mh-mime"
- "Add a directive to include a reference to a compressed tar file." t)
+ "Add a directive to include a reference to a compressed tar file.
+The file should be available via anonymous ftp. This directive
+tells MH to include a reference to a message/external-body part.
+See also \\[mh-edit-mhn]." t)
+
(autoload 'mh-mhn-compose-forw "mh-mime"
- "Add a forw directive to this message." t)
+ "Add a forw directive to this message.
+This directive tells MH to include another message in this one.
+See also \\[mh-edit-mhn]." t)
+
(autoload 'mh-edit-mhn "mh-mime"
- "Filter the current draft through the mhn program for MIME formatting.
-Using directives already inserted in the draft, fills in
+ "Format the current draft for MIME, expanding any mhn directives.
+Process the current draft with the mhn program, which,
+using directives already inserted in the draft, fills in
all the MIME components and header fields.
This step should be done last just before sending the message.
The mhn program is part of MH version 6.8 or later.
The `\\[mh-revert-mhn-edit]' command undoes this command.
-For assistance with creating MIME directives to insert
+For assistance with creating mhn directives to insert
various types of components in a message, see
\\[mh-mhn-compose-insertion] (generic insertion from a file),
\\[mh-mhn-compose-anon-ftp] (external reference to file via anonymous ftp),
@@ -931,4 +1029,5 @@ various types of components in a message, see
\\[mh-mhn-compose-forw] (forward message)." t)
(autoload 'mh-revert-mhn-edit "mh-mime"
- "Undoes the effect of \\[mh-edit-mhn] by reverting to the backup file." t)
+ "Undoes the effect of \\[mh-edit-mhn] by reverting to the backup file.
+Optional non-nil argument means don't ask for confirmation." t)