annotate lisp/mail/mh-comp.el @ 11779:6234b3610a6f

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