1994-03-15 06:16:30 +00:00
|
|
|
|
;;; mh-comp --- mh-e functions for composing messages
|
1995-11-03 02:28:52 +00:00
|
|
|
|
;; Time-stamp: <95/08/19 17:48:59 gildea>
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
2000-08-16 21:03:36 +00:00
|
|
|
|
;; Copyright (C) 1993,1995,1997,2000 Free Software Foundation, Inc.
|
|
|
|
|
|
2000-11-02 12:37:54 +00:00
|
|
|
|
;; Maintainer: Bill Wohler <wohler@newt.com>
|
2000-08-16 21:03:36 +00:00
|
|
|
|
;; Keywords: mail
|
|
|
|
|
;; Bug-reports: include `M-x mh-version' output in any correspondence
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-11-03 02:28:52 +00:00
|
|
|
|
;; This file is part of mh-e, part of GNU Emacs.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-04-10 00:20:07 +00:00
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
;; any later version.
|
|
|
|
|
|
1995-04-10 00:20:07 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
|
|
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
;; Boston, MA 02111-1307, USA.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; Internal support for mh-e package.
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
;;; Change Log:
|
|
|
|
|
|
2001-02-08 00:01:35 +00:00
|
|
|
|
;; $Id: mh-comp.el,v 1.20 2000/11/02 12:37:38 gerd Exp $
|
1995-04-09 22:31:08 +00:00
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(provide 'mh-comp)
|
|
|
|
|
(require 'mh-utils)
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
;;; Site customization (see also mh-utils.el):
|
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defgroup mh-compose nil
|
|
|
|
|
"Mh-e functions for composing messages"
|
|
|
|
|
:prefix "mh-"
|
|
|
|
|
:group 'mh)
|
|
|
|
|
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(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.")
|
|
|
|
|
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(defvar mh-note-repl "-"
|
|
|
|
|
"String whose first character is used to notate replied to messages.")
|
|
|
|
|
|
|
|
|
|
(defvar mh-note-forw "F"
|
|
|
|
|
"String whose first character is used to notate forwarded messages.")
|
|
|
|
|
|
|
|
|
|
(defvar mh-note-dist "R"
|
|
|
|
|
"String whose first character is used to notate redistributed messages.")
|
|
|
|
|
|
|
|
|
|
(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.
|
|
|
|
|
And each hook function should leave point and mark around the citation
|
|
|
|
|
text as modified.
|
|
|
|
|
|
|
|
|
|
This is a normal hook, misnamed for historical reasons.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
It is semi-obsolete and is only used if `mail-citation-hook' is nil.")
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
(defvar mail-citation-hook nil
|
|
|
|
|
"*Hook for modifying a citation just inserted in the mail buffer.
|
|
|
|
|
Each hook function can find the citation between point and mark.
|
|
|
|
|
And each hook function should leave point and mark around the citation
|
|
|
|
|
text as modified.
|
|
|
|
|
|
|
|
|
|
If this hook is entirely empty (nil), the text of the message is inserted
|
1997-09-15 19:45:16 +00:00
|
|
|
|
with `mh-ins-buf-prefix' prefixed to each line.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1997-09-15 19:45:16 +00:00
|
|
|
|
See also the variable `mh-yank-from-start-of-msg', which controls how
|
1994-03-15 06:16:30 +00:00
|
|
|
|
much of the message passed to the hook.")
|
|
|
|
|
|
|
|
|
|
;;; Copied from sendmail.el for Hyperbole
|
|
|
|
|
(defvar mail-header-separator "--------"
|
|
|
|
|
"*Line used by MH to separate headers from text in messages being composed.")
|
|
|
|
|
|
|
|
|
|
;;; Personal preferences:
|
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-delete-yanked-msg-window nil
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"*Controls window display when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
|
|
|
|
|
If non-nil, yanking the current message into a draft letter deletes any
|
1997-04-12 20:20:55 +00:00
|
|
|
|
windows displaying the message."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-yank-from-start-of-msg t
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
|
|
|
|
|
If non-nil, include the entire message. If the symbol `body', then yank the
|
|
|
|
|
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
|
1997-04-12 20:20:55 +00:00
|
|
|
|
ignored."
|
1998-06-24 09:16:26 +00:00
|
|
|
|
:type '(choice (const :tag "Below point" nil)
|
|
|
|
|
(const :tag "Without header" body)
|
|
|
|
|
(other :tag "Entire message" t))
|
1997-04-12 20:20:55 +00:00
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-ins-buf-prefix "> "
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"*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
|
1997-04-12 20:20:55 +00:00
|
|
|
|
by \\[mh-insert-letter] or \\[mh-yank-cur-msg]."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'mh-compose)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-reply-default-reply-to nil
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"*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
|
1995-04-09 22:31:08 +00:00
|
|
|
|
value and it should be one of \"from\", \"to\", \"cc\", or \"all\".
|
1997-04-12 20:20:55 +00:00
|
|
|
|
The values \"cc\" and \"all\" do the same thing."
|
|
|
|
|
:type '(choice (const :tag "Prompt" nil)
|
|
|
|
|
(const "from") (const "to")
|
|
|
|
|
(const "cc") (const "all"))
|
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-signature-file-name "~/.signature"
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"*Name of file containing the user's signature.
|
1997-04-12 20:20:55 +00:00
|
|
|
|
Inserted into message by \\<mh-letter-mode-map>\\[mh-insert-signature]."
|
|
|
|
|
:type 'file
|
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-forward-subject-format "%s: %s"
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"*Format to generate the Subject: line contents for a forwarded message.
|
|
|
|
|
The two string arguments to the format are the sender of the original
|
1997-04-12 20:20:55 +00:00
|
|
|
|
message and the original subject line."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
(defvar mh-comp-formfile "components"
|
|
|
|
|
"Name of file to be used as a skeleton for composing messages.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
Default is \"components\". If not an absolute file name, the file
|
1994-03-15 06:16:30 +00:00
|
|
|
|
is searched for first in the user's MH directory, then in the
|
|
|
|
|
system MH lib directory.")
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-repl-formfile "replcomps"
|
|
|
|
|
"Name of file to be used as a skeleton for replying to messages.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
Default is \"replcomps\". If not an absolute file name, the file
|
1995-04-09 22:31:08 +00:00
|
|
|
|
is searched for first in the user's MH directory, then in the
|
|
|
|
|
system MH lib directory.")
|
|
|
|
|
|
1999-03-01 03:47:07 +00:00
|
|
|
|
(defvar mh-repl-group-formfile "replgroupcomps"
|
|
|
|
|
"Name of file to be used as a skeleton for replying to the sender
|
|
|
|
|
and all recipients of a messages. Only used if mh-nmh-p is non-nil.
|
|
|
|
|
Default is \"replgroupcomps\". If not an absolute file name, the file
|
|
|
|
|
is searched for first in the user's MH directory, then in the system
|
|
|
|
|
MH lib directory.")
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;;; Hooks:
|
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-letter-mode-hook nil
|
|
|
|
|
"Invoked in `mh-letter-mode' on a new letter."
|
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1997-04-12 20:20:55 +00:00
|
|
|
|
(defcustom mh-compose-letter-function nil
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"Invoked when setting up a letter draft.
|
1997-04-12 20:20:55 +00:00
|
|
|
|
It is passed three arguments: TO recipients, SUBJECT, and CC recipients."
|
2001-02-08 00:01:35 +00:00
|
|
|
|
:type '(choice (const nil) function)
|
1997-04-12 20:20:55 +00:00
|
|
|
|
:group 'mh-compose)
|
|
|
|
|
|
|
|
|
|
(defcustom mh-before-send-letter-hook nil
|
|
|
|
|
"Invoked at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command."
|
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'mh-compose)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar mh-rejected-letter-start
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(concat "^ ----- Unsent message follows -----$" ;from sendmail V5
|
|
|
|
|
"\\|^ ----- Original message follows -----$" ;from sendmail V8
|
|
|
|
|
"\\|^------- Unsent Draft$" ;from MH itself
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"\\|^---------- Original Message ----------$" ;from zmailer
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"\\|^ --- The unsent message follows ---$" ;from AIX mail system
|
|
|
|
|
"\\|^ Your message follows:$" ;from MMDF-II
|
|
|
|
|
"\\|^Content-Description: Returned Content$" ;1993 KJ sendmail
|
|
|
|
|
)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"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
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:"
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"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.")
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-to-field-choices '(("t" . "To:") ("s" . "Subject:") ("c" . "Cc:")
|
|
|
|
|
("b" . "Bcc:") ("f" . "Fcc:") ("r" . "From:")
|
|
|
|
|
("d" . "Dcc:"))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"Alist of (final-character . field-name) choices for mh-to-field.")
|
|
|
|
|
|
|
|
|
|
(defvar mh-letter-mode-map (copy-keymap text-mode-map)
|
|
|
|
|
"Keymap for composing mail.")
|
|
|
|
|
|
|
|
|
|
(defvar mh-letter-mode-syntax-table nil
|
|
|
|
|
"Syntax table used by mh-e while in MH-Letter mode.")
|
|
|
|
|
|
|
|
|
|
(if mh-letter-mode-syntax-table
|
|
|
|
|
()
|
|
|
|
|
(setq mh-letter-mode-syntax-table
|
|
|
|
|
(make-syntax-table text-mode-syntax-table))
|
|
|
|
|
(modify-syntax-entry ?% "." mh-letter-mode-syntax-table))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(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
|
1995-04-09 22:31:08 +00:00
|
|
|
|
to the MH mail system.
|
|
|
|
|
|
|
|
|
|
See documentation of `\\[mh-send]' for more details on composing mail."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(mh-find-path)
|
|
|
|
|
(call-interactively 'mh-send))
|
|
|
|
|
|
|
|
|
|
|
1995-11-03 02:28:52 +00:00
|
|
|
|
(defvar mh-error-if-no-draft nil) ;raise error over using old draft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
1999-03-01 03:47:07 +00:00
|
|
|
|
(defun mh-smail-batch (&optional to subject other-headers &rest ignored)
|
1995-11-03 02:28:52 +00:00
|
|
|
|
"Set up a mail composition draft with the MH mail system.
|
|
|
|
|
This function is an entry point to mh-e, the Emacs front end
|
|
|
|
|
to the MH mail system. This function does not prompt the user
|
|
|
|
|
for any header fields, and thus is suitable for use by programs
|
|
|
|
|
that want to create a mail buffer.
|
|
|
|
|
Users should use `\\[mh-smail]' to compose mail."
|
|
|
|
|
(mh-find-path)
|
|
|
|
|
(let ((mh-error-if-no-draft t))
|
1999-11-10 10:46:01 +00:00
|
|
|
|
(mh-send (or to "") "" (or subject ""))))
|
1995-11-03 02:28:52 +00:00
|
|
|
|
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(defun mh-edit-again (msg)
|
|
|
|
|
"Clean-up a draft or a message previously sent and make it resendable.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
Default is the current message.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
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)))
|
|
|
|
|
(let* ((from-folder mh-current-folder)
|
|
|
|
|
(config (current-window-configuration))
|
|
|
|
|
(draft
|
|
|
|
|
(cond ((and mh-draft-folder (equal from-folder mh-draft-folder))
|
|
|
|
|
(pop-to-buffer (find-file-noselect (mh-msg-filename msg)) t)
|
|
|
|
|
(rename-buffer (format "draft-%d" msg))
|
|
|
|
|
(buffer-name))
|
|
|
|
|
(t
|
|
|
|
|
(mh-read-draft "clean-up" (mh-msg-filename msg) nil)))))
|
|
|
|
|
(mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)
|
|
|
|
|
(goto-char (point-min))
|
1995-11-03 02:28:52 +00:00
|
|
|
|
(save-buffer)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(mh-compose-and-send-mail draft "" from-folder nil nil nil nil nil nil
|
|
|
|
|
config)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-extract-rejected-mail (msg)
|
|
|
|
|
"Extract a letter returned by the mail system and make it resendable.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
Default is the current message. The variable `mh-new-draft-cleaned-headers'
|
1994-03-15 06:16:30 +00:00
|
|
|
|
gives the headers to clean out of the original message.
|
|
|
|
|
See also documentation for `\\[mh-send]' function."
|
|
|
|
|
(interactive (list (mh-get-msg-num t)))
|
|
|
|
|
(let ((from-folder mh-current-folder)
|
|
|
|
|
(config (current-window-configuration))
|
|
|
|
|
(draft (mh-read-draft "extraction" (mh-msg-filename msg) nil)))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(cond ((re-search-forward mh-rejected-letter-start nil t)
|
|
|
|
|
(skip-chars-forward " \t\n")
|
|
|
|
|
(delete-region (point-min) (point))
|
|
|
|
|
(mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil))
|
|
|
|
|
(t
|
|
|
|
|
(message "Does not appear to be a rejected letter.")))
|
|
|
|
|
(goto-char (point-min))
|
1995-11-03 02:28:52 +00:00
|
|
|
|
(save-buffer)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-compose-and-send-mail draft "" from-folder msg
|
|
|
|
|
(mh-get-header-field "To:")
|
|
|
|
|
(mh-get-header-field "From:")
|
|
|
|
|
(mh-get-header-field "Cc:")
|
1994-03-15 06:16:30 +00:00
|
|
|
|
nil nil config)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-forward (to cc &optional msg-or-seq)
|
|
|
|
|
"Forward a message or message sequence. Defaults to displayed message.
|
|
|
|
|
If optional prefix argument provided, then prompt for the message sequence.
|
|
|
|
|
See also documentation for `\\[mh-send]' function."
|
|
|
|
|
(interactive (list (mh-read-address "To: ")
|
|
|
|
|
(mh-read-address "Cc: ")
|
|
|
|
|
(if current-prefix-arg
|
|
|
|
|
(mh-read-seq-default "Forward" t)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-get-msg-num t))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(or msg-or-seq
|
|
|
|
|
(setq msg-or-seq (mh-get-msg-num t)))
|
|
|
|
|
(let* ((folder mh-current-folder)
|
|
|
|
|
(config (current-window-configuration))
|
|
|
|
|
;; forw always leaves file in "draft" since it doesn't have -draft
|
|
|
|
|
(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? "))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-exec-cmd "forw" "-build"
|
|
|
|
|
mh-current-folder msg-or-seq)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(prog1
|
|
|
|
|
(mh-read-draft "" draft-name t)
|
|
|
|
|
(mh-insert-fields "To:" to "Cc:" cc)
|
1995-11-03 02:28:52 +00:00
|
|
|
|
(save-buffer)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(t
|
1999-09-04 00:08:17 +00:00
|
|
|
|
(mh-read-draft "" draft-name nil))))
|
|
|
|
|
(fwd-msg-file (mh-msg-filename (if (numberp msg-or-seq)
|
|
|
|
|
msg-or-seq
|
|
|
|
|
(car (mh-seq-to-msgs msg-or-seq)))
|
|
|
|
|
folder)))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(let (orig-from
|
|
|
|
|
orig-subject)
|
1999-09-04 00:08:17 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer (get-buffer-create mh-temp-buffer))
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert-file-contents fwd-msg-file)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(setq orig-from (mh-get-header-field "From:"))
|
|
|
|
|
(setq orig-subject (mh-get-header-field "Subject:")))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(let ((forw-subject
|
|
|
|
|
(mh-forwarded-letter-subject orig-from orig-subject)))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-insert-fields "Subject:" forw-subject)
|
|
|
|
|
(goto-char (point-min))
|
1999-09-04 00:08:17 +00:00
|
|
|
|
(if (re-search-forward "^------- Forwarded Message" nil t)
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(re-search-forward "^--------")
|
|
|
|
|
(forward-line 1))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(if (numberp msg-or-seq)
|
|
|
|
|
(mh-add-msgs-to-seq msg-or-seq 'forwarded t)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(mh-add-msgs-to-seq (mh-seq-to-msgs msg-or-seq) 'forwarded t))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-compose-and-send-mail draft "" folder msg-or-seq
|
|
|
|
|
to forw-subject cc
|
|
|
|
|
mh-note-forw "Forwarded:"
|
|
|
|
|
config)))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
(defun mh-forwarded-letter-subject (from subject)
|
|
|
|
|
;; Return a Subject suitable for a forwarded message.
|
|
|
|
|
;; Original message has headers FROM and SUBJECT.
|
|
|
|
|
(let ((addr-start (string-match "<" from))
|
|
|
|
|
(comment (string-match "(" from)))
|
|
|
|
|
(cond ((and addr-start (> addr-start 0))
|
|
|
|
|
;; Full Name <luser@host>
|
|
|
|
|
(setq from (substring from 0 (1- addr-start))))
|
|
|
|
|
(comment
|
|
|
|
|
;; luser@host (Full Name)
|
|
|
|
|
(setq from (substring from (1+ comment) (1- (length from)))))))
|
|
|
|
|
(format mh-forward-subject-format from subject))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(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
|
1995-04-09 22:31:08 +00:00
|
|
|
|
to the MH mail system.
|
|
|
|
|
|
|
|
|
|
See documentation of `\\[mh-send]' for more details on composing mail."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(mh-find-path)
|
|
|
|
|
(call-interactively 'mh-send-other-window))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-redistribute (to cc &optional msg)
|
|
|
|
|
"Redistribute a letter.
|
|
|
|
|
Depending on how your copy of MH was compiled, you may need to change the
|
1997-09-15 19:45:16 +00:00
|
|
|
|
setting of the variable `mh-redist-full-contents'. See its documentation."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive (list (mh-read-address "Redist-To: ")
|
|
|
|
|
(mh-read-address "Redist-Cc: ")
|
|
|
|
|
(mh-get-msg-num t)))
|
|
|
|
|
(or msg
|
|
|
|
|
(setq msg (mh-get-msg-num t)))
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(let ((folder mh-current-folder)
|
|
|
|
|
(draft (mh-read-draft "redistribution"
|
|
|
|
|
(if mh-redist-full-contents
|
|
|
|
|
(mh-msg-filename msg)
|
|
|
|
|
nil)
|
|
|
|
|
nil)))
|
|
|
|
|
(mh-goto-header-end 0)
|
|
|
|
|
(insert "Resent-To: " to "\n")
|
|
|
|
|
(if (not (equal cc "")) (insert "Resent-cc: " cc "\n"))
|
|
|
|
|
(mh-clean-msg-header (point-min)
|
|
|
|
|
"^Message-Id:\\|^Received:\\|^Return-Path:\\|^Sender:\\|^Date:\\|^From:"
|
|
|
|
|
nil)
|
|
|
|
|
(save-buffer)
|
|
|
|
|
(message "Redistributing...")
|
|
|
|
|
(if mh-redist-full-contents
|
|
|
|
|
(call-process "/bin/sh" nil 0 nil "-c"
|
|
|
|
|
(format "mhdist=1 mhaltmsg=%s %s -push %s"
|
1995-04-09 22:31:08 +00:00
|
|
|
|
buffer-file-name
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(expand-file-name mh-send-prog mh-progs)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
buffer-file-name))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(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)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
buffer-file-name)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(mh-annotate-msg msg folder mh-note-dist
|
|
|
|
|
"-component" "Resent:"
|
|
|
|
|
"-text" (format "\"%s %s\"" to cc))
|
|
|
|
|
(kill-buffer draft)
|
|
|
|
|
(message "Redistributing...done"))))
|
|
|
|
|
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defun mh-reply (message &optional includep)
|
|
|
|
|
"Reply to MESSAGE (default: current message).
|
1994-03-15 06:16:30 +00:00
|
|
|
|
If optional prefix argument INCLUDEP provided, then include the message
|
1997-09-15 19:45:16 +00:00
|
|
|
|
in the reply using filter `mhl.reply' in your MH directory.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
Prompts for type of addresses to reply to:
|
|
|
|
|
from sender only,
|
|
|
|
|
to sender and primary recipients,
|
|
|
|
|
cc/all sender and all recipients.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
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."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(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"))
|
1999-03-01 03:47:07 +00:00
|
|
|
|
(let* ((reply-to (or mh-reply-default-reply-to
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(completing-read "Reply to whom: "
|
|
|
|
|
'(("from") ("to") ("cc") ("all"))
|
|
|
|
|
nil
|
|
|
|
|
t)))
|
1999-03-01 03:47:07 +00:00
|
|
|
|
(folder mh-current-folder)
|
|
|
|
|
(show-buffer mh-show-buffer)
|
|
|
|
|
(config (current-window-configuration))
|
|
|
|
|
(group-reply (or (equal reply-to "cc") (equal reply-to "all")))
|
|
|
|
|
(form-file (cond ((and mh-nmh-p group-reply
|
|
|
|
|
(stringp mh-repl-group-formfile))
|
|
|
|
|
mh-repl-group-formfile)
|
|
|
|
|
((stringp mh-repl-formfile) mh-repl-formfile)
|
|
|
|
|
(t nil))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(message "Composing a reply...")
|
|
|
|
|
(mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder"
|
1999-03-01 03:47:07 +00:00
|
|
|
|
(if form-file
|
|
|
|
|
(list "-form" form-file))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
mh-current-folder message
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(cond ((or (equal reply-to "from") (equal reply-to ""))
|
|
|
|
|
'("-nocc" "all"))
|
|
|
|
|
((equal reply-to "to")
|
|
|
|
|
'("-cc" "to"))
|
1999-03-01 03:47:07 +00:00
|
|
|
|
(group-reply (if mh-nmh-p
|
|
|
|
|
'("-group" "-nocc" "me")
|
|
|
|
|
'("-cc" "all" "-nocc" "me"))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(if includep
|
|
|
|
|
'("-filter" "mhl.reply")))
|
|
|
|
|
(let ((draft (mh-read-draft "reply"
|
|
|
|
|
(expand-file-name "reply" mh-user-path)
|
|
|
|
|
t)))
|
|
|
|
|
(delete-other-windows)
|
1995-11-03 02:28:52 +00:00
|
|
|
|
(save-buffer)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(let ((to (mh-get-header-field "To:"))
|
|
|
|
|
(subject (mh-get-header-field "Subject:"))
|
|
|
|
|
(cc (mh-get-header-field "Cc:")))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(mh-goto-header-end 1)
|
|
|
|
|
(or includep
|
|
|
|
|
(mh-in-show-buffer (show-buffer)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-display-msg message folder)))
|
|
|
|
|
(mh-add-msgs-to-seq message 'answered t)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(message "Composing a reply...done")
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-compose-and-send-mail draft "" folder message to subject cc
|
1994-03-15 06:16:30 +00:00
|
|
|
|
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.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
Do not call this function from outside mh-e; use \\[mh-smail] instead.
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
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
|
1997-09-15 19:45:16 +00:00
|
|
|
|
draft and passed three arguments: TO, SUBJECT, and CC."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive (list
|
|
|
|
|
(mh-read-address "To: ")
|
|
|
|
|
(mh-read-address "Cc: ")
|
|
|
|
|
(read-string "Subject: ")))
|
|
|
|
|
(let ((config (current-window-configuration)))
|
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(mh-send-sub to cc subject config)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-send-other-window (to cc subject)
|
|
|
|
|
"Compose and send a letter in another window.
|
|
|
|
|
Do not call this function from outside mh-e;
|
|
|
|
|
use \\[mh-smail-other-window] instead.
|
|
|
|
|
See also documentation for `\\[mh-send]' function."
|
|
|
|
|
(interactive (list
|
|
|
|
|
(mh-read-address "To: ")
|
|
|
|
|
(mh-read-address "Cc: ")
|
|
|
|
|
(read-string "Subject: ")))
|
|
|
|
|
(let ((pop-up-windows t))
|
|
|
|
|
(mh-send-sub to cc subject (current-window-configuration))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-send-sub (to cc subject config)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
;; 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.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(let ((folder mh-current-folder)
|
|
|
|
|
(msg-num (mh-get-msg-num nil)))
|
|
|
|
|
(message "Composing a message...")
|
|
|
|
|
(let ((draft (mh-read-draft
|
|
|
|
|
"message"
|
|
|
|
|
(let (components)
|
|
|
|
|
(cond
|
|
|
|
|
((file-exists-p
|
|
|
|
|
(setq components
|
|
|
|
|
(expand-file-name mh-comp-formfile mh-user-path)))
|
|
|
|
|
components)
|
|
|
|
|
((file-exists-p
|
|
|
|
|
(setq components
|
|
|
|
|
(expand-file-name mh-comp-formfile mh-lib)))
|
|
|
|
|
components)
|
2000-04-27 18:56:42 +00:00
|
|
|
|
((file-exists-p
|
|
|
|
|
(setq components
|
2000-06-05 07:15:58 +00:00
|
|
|
|
(expand-file-name mh-comp-formfile
|
|
|
|
|
;; What is this mh-etc ?? -sm
|
|
|
|
|
(and (boundp 'mh-etc) mh-etc))))
|
2000-04-27 18:56:42 +00:00
|
|
|
|
components)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(t
|
|
|
|
|
(error (format "Can't find components file \"%s\""
|
|
|
|
|
components)))))
|
|
|
|
|
nil)))
|
|
|
|
|
(mh-insert-fields "To:" to "Subject:" subject "Cc:" cc)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(message "Composing a message...done")
|
|
|
|
|
(mh-compose-and-send-mail draft "" folder msg-num
|
|
|
|
|
to subject cc
|
|
|
|
|
nil nil config))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-read-draft (use initial-contents delete-contents-file)
|
|
|
|
|
;; Read draft file into a draft buffer and make that buffer the current one.
|
|
|
|
|
;; USE is a message used for prompting about the intended use of the message.
|
|
|
|
|
;; INITIAL-CONTENTS is filename that is read into an empty buffer, or NIL
|
|
|
|
|
;; if buffer should not be modified. Delete the initial-contents file if
|
|
|
|
|
;; DELETE-CONTENTS-FILE flag is set.
|
|
|
|
|
;; Returns the draft folder's name.
|
|
|
|
|
;; If the draft folder facility is enabled in ~/.mh_profile, a new buffer is
|
|
|
|
|
;; used each time and saved in the draft folder. The draft file can then be
|
|
|
|
|
;; reused.
|
|
|
|
|
(cond (mh-draft-folder
|
|
|
|
|
(let ((orig-default-dir default-directory)
|
|
|
|
|
(draft-file-name (mh-new-draft-name)))
|
|
|
|
|
(pop-to-buffer (generate-new-buffer
|
|
|
|
|
(format "draft-%s"
|
|
|
|
|
(file-name-nondirectory draft-file-name))))
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(insert-file-contents draft-file-name t)
|
|
|
|
|
(file-error))
|
|
|
|
|
(setq default-directory orig-default-dir)))
|
|
|
|
|
(t
|
|
|
|
|
(let ((draft-name (expand-file-name "draft" mh-user-path)))
|
|
|
|
|
(pop-to-buffer "draft") ; Create if necessary
|
|
|
|
|
(if (buffer-modified-p)
|
|
|
|
|
(if (y-or-n-p "Draft has been modified; kill anyway? ")
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(error "Draft preserved")))
|
|
|
|
|
(setq buffer-file-name draft-name)
|
|
|
|
|
(clear-visited-file-modtime)
|
|
|
|
|
(unlock-buffer)
|
|
|
|
|
(cond ((and (file-exists-p draft-name)
|
|
|
|
|
(not (equal draft-name initial-contents)))
|
|
|
|
|
(insert-file-contents draft-name)
|
|
|
|
|
(delete-file draft-name))))))
|
|
|
|
|
(cond ((and initial-contents
|
|
|
|
|
(or (zerop (buffer-size))
|
1995-11-03 02:28:52 +00:00
|
|
|
|
(if (y-or-n-p
|
|
|
|
|
(format "A draft exists. Use for %s? " use))
|
|
|
|
|
(if mh-error-if-no-draft
|
|
|
|
|
(error "A prior draft exists."))
|
|
|
|
|
t)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert-file-contents initial-contents)
|
|
|
|
|
(if delete-contents-file (delete-file initial-contents))))
|
|
|
|
|
(auto-save-mode 1)
|
|
|
|
|
(if mh-draft-folder
|
|
|
|
|
(save-buffer)) ; Do not reuse draft name
|
|
|
|
|
(buffer-name))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-new-draft-name ()
|
|
|
|
|
;; Returns the pathname of folder for draft messages.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(mh-exec-cmd-quiet t "mhpath" mh-draft-folder "new")
|
|
|
|
|
(buffer-substring (point-min) (1- (point-max)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-annotate-msg (msg buffer note &rest args)
|
|
|
|
|
;; Mark the MESSAGE in BUFFER listing with the character NOTE and annotate
|
|
|
|
|
;; the saved message with ARGS.
|
|
|
|
|
(apply 'mh-exec-cmd "anno" buffer msg args)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(cond ((get-buffer buffer) ; Buffer may be deleted
|
|
|
|
|
(set-buffer buffer)
|
|
|
|
|
(if (symbolp msg)
|
|
|
|
|
(mh-notate-seq msg note (1+ mh-cmd-note))
|
|
|
|
|
(mh-notate msg note (1+ mh-cmd-note)))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-insert-fields (&rest name-values)
|
|
|
|
|
;; Insert the NAME-VALUE pairs in the current buffer.
|
|
|
|
|
;; If field NAME exists, append VALUE to it.
|
|
|
|
|
;; Do not insert any pairs whose value is the empty string.
|
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(while name-values
|
|
|
|
|
(let ((field-name (car name-values))
|
|
|
|
|
(value (car (cdr name-values))))
|
|
|
|
|
(cond ((equal value "")
|
|
|
|
|
nil)
|
|
|
|
|
((mh-position-on-field field-name)
|
|
|
|
|
(insert " " value))
|
|
|
|
|
(t
|
|
|
|
|
(insert field-name " " value "\n")))
|
|
|
|
|
(setq name-values (cdr (cdr name-values)))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-position-on-field (field &optional ignore)
|
|
|
|
|
;; Move to the end of the FIELD in the header.
|
|
|
|
|
;; 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.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(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
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
(defun mh-goto-header-end (arg)
|
|
|
|
|
;; Find the end of the message header in the current buffer and position
|
|
|
|
|
;; the cursor at the ARG'th newline after the header.
|
1995-04-20 23:35:49 +00:00
|
|
|
|
(if (re-search-forward "^-*$" nil nil)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(forward-line arg)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-read-address (prompt)
|
|
|
|
|
;; Read a To: or Cc: address, prompting in the minibuffer with PROMPT.
|
|
|
|
|
;; May someday do completion on aliases.
|
|
|
|
|
(read-string prompt))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Mode for composing and sending a draft message.
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-sent-from-folder nil) ;Folder of msg assoc with this letter.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-sent-from-msg nil) ;Number of msg assoc with this letter.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-send-args nil) ;Extra args to pass to "send" command.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-annotate-char nil) ;Character to use to annotate mh-sent-from-msg.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defvar mh-annotate-field nil) ;Field name for message annotation.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
(put 'mh-letter-mode 'mode-class 'special)
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2000-06-05 07:15:58 +00:00
|
|
|
|
(define-derived-mode mh-letter-mode text-mode "MH-Letter"
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"Mode for composing letters in mh-e.\\<mh-letter-mode-map>
|
1995-04-09 22:31:08 +00:00
|
|
|
|
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.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
\\{mh-letter-mode-map}
|
|
|
|
|
|
|
|
|
|
Variables controlling this mode (defaults in parentheses):
|
|
|
|
|
|
|
|
|
|
mh-delete-yanked-msg-window (nil)
|
|
|
|
|
If non-nil, \\[mh-yank-cur-msg] will delete any windows displaying
|
|
|
|
|
the yanked message.
|
|
|
|
|
|
|
|
|
|
mh-yank-from-start-of-msg (t)
|
|
|
|
|
If non-nil, \\[mh-yank-cur-msg] will include the entire message.
|
|
|
|
|
If `body', just yank the body (no header).
|
|
|
|
|
If nil, only the portion of the message following the point will be yanked.
|
|
|
|
|
If there is a region, this variable is ignored.
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
mh-ins-buf-prefix (\"> \")
|
|
|
|
|
String to insert before each non-blank line of a message as it is
|
|
|
|
|
inserted in a draft letter.
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
mh-signature-file-name (\"~/.signature\")
|
|
|
|
|
File to be inserted into message by \\[mh-insert-signature].
|
|
|
|
|
|
1997-09-15 19:45:16 +00:00
|
|
|
|
This command runs the normal hooks `text-mode-hook' and `mh-letter-mode-hook'."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(or mh-user-path (mh-find-path))
|
|
|
|
|
(make-local-variable 'paragraph-start)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(setq paragraph-start (concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-start))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(make-local-variable 'paragraph-separate)
|
|
|
|
|
(setq paragraph-separate
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-separate))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(make-local-variable 'mh-send-args)
|
|
|
|
|
(make-local-variable 'mh-annotate-char)
|
|
|
|
|
(make-local-variable 'mh-annotate-field)
|
|
|
|
|
(make-local-variable 'mh-previous-window-config)
|
|
|
|
|
(make-local-variable 'mh-sent-from-folder)
|
|
|
|
|
(make-local-variable 'mh-sent-from-msg)
|
|
|
|
|
(make-local-variable 'mail-header-separator)
|
|
|
|
|
(setq mail-header-separator "--------") ;for Hyperbole
|
|
|
|
|
;; if text-mode-hook turned on auto-fill, tune it for messages
|
2000-06-05 07:15:58 +00:00
|
|
|
|
(when auto-fill-function
|
|
|
|
|
(make-local-variable 'auto-fill-function)
|
|
|
|
|
(setq auto-fill-function 'mh-auto-fill-for-letter)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-auto-fill-for-letter ()
|
|
|
|
|
;; Auto-fill in letters treats the header specially by inserting a tab
|
|
|
|
|
;; before continuation line.
|
|
|
|
|
(if (mh-in-header-p)
|
1995-04-20 23:35:49 +00:00
|
|
|
|
(let ((fill-prefix "\t"))
|
|
|
|
|
(do-auto-fill))
|
|
|
|
|
(do-auto-fill)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-in-header-p ()
|
|
|
|
|
;; Return non-nil if the point is in the header of a draft message.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((cur-point (point)))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward "^-*$" nil t)
|
|
|
|
|
(< cur-point (point)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(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
|
1997-09-15 19:45:16 +00:00
|
|
|
|
of the command) according to the list in the variable `mh-to-field-choices'.
|
1994-03-15 06:16:30 +00:00
|
|
|
|
Create the field if it does not exist. Set the mark to point before moving."
|
|
|
|
|
(interactive)
|
|
|
|
|
(expand-abbrev)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(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))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(case-fold-search t))
|
|
|
|
|
(push-mark)
|
|
|
|
|
(cond ((mh-position-on-field target)
|
|
|
|
|
(let ((eol (point)))
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(delete-region (point) eol))
|
|
|
|
|
(if (and (not (eq (logior last-input-char ?`) ?s))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(backward-char 1)
|
|
|
|
|
(not (looking-at "[:,]"))))
|
|
|
|
|
(insert ", ")
|
|
|
|
|
(insert " ")))
|
|
|
|
|
(t
|
|
|
|
|
(if (mh-position-on-field "To:")
|
|
|
|
|
(forward-line 1))
|
|
|
|
|
(insert (format "%s \n" target))
|
|
|
|
|
(backward-char 1)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-to-fcc (&optional folder)
|
|
|
|
|
"Insert an Fcc: FOLDER field in the current message.
|
|
|
|
|
Prompt for the field name with a completion list of the current folders."
|
|
|
|
|
(interactive)
|
|
|
|
|
(or folder
|
|
|
|
|
(setq folder (mh-prompt-for-folder
|
|
|
|
|
"Fcc"
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(or (and mh-default-folder-for-message-function
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(funcall mh-default-folder-for-message-function)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
"")
|
|
|
|
|
t)))
|
|
|
|
|
(let ((last-input-char ?\C-f))
|
|
|
|
|
(expand-abbrev)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(mh-to-field)
|
|
|
|
|
(insert (if (mh-folder-name-p folder)
|
|
|
|
|
(substring folder 1)
|
|
|
|
|
folder)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-insert-signature ()
|
1997-09-15 19:45:16 +00:00
|
|
|
|
"Insert the file named by `mh-signature-file-name' at point."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(insert-file-contents mh-signature-file-name)
|
1995-04-25 22:28:25 +00:00
|
|
|
|
(force-mode-line-update))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-check-whom ()
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"Verify recipients of the current letter, showing expansion of any aliases."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(let ((file-name buffer-file-name))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(save-buffer)
|
|
|
|
|
(message "Checking recipients...")
|
|
|
|
|
(mh-in-show-buffer ("*Recipients*")
|
|
|
|
|
(bury-buffer (current-buffer))
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(mh-exec-cmd-output "whom" t file-name))
|
|
|
|
|
(message "Checking recipients...done")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Routines to compose and send a letter.
|
|
|
|
|
|
|
|
|
|
(defun mh-compose-and-send-mail (draft send-args
|
|
|
|
|
sent-from-folder sent-from-msg
|
|
|
|
|
to subject cc
|
|
|
|
|
annotate-char annotate-field
|
|
|
|
|
config)
|
|
|
|
|
;; Edit and compose a draft message in buffer DRAFT and send or save it.
|
|
|
|
|
;; SENT-FROM-FOLDER is buffer containing scan listing of current folder, or
|
|
|
|
|
;; nil if none exists.
|
|
|
|
|
;; SENT-FROM-MSG is the message number or sequence name or nil.
|
|
|
|
|
;; SEND-ARGS is an optional argument passed to the send command.
|
|
|
|
|
;; The TO, SUBJECT, and CC fields are passed to the
|
|
|
|
|
;; mh-compose-letter-function.
|
|
|
|
|
;; If ANNOTATE-CHAR is non-null, it is used to notate the scan listing of the
|
|
|
|
|
;; message. In that case, the ANNOTATE-FIELD is used to build a string
|
|
|
|
|
;; for mh-annotate-msg.
|
|
|
|
|
;; CONFIG is the window configuration to restore after sending the letter.
|
|
|
|
|
(pop-to-buffer draft)
|
|
|
|
|
(mh-letter-mode)
|
|
|
|
|
(setq mh-sent-from-folder sent-from-folder)
|
|
|
|
|
(setq mh-sent-from-msg sent-from-msg)
|
|
|
|
|
(setq mh-send-args send-args)
|
|
|
|
|
(setq mh-annotate-char annotate-char)
|
|
|
|
|
(setq mh-annotate-field annotate-field)
|
|
|
|
|
(setq mh-previous-window-config config)
|
|
|
|
|
(setq mode-line-buffer-identification (list "{%b}"))
|
|
|
|
|
(if (and (boundp 'mh-compose-letter-function)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
mh-compose-letter-function)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;; run-hooks will not pass arguments.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(let ((value mh-compose-letter-function))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(if (and (listp value) (not (eq (car value) 'lambda)))
|
|
|
|
|
(while value
|
|
|
|
|
(funcall (car value) to subject cc)
|
|
|
|
|
(setq value (cdr value)))
|
|
|
|
|
(funcall mh-compose-letter-function to subject cc)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-send-letter (&optional arg)
|
|
|
|
|
"Send the draft letter in the current buffer.
|
|
|
|
|
If optional prefix argument is provided, monitor delivery.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
Run `mh-before-send-letter-hook' before actually doing anything."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(run-hooks 'mh-before-send-letter-hook)
|
|
|
|
|
(save-buffer)
|
|
|
|
|
(message "Sending...")
|
|
|
|
|
(let ((draft-buffer (current-buffer))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(file-name buffer-file-name)
|
1997-09-15 19:45:16 +00:00
|
|
|
|
(config mh-previous-window-config)
|
|
|
|
|
(coding-system-for-write
|
1997-09-19 04:27:56 +00:00
|
|
|
|
(if (and (local-variable-p 'buffer-file-coding-system)
|
|
|
|
|
;; We're not sure why, but buffer-file-coding-system
|
|
|
|
|
;; tends to get set to undecided-unix.
|
|
|
|
|
(not (memq buffer-file-coding-system
|
|
|
|
|
'(undecided undecided-unix undecided-dos))))
|
1997-09-15 19:45:16 +00:00
|
|
|
|
buffer-file-coding-system
|
|
|
|
|
(or sendmail-coding-system
|
|
|
|
|
default-buffer-file-coding-system
|
|
|
|
|
'iso-latin-1))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(cond (arg
|
|
|
|
|
(pop-to-buffer "MH mail delivery")
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(mh-exec-cmd-output mh-send-prog t "-watch" "-nopush"
|
|
|
|
|
"-nodraftfolder" mh-send-args file-name)
|
|
|
|
|
(goto-char (point-max)) ; show the interesting part
|
|
|
|
|
(recenter -1)
|
|
|
|
|
(set-buffer draft-buffer)) ; for annotation below
|
|
|
|
|
(t
|
|
|
|
|
(mh-exec-cmd-daemon mh-send-prog "-nodraftfolder" "-noverbose"
|
|
|
|
|
mh-send-args file-name)))
|
|
|
|
|
(if mh-annotate-char
|
|
|
|
|
(mh-annotate-msg mh-sent-from-msg
|
|
|
|
|
mh-sent-from-folder
|
|
|
|
|
mh-annotate-char
|
|
|
|
|
"-component" mh-annotate-field
|
|
|
|
|
"-text" (format "\"%s %s\""
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(mh-get-header-field "To:")
|
|
|
|
|
(mh-get-header-field "Cc:"))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
(cond ((or (not arg)
|
|
|
|
|
(y-or-n-p "Kill draft buffer? "))
|
|
|
|
|
(kill-buffer draft-buffer)
|
|
|
|
|
(if config
|
|
|
|
|
(set-window-configuration config))))
|
|
|
|
|
(if arg
|
|
|
|
|
(message "Sending...done")
|
|
|
|
|
(message "Sending...backgrounded"))))
|
|
|
|
|
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(defun mh-insert-letter (folder message verbatim)
|
|
|
|
|
"Insert a message into the current letter.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
Removes the message's headers using `mh-invisible-headers'. Prefixes
|
|
|
|
|
each non-blank line with `mh-ins-buf-prefix'. Prompts for FOLDER and
|
1995-04-09 22:31:08 +00:00
|
|
|
|
MESSAGE. If prefix argument VERBATIM provided, do not indent and do
|
|
|
|
|
not delete headers. Leaves the mark before the letter and point after it."
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(interactive
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
|
|
|
|
|
(read-input (format "Message number%s: "
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(if mh-sent-from-msg
|
|
|
|
|
(format " [%d]" mh-sent-from-msg)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"")))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
current-prefix-arg))
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (point) (point))
|
|
|
|
|
(let ((start (point-min)))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(if (equal message "") (setq message (int-to-string mh-sent-from-msg)))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(expand-file-name message
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(mh-expand-file-name folder)))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(cond ((not verbatim)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(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))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-yank-cur-msg ()
|
|
|
|
|
"Insert the current message into the draft buffer.
|
|
|
|
|
Prefix each non-blank line in the message with the string in
|
|
|
|
|
`mh-ins-buf-prefix'. If a region is set in the message's buffer, then
|
|
|
|
|
only the region will be inserted. Otherwise, the entire message will
|
|
|
|
|
be inserted if `mh-yank-from-start-of-msg' is non-nil. If this variable
|
|
|
|
|
is nil, the portion of the message following the point will be yanked.
|
|
|
|
|
If `mh-delete-yanked-msg-window' is non-nil, any window displaying the
|
|
|
|
|
yanked message will be deleted."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (and mh-sent-from-folder mh-sent-from-msg)
|
|
|
|
|
(let ((to-point (point))
|
|
|
|
|
(to-buffer (current-buffer)))
|
|
|
|
|
(set-buffer mh-sent-from-folder)
|
|
|
|
|
(if mh-delete-yanked-msg-window
|
|
|
|
|
(delete-windows-on mh-show-buffer))
|
|
|
|
|
(set-buffer mh-show-buffer) ; Find displayed message
|
|
|
|
|
(let ((mh-ins-str (cond ((if (boundp 'mark-active)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
mark-active ;Emacs 19
|
|
|
|
|
(mark)) ;Emacs 18
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(buffer-substring (region-beginning)
|
|
|
|
|
(region-end)))
|
|
|
|
|
((eq 'body mh-yank-from-start-of-msg)
|
|
|
|
|
(buffer-substring
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(mh-goto-header-end 1)
|
|
|
|
|
(point))
|
|
|
|
|
(point-max)))
|
|
|
|
|
(mh-yank-from-start-of-msg
|
|
|
|
|
(buffer-substring (point-min) (point-max)))
|
|
|
|
|
(t
|
|
|
|
|
(buffer-substring (point) (point-max))))))
|
|
|
|
|
(set-buffer to-buffer)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(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")))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-insert-prefix-string (mh-ins-string)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
;; Run mail-citation-hook to insert a prefix string before each line
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;; in the buffer. Generality for supercite users.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(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))
|
2000-08-16 21:03:36 +00:00
|
|
|
|
(while (< (point) (mark))
|
|
|
|
|
(insert mh-ins-string)
|
|
|
|
|
(forward-line 1)))))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun mh-fully-kill-draft ()
|
|
|
|
|
"Kill the draft message file and the draft message buffer.
|
|
|
|
|
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))
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(if (file-exists-p buffer-file-name)
|
|
|
|
|
(delete-file buffer-file-name))
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(kill-buffer (buffer-name))
|
|
|
|
|
(message "")
|
|
|
|
|
(if config
|
|
|
|
|
(set-window-configuration config)))
|
|
|
|
|
(error "Message not killed")))
|
|
|
|
|
|
1995-04-09 22:31:08 +00:00
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
;;; 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)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-f\C-d" 'mh-to-field)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-f\C-f" 'mh-to-fcc)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-f\C-r" 'mh-to-field)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(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)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-fd" 'mh-to-field)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-ff" 'mh-to-fcc)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-fr" 'mh-to-field)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(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)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-i" 'mh-insert-letter)
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-q" 'mh-fully-kill-draft)
|
1995-04-09 22:31:08 +00:00
|
|
|
|
(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
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-w" 'mh-check-whom)
|
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-y" 'mh-yank-cur-msg)
|
|
|
|
|
(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)
|
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-m\C-t" 'mh-mhn-compose-external-compressed-tar)
|
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-m\C-i" 'mh-mhn-compose-insertion)
|
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-e" 'mh-edit-mhn)
|
|
|
|
|
(define-key mh-letter-mode-map "\C-c\C-m\C-u" 'mh-revert-mhn-edit)
|
|
|
|
|
|
1995-11-03 02:28:52 +00:00
|
|
|
|
;; "C-c /" prefix is used in mh-letter-mode by pgp.el
|
1994-03-15 06:16:30 +00:00
|
|
|
|
|
|
|
|
|
;;; autoloads from mh-mime
|
|
|
|
|
|
|
|
|
|
(autoload 'mh-mhn-compose-insertion "mh-mime"
|
1995-04-20 23:35:49 +00:00
|
|
|
|
"Add a directive to insert a MIME message part from a file.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
This is the typical way to insert non-text parts in a message.
|
|
|
|
|
See also \\[mh-edit-mhn]." t)
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(autoload 'mh-mhn-compose-anon-ftp "mh-mime"
|
1995-04-20 23:35:49 +00:00
|
|
|
|
"Add a directive for a MIME anonymous ftp external body part.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
This directive tells MH to include a reference to a
|
|
|
|
|
message/external-body part retrievable by anonymous FTP.
|
|
|
|
|
See also \\[mh-edit-mhn]." t)
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(autoload 'mh-mhn-compose-external-compressed-tar "mh-mime"
|
1995-04-20 23:35:49 +00:00
|
|
|
|
"Add a directive to include a MIME reference to a compressed tar file.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
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)
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(autoload 'mh-mhn-compose-forw "mh-mime"
|
1995-04-20 23:35:49 +00:00
|
|
|
|
"Add a forw directive to this message, to forward a message with MIME.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
This directive tells MH to include another message in this one.
|
|
|
|
|
See also \\[mh-edit-mhn]." t)
|
|
|
|
|
|
1994-03-15 06:16:30 +00:00
|
|
|
|
(autoload 'mh-edit-mhn "mh-mime"
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"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
|
1994-03-15 06:16:30 +00:00
|
|
|
|
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.
|
1997-09-15 19:45:16 +00:00
|
|
|
|
The \\[mh-revert-mhn-edit] command undoes this command.
|
1995-04-09 22:31:08 +00:00
|
|
|
|
For assistance with creating mhn directives to insert
|
1994-03-15 06:16:30 +00:00
|
|
|
|
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),
|
|
|
|
|
\\[mh-mhn-compose-external-compressed-tar] \
|
|
|
|
|
\(reference to compressed tar file via anonymous ftp), and
|
|
|
|
|
\\[mh-mhn-compose-forw] (forward message)." t)
|
|
|
|
|
|
|
|
|
|
(autoload 'mh-revert-mhn-edit "mh-mime"
|
1995-04-09 22:31:08 +00:00
|
|
|
|
"Undoes the effect of \\[mh-edit-mhn] by reverting to the backup file.
|
|
|
|
|
Optional non-nil argument means don't ask for confirmation." t)
|