annotate lisp/mail/mh-comp.el @ 49288:7f09b406bc3c

Require fontset unconditionally again. Call setup-default-fontset at the top level.
author Kenichi Handa <handa@m17n.org>
date Fri, 17 Jan 2003 08:14:14 +0000
parents 30c4902b654d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1 ;;; mh-comp.el --- MH-E functions for composing messages
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
3 ;; Copyright (C) 1993,1995,1997,2000,2001,2002 Free Software Foundation, Inc.
30887
c4366892a814 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29420
diff changeset
4
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
5 ;; Author: Bill Wohler <wohler@newt.com>
33145
e2d1dc22d119 Change maintainer.
Gerd Moellmann <gerd@gnu.org>
parents: 30887
diff changeset
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
30887
c4366892a814 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29420
diff changeset
7 ;; Keywords: mail
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
8 ;; See: mh-e.el
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35975
diff changeset
10 ;; This file is part of GNU Emacs.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11332
diff changeset
12 ;; 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
13 ;; 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
14 ;; the Free Software Foundation; either version 2, or (at your option)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11332
diff changeset
17 ;; 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
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
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 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13385
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13385
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13385
diff changeset
25 ;; Boston, MA 02111-1307, USA.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
29 ;; Internal support for MH-E package.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
31 ;;; Change Log:
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
32
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
33 ;; $Id: mh-comp.el,v 1.164 2003/01/07 21:16:25 satyaki Exp $
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
34
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;;; Code:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
37 (require 'mh-e)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
38 (require 'gnus-util)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
39 (require 'easymenu)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
40 (require 'cl)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
41
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
42 ;; Shush the byte-compiler
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
43 (defvar adaptive-fill-first-line-regexp)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
44 (defvar font-lock-defaults)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
45 (defvar mark-active)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
46 (defvar sendmail-coding-system)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
47 (defvar mh-identity-list)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
48 (defvar mh-identity-default)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
49 (defvar mh-identity-menu)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
50
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
51 ;;; Autoloads
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
52 (autoload 'Info-goto-node "info")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
53 (autoload 'mail-mode-fill-paragraph "sendmail")
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
54 (autoload 'mm-handle-displayed-p "mm-decode")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
55
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
56 (autoload 'sc-cite-original "sc"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
57 "Workhorse citing function which performs the initial citation.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
58 This is callable from the various mail and news readers' reply
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
59 function according to the agreed upon standard. See `\\[sc-describe]'
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
60 for more details. `sc-cite-original' does not do any yanking of the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
61 original message but it does require a few things:
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
62
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
63 1) The reply buffer is the current buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
64
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
65 2) The original message has been yanked and inserted into the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
66 reply buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
67
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
68 3) Verbose mail headers from the original message have been
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
69 inserted into the reply buffer directly before the text of the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
70 original message.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
71
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
72 4) Point is at the beginning of the verbose headers.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
73
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
74 5) Mark is at the end of the body of text to be cited.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
75
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
76 For Emacs 19's, the region need not be active (and typically isn't
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
77 when this function is called. Also, the hook `sc-pre-hook' is run
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
78 before, and `sc-post-hook' is run after the guts of this function.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
80 ;;; Site customization (see also mh-utils.el):
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
81
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
82 (defvar mh-send-prog "send"
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
83 "Name of the MH send program.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
84 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
85
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
86 (defvar mh-redist-full-contents nil
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
87 "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
88 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
89 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
90
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
91 (defvar mh-redist-background nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
92 "If non-nil redist will be done in background like send.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
93 This allows transaction log to be visible if -watch, -verbose or -snoop are
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
94 used.")
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
95
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (defvar mh-note-repl "-"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 "String whose first character is used to notate replied to messages.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (defvar mh-note-forw "F"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 "String whose first character is used to notate forwarded messages.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (defvar mh-note-dist "R"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 "String whose first character is used to notate redistributed messages.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (defvar mh-yank-hooks nil
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 "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
107 Each hook function can find the citation between point and mark.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 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
109 text as modified.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 This is a normal hook, misnamed for historical reasons.
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
112 It is semi-obsolete and is only used if `mail-citation-hook' is nil.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (defvar mail-citation-hook nil
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 "*Hook for modifying a citation just inserted in the mail buffer.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 Each hook function can find the citation between point and mark.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 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
118 text as modified.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 If this hook is entirely empty (nil), the text of the message is inserted
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
121 with `mh-ins-buf-prefix' prefixed to each line.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
123 See also the variable `mh-yank-from-start-of-msg', which controls how
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
124 much of the message passed to the hook.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
125
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
126 This hook was historically provided to set up supercite. You may now leave
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
127 this nil and set up supercite by setting the variable
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
128 `mh-yank-from-start-of-msg' to 'supercite or, for more automatic insertion,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
129 to 'autosupercite.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (defvar mh-comp-formfile "components"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 "Name of file to be used as a skeleton for composing messages.
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
133 Default is \"components\". If not an absolute file name, the file
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 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
135 system MH lib directory.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
137 (defvar mh-repl-formfile "replcomps"
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
138 "Name of file to be used as a skeleton for replying to messages.
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
139 Default is \"replcomps\". If not an absolute file name, the file
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
140 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
141 system MH lib directory.")
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
142
24421
d072093cd922 (mh-repl-formfile): New var.
Karl Heuer <kwzh@gnu.org>
parents: 22590
diff changeset
143 (defvar mh-repl-group-formfile "replgroupcomps"
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
144 "Name of file to be used as a skeleton for replying to messages.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
145 This file is used to form replies to the sender and all recipients of a
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
146 message. Only used if `mh-nmh-flag' is non-nil. Default is \"replgroupcomps\".
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
147 If not an absolute file name, the file is searched for first in the user's MH
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
148 directory, then in the system MH lib directory.")
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
149
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (defvar mh-rejected-letter-start
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
151 (format "^%s$"
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
152 (regexp-opt
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
153 '("Content-Type: message/rfc822" ;MIME MDN
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
154 " ----- Unsent message follows -----" ;from sendmail V5
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
155 " --------Unsent Message below:" ; from sendmail at BU
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
156 " ----- Original message follows -----" ;from sendmail V8
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
157 "------- Unsent Draft" ;from MH itself
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
158 "---------- Original Message ----------" ;from zmailer
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
159 " --- The unsent message follows ---" ;from AIX mail system
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
160 " Your message follows:" ;from MMDF-II
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
161 "Content-Description: Returned Content" ;1993 KJ sendmail
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
162 ))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (defvar mh-new-draft-cleaned-headers
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
165 "^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
166 "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
167 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
168
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
169 (defvar mh-to-field-choices '(("t" . "To:") ("s" . "Subject:") ("c" . "Cc:")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
170 ("b" . "Bcc:") ("f" . "Fcc:") ("r" . "From:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
171 ("d" . "Dcc:"))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
172 "Alist of (final-character . field-name) choices for `mh-to-field'.")
6365
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 (defvar mh-letter-mode-map (copy-keymap text-mode-map)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 "Keymap for composing mail.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 (defvar mh-letter-mode-syntax-table nil
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
178 "Syntax table used by MH-E while in MH-Letter mode.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (if mh-letter-mode-syntax-table
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ()
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
182 (setq mh-letter-mode-syntax-table
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
183 (make-syntax-table text-mode-syntax-table))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
184 (modify-syntax-entry ?% "." mh-letter-mode-syntax-table))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
186 (defvar mh-sent-from-folder nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
187 "Folder of msg assoc with this letter.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
188
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
189 (defvar mh-sent-from-msg nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
190 "Number of msg assoc with this letter.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
191
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
192 (defvar mh-send-args nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
193 "Extra args to pass to \"send\" command.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
194
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
195 (defvar mh-annotate-char nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
196 "Character to use to annotate `mh-sent-from-msg'.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
197
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
198 (defvar mh-annotate-field nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
199 "Field name for message annotation.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 ;;;###autoload
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 (defun mh-smail ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 "Compose and send mail with the MH mail system.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
204 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
205 to the MH mail system.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
206
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
207 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
208 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 (mh-find-path)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 (call-interactively 'mh-send))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
212 (defvar mh-error-if-no-draft nil) ;raise error over using old draft
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
213
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
214 ;;;###autoload
24421
d072093cd922 (mh-repl-formfile): New var.
Karl Heuer <kwzh@gnu.org>
parents: 22590
diff changeset
215 (defun mh-smail-batch (&optional to subject other-headers &rest ignored)
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
216 "Set up a mail composition draft with the MH mail system.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
217 This function is an entry point to MH-E, the Emacs front end
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
218 to the MH mail system. This function does not prompt the user
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
219 for any header fields, and thus is suitable for use by programs
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
220 that want to create a mail buffer.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
221 Users should use `\\[mh-smail]' to compose mail.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
222 Optional arguments for setting certain fields include TO, SUBJECT, and
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
223 OTHER-HEADERS. Additional arguments are IGNORED."
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
224 (mh-find-path)
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
225 (let ((mh-error-if-no-draft t))
26393
d11cb5096a6c (mh-smail-batch): If TO is nil, use "" as
Gerd Moellmann <gerd@gnu.org>
parents: 25535
diff changeset
226 (mh-send (or to "") "" (or subject ""))))
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
227
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
228 ;; XEmacs needs this:
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
229 ;;;###autoload
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
230 (defun mh-user-agent-compose (&optional to subject other-headers continue
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
231 switch-function yank-action
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
232 send-actions)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
233 "Set up mail composition draft with the MH mail system.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
234 This is `mail-user-agent' entry point to MH-E.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
235
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
236 The optional arguments TO and SUBJECT specify recipients and the
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
237 initial Subject field, respectively.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
238
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
239 OTHER-HEADERS is an alist specifying additional
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
240 header fields. Elements look like (HEADER . VALUE) where both
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
241 HEADER and VALUE are strings.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
242
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
243 CONTINUE, SWITCH-FUNCTION, YANK-ACTION and SEND-ACTIONS are ignored."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
244 (mh-find-path)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
245 (let ((mh-error-if-no-draft t))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
246 (mh-send to "" subject)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
247 (while other-headers
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
248 (mh-insert-fields (concat (car (car other-headers)) ":")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
249 (cdr (car other-headers)))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
250 (setq other-headers (cdr other-headers)))))
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
251
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
252 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 (defun mh-edit-again (msg)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
254 "Clean up a draft or a message MSG previously sent and make it resendable.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
255 Default is the current message.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
256 The variable `mh-new-draft-cleaned-headers' specifies the headers to remove.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 See also documentation for `\\[mh-send]' function."
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (interactive (list (mh-get-msg-num t)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 (let* ((from-folder mh-current-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
260 (config (current-window-configuration))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
261 (draft
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
262 (cond ((and mh-draft-folder (equal from-folder mh-draft-folder))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
263 (pop-to-buffer (find-file-noselect (mh-msg-filename msg)) t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
264 (rename-buffer (format "draft-%d" msg))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
265 ;; Make buffer writable...
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
266 (setq buffer-read-only nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
267 ;; If buffer was being used to display the message reinsert
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
268 ;; from file...
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
269 (when (eq major-mode 'mh-show-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
270 (erase-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
271 (insert-file-contents buffer-file-name))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
272 (buffer-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
273 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
274 (mh-read-draft "clean-up" (mh-msg-filename msg) nil)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
276 (mh-insert-header-separator)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 (goto-char (point-min))
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
278 (save-buffer)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (mh-compose-and-send-mail draft "" from-folder nil nil nil nil nil nil
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
280 config)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
281 (mh-letter-mode-message)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
283 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (defun mh-extract-rejected-mail (msg)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
285 "Extract message MSG returned by the mail system and make it resendable.
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
286 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
287 gives the headers to clean out of the original message.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 See also documentation for `\\[mh-send]' function."
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (interactive (list (mh-get-msg-num t)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (let ((from-folder mh-current-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
291 (config (current-window-configuration))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
292 (draft (mh-read-draft "extraction" (mh-msg-filename msg) nil)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (goto-char (point-min))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (cond ((re-search-forward mh-rejected-letter-start nil t)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
295 (skip-chars-forward " \t\n")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
296 (delete-region (point-min) (point))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
297 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
298 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
299 (message "Does not appear to be a rejected letter.")))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
300 (mh-insert-header-separator)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (goto-char (point-min))
13385
c0249fda1691 reporter.el support.
Karl Heuer <kwzh@gnu.org>
parents: 11578
diff changeset
302 (save-buffer)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
303 (mh-compose-and-send-mail draft "" from-folder msg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
304 (mh-get-header-field "To:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
305 (mh-get-header-field "From:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
306 (mh-get-header-field "Cc:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
307 nil nil config)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
308 (mh-letter-mode-message)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
310 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (defun mh-forward (to cc &optional msg-or-seq)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
312 "Forward one or more messages to the recipients TO and CC.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
313
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
314 Use the optional MSG-OR-SEQ to specify a message or sequence to forward.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
315
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
316 Default is the displayed message. If optional prefix argument is given then
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
317 prompt for the message sequence. If variable `transient-mark-mode' is non-nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
318 and the mark is active, then the selected region is forwarded.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
319 See also documentation for `\\[mh-send]' function."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 (interactive (list (mh-read-address "To: ")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
321 (mh-read-address "Cc: ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
322 (cond
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
323 ((mh-mark-active-p t)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
324 (mh-region-to-msg-list (region-beginning) (region-end)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
325 (current-prefix-arg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
326 (mh-read-seq-default "Forward" t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
327 (t
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
328 (mh-get-msg-num t)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 (let* ((folder mh-current-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
330 (msgs (cond ((numberp msg-or-seq) (list msg-or-seq))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
331 ((listp msg-or-seq) msg-or-seq)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
332 (t (mh-seq-to-msgs msg-or-seq))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
333 (config (current-window-configuration))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
334 (fwd-msg-file (mh-msg-filename (car msgs) folder))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
335 ;; forw always leaves file in "draft" since it doesn't have -draft
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
336 (draft-name (expand-file-name "draft" mh-user-path))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
337 (draft (cond ((or (not (file-exists-p draft-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
338 (y-or-n-p "The file 'draft' exists. Discard it? "))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
339 (mh-exec-cmd "forw" "-build" (if mh-nmh-flag "-mime")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
340 mh-current-folder msgs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
341 (prog1
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
342 (mh-read-draft "" draft-name t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
343 (mh-insert-fields "To:" to "Cc:" cc)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
344 (save-buffer)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
345 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
346 (mh-read-draft "" draft-name nil)))))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
347 (let (orig-from
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
348 orig-subject)
25535
2fe0f62fa349 (mh-forward): Get new subject line from the original,
Richard M. Stallman <rms@gnu.org>
parents: 24421
diff changeset
349 (save-excursion
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
350 (set-buffer (get-buffer-create mh-temp-buffer))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
351 (erase-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
352 (insert-file-contents fwd-msg-file)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
353 (setq orig-from (mh-get-header-field "From:"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
354 (setq orig-subject (mh-get-header-field "Subject:")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (let ((forw-subject
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
356 (mh-forwarded-letter-subject orig-from orig-subject))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
357 (compose))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
358 (mh-insert-fields "Subject:" forw-subject)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
359 (goto-char (point-min))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
360 ;; If using MML, translate mhn
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
361 (if (equal mh-compose-insertion 'gnus)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
362 (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
363 (setq compose t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
364 (re-search-forward (format "^\\(%s\\)?$"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
365 mh-mail-header-separator))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
366 (while
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
367 (re-search-forward
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
368 "^#forw \\[\\([^]]+\\)\\] \\(+\\S-+\\) \\(.*\\)$"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
369 (point-max) t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
370 (let ((description (if (equal (match-string 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
371 "forwarded messages")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
372 "forwarded message %d"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
373 (match-string 1)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
374 (msgs (split-string (match-string 3)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
375 (i 0))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
376 (beginning-of-line)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
377 (delete-region (point) (progn (forward-line 1) (point)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
378 (dolist (msg msgs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
379 (setq i (1+ i))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
380 (mh-mml-forward-message (format description i)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
381 folder msg))))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
382 ;; Postition just before forwarded message
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
383 (if (re-search-forward "^------- Forwarded Message" nil t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
384 (forward-line -1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
385 (re-search-forward (format "^\\(%s\\)?$" mh-mail-header-separator))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
386 (forward-line 1))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
387 (delete-other-windows)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
388 (mh-add-msgs-to-seq msgs 'forwarded t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
389 (mh-compose-and-send-mail draft "" folder msg-or-seq
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
390 to forw-subject cc
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
391 mh-note-forw "Forwarded:"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
392 config)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
393 (if compose
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
394 (setq mh-mml-compose-insert-flag t))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
395 (mh-letter-mode-message)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (defun mh-forwarded-letter-subject (from subject)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
398 "Return a Subject suitable for a forwarded message.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
399 Original message has headers FROM and SUBJECT."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (let ((addr-start (string-match "<" from))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
401 (comment (string-match "(" from)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (cond ((and addr-start (> addr-start 0))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
403 ;; Full Name <luser@host>
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
404 (setq from (substring from 0 (1- addr-start))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
405 (comment
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
406 ;; luser@host (Full Name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
407 (setq from (substring from (1+ comment) (1- (length from)))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 (format mh-forward-subject-format from subject))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 ;;;###autoload
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (defun mh-smail-other-window ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 "Compose and send mail in other window with the MH mail system.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
413 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
414 to the MH mail system.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
415
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
416 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
417 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (mh-find-path)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (call-interactively 'mh-send-other-window))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
421 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (defun mh-redistribute (to cc &optional msg)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
423 "Redistribute displayed message to recipients TO and CC.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
424 Use optional argument MSG to redistribute another message.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 Depending on how your copy of MH was compiled, you may need to change the
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
426 setting of the variable `mh-redist-full-contents'. See its documentation."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 (interactive (list (mh-read-address "Redist-To: ")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
428 (mh-read-address "Redist-Cc: ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
429 (mh-get-msg-num t)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 (or msg
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (setq msg (mh-get-msg-num t)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 (save-window-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (let ((folder mh-current-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
434 (draft (mh-read-draft "redistribution"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
435 (if mh-redist-full-contents
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
436 (mh-msg-filename msg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
437 nil)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
438 nil)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (mh-goto-header-end 0)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 (insert "Resent-To: " to "\n")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (if (not (equal cc "")) (insert "Resent-cc: " cc "\n"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 (mh-clean-msg-header (point-min)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
443 "^Message-Id:\\|^Received:\\|^Return-Path:\\|^Sender:\\|^Date:\\|^From:"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
444 nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (save-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (message "Redistributing...")
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
447 (if (not mh-redist-background)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
448 (if mh-redist-full-contents
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
449 (call-process "/bin/sh" nil 0 nil "-c"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
450 (format "mhdist=1 mhaltmsg=%s %s -push %s"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
451 buffer-file-name
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
452 (expand-file-name mh-send-prog mh-progs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
453 buffer-file-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
454 (call-process "/bin/sh" nil 0 nil "-c"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
455 (format
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
456 "mhdist=1 mhaltmsg=%s mhannotate=1 %s -push %s"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
457 (mh-msg-filename msg folder)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
458 (expand-file-name mh-send-prog mh-progs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
459 buffer-file-name))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (mh-annotate-msg msg folder mh-note-dist
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
461 "-component" "Resent:"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
462 "-text" (format "\"%s %s\"" to cc))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
463 (if mh-redist-background
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
464 (mh-exec-cmd-daemon "/bin/sh" "-c"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
465 (format "mhdist=1 mhaltmsg=%s %s %s %s"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
466 (if mh-redist-full-contents
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
467 buffer-file-name
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
468 (mh-msg-filename msg folder))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
469 (if mh-redist-full-contents
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
470 ""
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
471 "mhannotate=1")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
472 (mh-expand-file-name "send" mh-progs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
473 buffer-file-name)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (kill-buffer draft)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (message "Redistributing...done"))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
477 (defun mh-show-buffer-message-number (&optional buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
478 "Message number of displayed message in corresponding show buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
479 Return nil if show buffer not displayed.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
480 If in `mh-letter-mode', don't display the message number being replied to,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
481 but rather the message number of the show buffer associated with our
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
482 originating folder buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
483 Optional argument BUFFER can be used to specify the buffer."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
484 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
485 (if buffer
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
486 (set-buffer buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
487 (cond ((eq major-mode 'mh-show-mode)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
488 (let ((number-start (mh-search-from-end ?/ buffer-file-name)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
489 (car (read-from-string (substring buffer-file-name
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
490 (1+ number-start))))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
491 ((and (eq major-mode 'mh-folder-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
492 mh-show-buffer
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
493 (get-buffer mh-show-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
494 (mh-show-buffer-message-number mh-show-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
495 ((and (eq major-mode 'mh-letter-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
496 mh-sent-from-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
497 (get-buffer mh-sent-from-folder))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
498 (mh-show-buffer-message-number mh-sent-from-folder))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
499 (t
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
500 nil))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
502 ;;;###mh-autoload
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
503 (defun mh-reply (message &optional reply-to includep)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
504 "Reply to MESSAGE (default: current message).
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
505 If the optional argument REPLY-TO is not given, prompts for type of addresses
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
506 to reply to:
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 from sender only,
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 to sender and primary recipients,
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 cc/all sender and all recipients.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
510 If optional prefix argument INCLUDEP provided, then include the message
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
511 in the reply using filter `mhl.reply' in your MH directory.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
512 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
513 for the reply. See also documentation for `\\[mh-send]' function."
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
514 (interactive (list
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
515 (mh-get-msg-num t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
516 (let ((minibuffer-help-form
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
517 "from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
518 (or mh-reply-default-reply-to
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
519 (completing-read "Reply to whom? (from, to, all) [from]: "
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
520 '(("from") ("to") ("cc") ("all"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
521 nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
522 t)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
523 current-prefix-arg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
524 (let* ((folder mh-current-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
525 (show-buffer mh-show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
526 (config (current-window-configuration))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
527 (group-reply (or (equal reply-to "cc") (equal reply-to "all")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
528 (form-file (cond ((and mh-nmh-flag group-reply
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
529 (stringp mh-repl-group-formfile))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
530 mh-repl-group-formfile)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
531 ((stringp mh-repl-formfile) mh-repl-formfile)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
532 (t nil))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
533 (message "Composing a reply...")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
534 (mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
535 (if form-file
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
536 (list "-form" form-file))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
537 mh-current-folder message
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
538 (cond ((or (equal reply-to "from") (equal reply-to ""))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
539 '("-nocc" "all"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
540 ((equal reply-to "to")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
541 '("-cc" "to"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
542 (group-reply (if mh-nmh-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
543 '("-group" "-nocc" "me")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
544 '("-cc" "all" "-nocc" "me"))))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
545 (cond ((or (eq mh-yank-from-start-of-msg 'autosupercite)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
546 (eq mh-yank-from-start-of-msg 'autoattrib))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
547 '("-noformat"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
548 (includep '("-filter" "mhl.reply"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
549 (t '())))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
550 (let ((draft (mh-read-draft "reply"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
551 (expand-file-name "reply" mh-user-path)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
552 t)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
553 (delete-other-windows)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
554 (save-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
555
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
556 (let ((to (mh-get-header-field "To:"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
557 (subject (mh-get-header-field "Subject:"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
558 (cc (mh-get-header-field "Cc:")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
559 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
560 (mh-goto-header-end 1)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
561 (or includep
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
562 (not mh-reply-show-message-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
563 (mh-in-show-buffer (show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
564 (mh-display-msg message folder)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
565 (mh-add-msgs-to-seq message 'answered t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
566 (message "Composing a reply...done")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
567 (mh-compose-and-send-mail draft "" folder message to subject cc
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
568 mh-note-repl "Replied:" config))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
569 (when (and (or (eq 'autosupercite mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
570 (eq 'autoattrib mh-yank-from-start-of-msg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
571 (eq (mh-show-buffer-message-number) mh-sent-from-msg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
572 (undo-boundary)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
573 (mh-yank-cur-msg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
574 (mh-letter-mode-message))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
576 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (defun mh-send (to cc subject)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 "Compose and send a letter.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
579
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
580 Do not call this function from outside MH-E; use \\[mh-smail] instead.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
581
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
582 The file named by `mh-comp-formfile' will be used as the form.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
583 The letter is composed in `mh-letter-mode'; see its documentation for more
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
584 details.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
585 If `mh-compose-letter-function' is defined, it is called on the draft and
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
586 passed three arguments: TO, CC, and SUBJECT."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 (interactive (list
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
588 (mh-read-address "To: ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
589 (mh-read-address "Cc: ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
590 (read-string "Subject: ")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 (let ((config (current-window-configuration)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 (delete-other-windows)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 (mh-send-sub to cc subject config)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
595 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 (defun mh-send-other-window (to cc subject)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 "Compose and send a letter in another window.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
598
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
599 Do not call this function from outside MH-E; use \\[mh-smail-other-window]
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
600 instead.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
601
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
602 The file named by `mh-comp-formfile' will be used as the form.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
603 The letter is composed in `mh-letter-mode'; see its documentation for more
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
604 details.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
605 If `mh-compose-letter-function' is defined, it is called on the draft and
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
606 passed three arguments: TO, CC, and SUBJECT."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 (interactive (list
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
608 (mh-read-address "To: ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
609 (mh-read-address "Cc: ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
610 (read-string "Subject: ")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 (let ((pop-up-windows t))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 (mh-send-sub to cc subject (current-window-configuration))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 (defun mh-send-sub (to cc subject config)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
615 "Do the real work of composing and sending a letter.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
616 Expects the TO, CC, and SUBJECT fields as arguments.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
617 CONFIG is the window configuration before sending mail."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 (let ((folder mh-current-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
619 (msg-num (mh-get-msg-num nil)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 (message "Composing a message...")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 (let ((draft (mh-read-draft
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
622 "message"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
623 (let (components)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
624 (cond
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
625 ((file-exists-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
626 (setq components
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
627 (expand-file-name mh-comp-formfile mh-user-path)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
628 components)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
629 ((file-exists-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
630 (setq components
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
631 (expand-file-name mh-comp-formfile mh-lib)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
632 components)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
633 ((file-exists-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
634 (setq components
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
635 (expand-file-name mh-comp-formfile
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
636 ;; What is this mh-etc ?? -sm
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
637 ;; This is dead code, so
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
638 ;; remove it.
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
639 ;(and (boundp 'mh-etc) mh-etc)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
640 )))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
641 components)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
642 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
643 (error (format "Can't find components file \"%s\""
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
644 components)))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
645 nil)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 (mh-insert-fields "To:" to "Subject:" subject "Cc:" cc)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (goto-char (point-max))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (mh-compose-and-send-mail draft "" folder msg-num
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
649 to subject cc
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
650 nil nil config)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
651 (mh-letter-mode-message))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (defun mh-read-draft (use initial-contents delete-contents-file)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
654 "Read draft file into a draft buffer and make that buffer the current one.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
655 USE is a message used for prompting about the intended use of the message.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
656 INITIAL-CONTENTS is filename that is read into an empty buffer, or nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
657 if buffer should not be modified. Delete the initial-contents file if
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
658 DELETE-CONTENTS-FILE flag is set.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
659 Returns the draft folder's name.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
660 If the draft folder facility is enabled in ~/.mh_profile, a new buffer is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
661 used each time and saved in the draft folder. The draft file can then be
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
662 reused."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 (cond (mh-draft-folder
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
664 (let ((orig-default-dir default-directory)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
665 (draft-file-name (mh-new-draft-name)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
666 (pop-to-buffer (generate-new-buffer
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
667 (format "draft-%s"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
668 (file-name-nondirectory draft-file-name))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
669 (condition-case ()
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
670 (insert-file-contents draft-file-name t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
671 (file-error))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
672 (setq default-directory orig-default-dir)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
673 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
674 (let ((draft-name (expand-file-name "draft" mh-user-path)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
675 (pop-to-buffer "draft") ; Create if necessary
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
676 (if (buffer-modified-p)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
677 (if (y-or-n-p "Draft has been modified; kill anyway? ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
678 (set-buffer-modified-p nil)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
679 (error "Draft preserved")))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
680 (setq buffer-file-name draft-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
681 (clear-visited-file-modtime)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
682 (unlock-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
683 (cond ((and (file-exists-p draft-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
684 (not (equal draft-name initial-contents)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
685 (insert-file-contents draft-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
686 (delete-file draft-name))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 (cond ((and initial-contents
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
688 (or (zerop (buffer-size))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
689 (if (y-or-n-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
690 (format "A draft exists. Use for %s? " use))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
691 (if mh-error-if-no-draft
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
692 (error "A prior draft exists"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
693 t)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
694 (erase-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
695 (insert-file-contents initial-contents)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
696 (if delete-contents-file (delete-file initial-contents))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 (auto-save-mode 1)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 (if mh-draft-folder
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
699 (save-buffer)) ; Do not reuse draft name
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 (buffer-name))
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 (defun mh-new-draft-name ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
703 "Return the pathname of folder for draft messages."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 (save-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (mh-exec-cmd-quiet t "mhpath" mh-draft-folder "new")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 (buffer-substring (point-min) (1- (point-max)))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 (defun mh-annotate-msg (msg buffer note &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
709 "Mark MSG in BUFFER with character NOTE and annotate message with ARGS."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 (apply 'mh-exec-cmd "anno" buffer msg args)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 (save-excursion
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
712 (cond ((get-buffer buffer) ; Buffer may be deleted
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
713 (set-buffer buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
714 (if (numberp msg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
715 (mh-notate msg note (1+ mh-cmd-note))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
716 (mh-notate-seq msg note (1+ mh-cmd-note)))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (defun mh-insert-fields (&rest name-values)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
719 "Insert the NAME-VALUES pairs in the current buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
720 If the field exists, append the value to it.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
721 Do not insert any pairs whose value is the empty string."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (let ((case-fold-search t))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 (while name-values
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (let ((field-name (car name-values))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
725 (value (car (cdr name-values))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
726 (cond ((equal value "")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
727 nil)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
728 ((mh-position-on-field field-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
729 (insert " " (or value "")))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
730 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
731 (insert field-name " " value "\n")))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
732 (setq name-values (cdr (cdr name-values)))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
734 (defun mh-position-on-field (field &optional ignored)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
735 "Move to the end of the FIELD in the header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
736 Move to end of entire header if FIELD not found.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
737 Returns non-nil iff FIELD was found.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
738 The optional second arg is for pre-version 4 compatibility and is IGNORED."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
739 (cond ((mh-goto-header-field field)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
740 (mh-header-field-end)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
741 t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
742 ((mh-goto-header-end 0)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
743 nil)))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
744
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
745 (defun mh-get-header-field (field)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
746 "Find and return the body of FIELD in the mail header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
747 Returns the empty string if the field is not in the header of the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
748 current buffer."
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
749 (if (mh-goto-header-field field)
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
750 (progn
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
751 (skip-chars-forward " \t") ;strip leading white space in body
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
752 (let ((start (point)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
753 (mh-header-field-end)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
754 (buffer-substring-no-properties start (point))))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
755 ""))
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
756
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
757 (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
758
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
759 (defun mh-goto-header-field (field)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
760 "Move to FIELD in the message header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
761 Move to the end of the FIELD name, which should end in a colon.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
762 Returns t if found, nil if not."
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
763 (goto-char (point-min))
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
764 (let ((case-fold-search t)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
765 (headers-end (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
766 (mh-goto-header-end 0)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
767 (point))))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
768 (re-search-forward (format "^%s" field) headers-end t)))
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
769
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 (defun mh-goto-header-end (arg)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
771 "Move the cursor ARG lines after the header."
11507
595e689b719b Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
772 (if (re-search-forward "^-*$" nil nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 (forward-line arg)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
775 (defun mh-extract-from-header-value ()
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
776 "Extract From: string from header."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
777 (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
778 (if (not (mh-goto-header-field "From:"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
779 (error "No From header line found")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
780 (skip-chars-forward " \t")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
781 (buffer-substring-no-properties
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
782 (point) (progn (mh-header-field-end)(point))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 ;;; Mode for composing and sending a draft message.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
788 (put 'mh-letter-mode 'mode-class 'special)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
790 ;;; Menu extracted from mh-menubar.el V1.1 (31 July 2001)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
791 (eval-when-compile (defvar mh-letter-menu nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
792 (cond
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
793 ((fboundp 'easy-menu-define)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
794 (easy-menu-define
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
795 mh-letter-menu mh-letter-mode-map "Menu for MH-E letter mode."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
796 '("Letter"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
797 ["Send This Draft" mh-send-letter t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
798 ["Split Current Line" mh-open-line t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
799 ["Check Recipient" mh-check-whom t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
800 ["Yank Current Message" mh-yank-cur-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
801 ["Insert a Message..." mh-insert-letter t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
802 ["Insert Signature" mh-insert-signature t]
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
803 ["GPG Sign message"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
804 mh-mml-secure-message-sign-pgpmime mh-gnus-pgp-support-flag]
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
805 ["GPG Encrypt message"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
806 mh-mml-secure-message-encrypt-pgpmime mh-gnus-pgp-support-flag]
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
807 ["Compose Insertion (MIME)..." mh-compose-insertion t]
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
808 ;; ["Compose Compressed tar (MIME)..."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
809 ;;mh-mhn-compose-external-compressed-tar t]
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
810 ;; ["Compose Anon FTP (MIME)..." mh-mhn-compose-anon-ftp t]
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
811 ["Compose Forward (MIME)..." mh-compose-forward t]
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
812 ;; The next two will have to be merged. But I also need to make sure the
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
813 ;; user can't mix directives of both types.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
814 ["Pull in All Compositions (mhn)"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
815 mh-edit-mhn mh-mhn-compose-insert-flag]
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
816 ["Pull in All Compositions (gnus)"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
817 mh-mml-to-mime mh-mml-compose-insert-flag]
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
818 ["Revert to Non-MIME Edit (mhn)"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
819 mh-revert-mhn-edit (equal mh-compose-insertion 'mhn)]
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
820 ["Kill This Draft" mh-fully-kill-draft t]))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
822 ;;; Help Messages
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
823 ;;; Group messages logically, more or less.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
824 (defvar mh-letter-mode-help-messages
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
825 '((nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
826 "Send letter: \\[mh-send-letter]"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
827 "\t\tOpen line: \\[mh-open-line]\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
828 "Kill letter: \\[mh-fully-kill-draft]"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
829 "\t\tInsert:\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
830 "Check recipients: \\[mh-check-whom]"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
831 "\t\t Current message: \\[mh-yank-cur-msg]\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
832 "Encrypt message: \\[mh-mml-secure-message-encrypt-pgpmime]"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
833 "\t\t Attachment: \\[mh-compose-insertion]\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
834 "Sign message: \\[mh-mml-secure-message-sign-pgpmime]"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
835 "\t\t Message to forward: \\[mh-compose-forward]\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
836 " "
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
837 "\t\t Signature: \\[mh-insert-signature]"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
838 "Key binding cheat sheet.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
840 This is an associative array which is used to show the most common commands.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
841 The key is a prefix char. The value is one or more strings which are
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
842 concatenated together and displayed in the minibuffer if ? is pressed after
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
843 the prefix character. The special key nil is used to display the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
844 non-prefixed commands.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
845
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
846 The substitutions described in `substitute-command-keys' are performed as
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
847 well.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
848
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
849 ;;;###mh-autoload
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
850 (defun mh-fill-paragraph-function (arg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
851 "Fill paragraph at or after point.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
852 Prefix ARG means justify as well. This function enables `fill-paragraph' to
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
853 work better in MH-Letter mode."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
854 (interactive "P")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
855 (let ((fill-paragraph-function) (fill-prefix))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
856 (if (mh-in-header-p)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
857 (mail-mode-fill-paragraph arg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
858 (fill-paragraph arg))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 ;;;###autoload
29420
25fb2df6c428 (mh-send-sub): Check mh-etc is bound before using it.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28739
diff changeset
861 (define-derived-mode mh-letter-mode text-mode "MH-Letter"
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
862 "Mode for composing letters in MH-E.\\<mh-letter-mode-map>
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
863
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
864 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
865 using the MH mail handling system.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
866
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
867 There are two types of MIME directives used by MH-E: Gnus and MH. The option
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
868 `mh-compose-insertion' controls what type of directives are inserted by MH-E
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
869 commands. These directives can be converted to MIME body parts by running
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
870 \\[mh-edit-mhn] for mhn directives or \\[mh-mml-to-mime] for Gnus directives.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
871 This step is mandatory if these directives are added manually. If the
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
872 directives are inserted with MH-E commands such as \\[mh-compose-insertion],
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
873 the directives are expanded automatically when the letter is sent.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
874
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
875 Options that control this mode can be changed with
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
876 \\[customize-group]; specify the \"mh-compose\" group.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
877
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
878 When a message is composed, the hooks `text-mode-hook' and
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
879 `mh-letter-mode-hook' are run.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
881 \\{mh-letter-mode-map}"
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
882
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 (or mh-user-path (mh-find-path))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
884 (make-local-variable 'mh-send-args)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 (make-local-variable 'mh-annotate-char)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 (make-local-variable 'mh-annotate-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887 (make-local-variable 'mh-previous-window-config)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 (make-local-variable 'mh-sent-from-folder)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 (make-local-variable 'mh-sent-from-msg)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890 (make-local-variable 'mail-header-separator)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
891 (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
892 (make-local-variable 'mh-help-messages)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
893 (setq mh-help-messages mh-letter-mode-help-messages)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
894
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
895 ;; From sendmail.el for proper paragraph fill
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
896 ;; sendmail.el also sets a normal-auto-fill-function (not done here)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
897 (make-local-variable 'paragraph-separate)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
898 (make-local-variable 'paragraph-start)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
899 (make-local-variable 'fill-paragraph-function)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
900 (setq fill-paragraph-function 'mh-fill-paragraph-function)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
901 (make-local-variable 'adaptive-fill-regexp)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
902 (setq adaptive-fill-regexp
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
903 (concat adaptive-fill-regexp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
904 "\\|[ \t]*[-[:alnum:]]*>+[ \t]*"))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
905 (make-local-variable 'adaptive-fill-first-line-regexp)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
906 (setq adaptive-fill-first-line-regexp
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
907 (concat adaptive-fill-first-line-regexp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
908 "\\|[ \t]*[-[:alnum:]]*>+[ \t]*"))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
909 ;; `-- ' precedes the signature. `-----' appears at the start of the
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
910 ;; lines that delimit forwarded messages.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
911 ;; Lines containing just >= 3 dashes, perhaps after whitespace,
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
912 ;; are also sometimes used and should be separators.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
913 (setq paragraph-start (concat (regexp-quote mail-header-separator)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
914 "\\|\t*\\([-|#;>* ]\\|(?[0-9]+[.)]\\)+$"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
915 "\\|[ \t]*[[:alnum:]]*>+[ \t]*$\\|[ \t]*$\\|"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
916 "-- $\\|---+$\\|"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
917 page-delimiter))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
918 (setq paragraph-separate paragraph-start)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
919 ;; --- End of code from sendmail.el ---
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
920
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
921 (if (and (boundp 'tool-bar-mode) tool-bar-mode)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
922 (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
923 (make-local-variable 'font-lock-defaults)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
924 (cond
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
925 ((or (equal mh-highlight-citation-p 'font-lock)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
926 (equal mh-highlight-citation-p 'gnus))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
927 ;; Let's use font-lock even if gnus is used in show-mode. The reason
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
928 ;; is that gnus uses static text properties which are not appropriate
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
929 ;; for a buffer that will be edited. So the choice here is either fontify
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
930 ;; the citations and header...
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
931 (setq font-lock-defaults '(mh-show-font-lock-keywords-with-cite t)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
932 (t
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
933 ;; ...or the header only
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
934 (setq font-lock-defaults '(mh-show-font-lock-keywords t))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
935 (easy-menu-add mh-letter-menu)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
936 ;; See if a "forw: -mime" message containing a MIME composition.
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
937 ;; Mode clears local vars, so can't do this in mh-forward.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
938 (save-excursion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
939 (goto-char (point-min))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
940 (when (and (re-search-forward
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
941 (format "^\\(%s\\)?$" mail-header-separator) nil t)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
942 (= 0 (forward-line 1))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
943 (looking-at "^#forw"))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
944 (require 'mh-mime) ;Need mh-mhn-compose-insert-flag local var
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
945 (setq mh-mhn-compose-insert-flag t)))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
946 (setq fill-column mh-letter-fill-column)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
947 ;; If text-mode-hook turned on auto-fill, tune it for messages
29420
25fb2df6c428 (mh-send-sub): Check mh-etc is bound before using it.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28739
diff changeset
948 (when auto-fill-function
25fb2df6c428 (mh-send-sub): Check mh-etc is bound before using it.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28739
diff changeset
949 (make-local-variable 'auto-fill-function)
25fb2df6c428 (mh-send-sub): Check mh-etc is bound before using it.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28739
diff changeset
950 (setq auto-fill-function 'mh-auto-fill-for-letter)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
952 (defun mh-auto-fill-for-letter ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
953 "Perform auto-fill for message.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
954 Header is treated specially by inserting a tab before continuation lines."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 (if (mh-in-header-p)
11507
595e689b719b Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
956 (let ((fill-prefix "\t"))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
957 (do-auto-fill))
11507
595e689b719b Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
958 (do-auto-fill)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
959
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
960 (defun mh-insert-header-separator ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
961 "Insert `mh-mail-header-separator', if absent."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
962 (save-excursion
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
963 (goto-char (point-min))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
964 (rfc822-goto-eoh)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
965 (if (looking-at "$")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
966 (insert mh-mail-header-separator))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
968 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 (defun mh-to-field ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970 "Move point to the end of a specified header field.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 The field is indicated by the previous keystroke (the last keystroke
19936
78aa8484e6e9 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17593
diff changeset
972 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
973 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
974 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 (expand-abbrev)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
976 (let ((target (cdr (or (assoc (char-to-string (logior last-input-char ?`))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
977 mh-to-field-choices)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
978 ;; also look for a char for version 4 compat
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
979 (assoc (logior last-input-char ?`)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
980 mh-to-field-choices))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
981 (case-fold-search t))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 (push-mark)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983 (cond ((mh-position-on-field target)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
984 (let ((eol (point)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
985 (skip-chars-backward " \t")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
986 (delete-region (point) eol))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
987 (if (and (not (eq (logior last-input-char ?`) ?s))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
988 (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
989 (backward-char 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
990 (not (looking-at "[:,]"))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
991 (insert ", ")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
992 (insert " ")))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
993 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
994 (if (mh-position-on-field "To:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
995 (forward-line 1))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
996 (insert (format "%s \n" target))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
997 (backward-char 1)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
999 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 (defun mh-to-fcc (&optional folder)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001 "Insert an Fcc: FOLDER field in the current message.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002 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
1003 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 (or folder
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 (setq folder (mh-prompt-for-folder
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1006 "Fcc"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1007 (or (and mh-default-folder-for-message-function
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1008 (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1009 (goto-char (point-min))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1010 (funcall
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1011 mh-default-folder-for-message-function)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1012 "")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1013 t)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1014 (let ((last-input-char ?\C-f))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1015 (expand-abbrev)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 (save-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 (mh-to-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1018 (insert (if (mh-folder-name-p folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1019 (substring folder 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1020 folder)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1022 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 (defun mh-insert-signature ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1024 "Insert the file named by `mh-signature-file-name' at point.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1025 The value of `mh-letter-insert-signature-hook' is a list of functions to be
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1026 called, with no arguments, before the signature is actually inserted."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1027 (interactive)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1028 (let ((mh-signature-file-name mh-signature-file-name))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1029 (run-hooks 'mh-letter-insert-signature-hook)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1030 (if mh-signature-file-name
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1031 (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
1032 (force-mode-line-update))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1033
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1034 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (defun mh-check-whom ()
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1036 "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
1037 (interactive)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1038 (let ((file-name buffer-file-name))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1039 (save-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1040 (message "Checking recipients...")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1041 (mh-in-show-buffer ("*Recipients*")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042 (bury-buffer (current-buffer))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044 (mh-exec-cmd-output "whom" t file-name))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1045 (message "Checking recipients...done")))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1046
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1047
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1049 ;;; Routines to compose and send a letter.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1051 (defun mh-insert-x-face ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1052 "Append X-Face field to header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1053 If the field already exists, this function does nothing."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1054 (when (and (file-exists-p mh-x-face-file)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1055 (file-readable-p mh-x-face-file))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1056 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1057 (when (null (mh-position-on-field "X-Face"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1058 (insert "X-Face: ")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1059 (goto-char (+ (point) (cadr (insert-file-contents mh-x-face-file))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1060 (if (not (looking-at "^"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1061 (insert "\n"))))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1062
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1063 (defun mh-insert-x-mailer ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1064 "Append an X-Mailer field to the header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1065 The versions of MH-E, Emacs, and MH are shown."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1066
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1067 ;; Lazily initialize mh-x-mailer-string.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1068 (when (null mh-x-mailer-string)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1069 (save-window-excursion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1070 (mh-version)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1071 (set-buffer mh-temp-buffer)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1072 (if mh-nmh-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1073 (search-forward-regexp "^nmh-\\(\\S +\\)")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1074 (search-forward-regexp "^MH \\(\\S +\\)" nil t))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1075 (let ((x-mailer-mh (buffer-substring (match-beginning 1) (match-end 1))))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1076 (setq mh-x-mailer-string
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1077 (format "MH-E %s; %s %s; %s %d.%d"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1078 mh-version (if mh-nmh-flag "nmh" "MH") x-mailer-mh
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1079 (if mh-xemacs-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1080 "XEmacs"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1081 "Emacs")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1082 emacs-major-version emacs-minor-version)))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1083 (kill-buffer mh-temp-buffer)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1084 ;; Insert X-Mailer, but only if it doesn't already exist.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1085 (save-excursion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1086 (when (null (mh-goto-header-field "X-Mailer"))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1087 (mh-insert-fields "X-Mailer:" mh-x-mailer-string))))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1088
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1089 (defun mh-regexp-in-field-p (regexp &rest fields)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1090 "Non-nil means REGEXP was found in FIELDS."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1091 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1092 (let ((search-result nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1093 (field))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1094 (while fields
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1095 (setq field (car fields))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1096 (if (and (mh-goto-header-field field)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1097 (re-search-forward
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1098 regexp (save-excursion (mh-header-field-end)(point)) t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1099 (setq fields nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1100 search-result t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1101 (setq fields (cdr fields))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1102 search-result)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1103
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1104 (defun mh-insert-mail-followup-to ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1105 "Insert Mail-Followup-To: if To or Cc match `mh-insert-mail-followup-to-list'."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1106 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1107 (if (and (or (mh-goto-header-field "To:")(mh-goto-header-field "cc:"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1108 (not (mh-goto-header-field "Mail-Followup-To: ")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1109 (let ((list mh-insert-mail-followup-to-list))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1110 (while list
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1111 (let ((regexp (nth 0 (car list)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1112 (entry (nth 1 (car list))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1113 (when (mh-regexp-in-field-p regexp "To:" "cc:")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1114 (if (mh-goto-header-field "Mail-Followup-To: ")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1115 (insert entry ", ")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1116 (mh-goto-header-end 0)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1117 (insert "Mail-Followup-To: " entry "\n")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1118 (setq list (cdr list))))))))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1119
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1120 (defun mh-compose-and-send-mail (draft send-args
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1121 sent-from-folder sent-from-msg
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1122 to subject cc
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1123 annotate-char annotate-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1124 config)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1125 "Edit and compose a draft message in buffer DRAFT and send or save it.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1126 SEND-ARGS is the argument passed to the send command.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1127 SENT-FROM-FOLDER is buffer containing scan listing of current folder, or
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1128 nil if none exists.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1129 SENT-FROM-MSG is the message number or sequence name or nil.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1130 The TO, SUBJECT, and CC fields are passed to the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1131 `mh-compose-letter-function'.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1132 If ANNOTATE-CHAR is non-null, it is used to notate the scan listing of the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1133 message. In that case, the ANNOTATE-FIELD is used to build a string
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1134 for `mh-annotate-msg'.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1135 CONFIG is the window configuration to restore after sending the letter."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136 (pop-to-buffer draft)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1137 (if mh-insert-mail-followup-to-flag (mh-insert-mail-followup-to))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138 (mh-letter-mode)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1139
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1140 ;; mh-identity support
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1141 (if (and (boundp 'mh-identity-default)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1142 mh-identity-default)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1143 (mh-insert-identity mh-identity-default))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1144 (when (and (boundp 'mh-identity-list)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1145 mh-identity-list)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1146 (mh-identity-make-menu)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1147 (easy-menu-add mh-identity-menu))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1148
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1149 (setq mh-sent-from-folder sent-from-folder)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1150 (setq mh-sent-from-msg sent-from-msg)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1151 (setq mh-send-args send-args)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1152 (setq mh-annotate-char annotate-char)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1153 (setq mh-annotate-field annotate-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 (setq mh-previous-window-config config)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1155 (setq mode-line-buffer-identification (list "{%b}"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1156 (if (and (boundp 'mh-compose-letter-function)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1157 mh-compose-letter-function)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1158 ;; run-hooks will not pass arguments.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1159 (let ((value mh-compose-letter-function))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1160 (if (and (listp value) (not (eq (car value) 'lambda)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1161 (while value
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1162 (funcall (car value) to subject cc)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1163 (setq value (cdr value)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1164 (funcall mh-compose-letter-function to subject cc)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1165
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1166 (defun mh-letter-mode-message ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1167 "Display a help message for users of `mh-letter-mode'.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1168 This should be the last function called when composing the draft."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1169 (message "%s" (substitute-command-keys
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1170 (concat "Type \\[mh-send-letter] to send message, "
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1171 "\\[mh-help] for help."))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1173 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174 (defun mh-send-letter (&optional arg)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1175 "Send the draft letter in the current buffer.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1176 If optional prefix argument ARG is provided, monitor delivery.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1177 The value of `mh-before-send-letter-hook' is a list of functions to be called,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1178 with no arguments, before doing anything.
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1179 Run `\\[mh-edit-mhn]' if variable `mh-mhn-compose-insert-flag' is set.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1180 Run `\\[mh-mml-to-mime]' if variable `mh-mml-compose-insert-flag' is set.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1181 Insert X-Mailer field if variable `mh-insert-x-mailer-flag' is set.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1182 Insert X-Face field if the file specified by `mh-x-face-file' exists."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1183 (interactive "P")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184 (run-hooks 'mh-before-send-letter-hook)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1185 (cond
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1186 ((and (boundp 'mh-mhn-compose-insert-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1187 mh-mhn-compose-insert-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1188 (mh-edit-mhn))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1189 ((and (boundp 'mh-mml-compose-insert-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1190 mh-mml-compose-insert-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1191 (mh-mml-to-mime)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1192 (if mh-insert-x-mailer-flag (mh-insert-x-mailer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1193 (mh-insert-x-face)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1194 (save-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1195 (message "Sending...")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1196 (let ((draft-buffer (current-buffer))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1197 (file-name buffer-file-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1198 (config mh-previous-window-config)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1199 (coding-system-for-write
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1200 (if (and (local-variable-p 'buffer-file-coding-system
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1201 (current-buffer)) ;XEmacs needs two args
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1202 ;; We're not sure why, but buffer-file-coding-system
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1203 ;; tends to get set to undecided-unix.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1204 (not (memq buffer-file-coding-system
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1205 '(undecided undecided-unix undecided-dos))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1206 buffer-file-coding-system
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1207 (or (and (boundp 'sendmail-coding-system) sendmail-coding-system)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1208 (and (boundp 'default-buffer-file-coding-system )
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1209 default-buffer-file-coding-system)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1210 'iso-latin-1))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1211 ;; The default BCC encapsulation will make a MIME message unreadable.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1212 ;; With nmh use the -mime arg to prevent this.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1213 (if (and mh-nmh-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1214 (mh-goto-header-field "Bcc:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1215 (mh-goto-header-field "Content-Type:"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1216 (setq mh-send-args (format "-mime %s" mh-send-args)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1217 (cond (arg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1218 (pop-to-buffer "MH mail delivery")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1219 (erase-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1220 (mh-exec-cmd-output mh-send-prog t "-watch" "-nopush"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1221 "-nodraftfolder" mh-send-args file-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1222 (goto-char (point-max)) ; show the interesting part
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1223 (recenter -1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1224 (set-buffer draft-buffer)) ; for annotation below
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1225 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1226 (mh-exec-cmd-daemon mh-send-prog "-nodraftfolder" "-noverbose"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1227 mh-send-args file-name)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 (if mh-annotate-char
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1229 (mh-annotate-msg mh-sent-from-msg
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1230 mh-sent-from-folder
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1231 mh-annotate-char
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1232 "-component" mh-annotate-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1233 "-text" (format "\"%s %s\""
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1234 (mh-get-header-field "To:")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1235 (mh-get-header-field "Cc:"))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1236
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237 (cond ((or (not arg)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1238 (y-or-n-p "Kill draft buffer? "))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1239 (kill-buffer draft-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1240 (if config
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1241 (set-window-configuration config))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 (if arg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1243 (message "Sending...done")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 (message "Sending...backgrounded"))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1246 ;;;###mh-autoload
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1247 (defun mh-insert-letter (folder message verbatim)
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1248 "Insert a message into the current letter.
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1249 Removes the header fields according to the variable `mh-invisible-headers'.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1250 Prefixes each non-blank line with `mh-ins-buf-prefix', unless
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1251 `mh-yank-from-start-of-msg' is set for supercite in which case supercite is
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1252 used to format the message.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1253 Prompts for FOLDER and MESSAGE. If prefix argument VERBATIM provided, do
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1254 not indent and do not delete headers. Leaves the mark before the letter
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1255 and point after it."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256 (interactive
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1257 (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1258 (read-input (format "Message number%s: "
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1259 (if (numberp mh-sent-from-msg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1260 (format " [%d]" mh-sent-from-msg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1261 "")))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1262 current-prefix-arg))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263 (save-restriction
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264 (narrow-to-region (point) (point))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 (let ((start (point-min)))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1266 (if (equal message "") (setq message (int-to-string mh-sent-from-msg)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1267 (insert-file-contents
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1268 (expand-file-name message (mh-expand-file-name folder)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1269 (when (not verbatim)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1270 (mh-clean-msg-header start mh-invisible-headers mh-visible-headers)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1271 (goto-char (point-max)) ;Needed for sc-cite-original
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1272 (push-mark) ;Needed for sc-cite-original
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1273 (goto-char (point-min)) ;Needed for sc-cite-original
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1274 (mh-insert-prefix-string mh-ins-buf-prefix)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1276 (defun mh-extract-from-attribution ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1277 "Extract phrase or comment from From header field."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1278 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1279 (if (not (mh-goto-header-field "From: "))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1280 nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1281 (skip-chars-forward " ")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1282 (cond
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1283 ((looking-at "\"\\([^\"\n]+\\)\" \\(<.+>\\)")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1284 (format "%s %s %s" (match-string 1)(match-string 2)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1285 mh-extract-from-attribution-verb))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1286 ((looking-at "\\([^<\n]+<.+>\\)$")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1287 (format "%s %s" (match-string 1) mh-extract-from-attribution-verb))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1288 ((looking-at "\\([^ ]+@[^ ]+\\) +(\\(.+\\))$")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1289 (format "%s <%s> %s" (match-string 2)(match-string 1)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1290 mh-extract-from-attribution-verb))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1291 ((looking-at " *\\(.+\\)$")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1292 (format "%s %s" (match-string 1) mh-extract-from-attribution-verb))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1294 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 (defun mh-yank-cur-msg ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 "Insert the current message into the draft buffer.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 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
1298 `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
1299 only the region will be inserted. Otherwise, the entire message will
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300 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
1301 is nil, the portion of the message following the point will be yanked.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1302 If `mh-delete-yanked-msg-window-flag' is non-nil, any window displaying the
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1303 yanked message will be deleted."
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1304 (interactive)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1305 (if (and mh-sent-from-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1306 (save-excursion (set-buffer mh-sent-from-folder) mh-show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1307 (save-excursion (set-buffer mh-sent-from-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1308 (get-buffer mh-show-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1309 mh-sent-from-msg)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310 (let ((to-point (point))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1311 (to-buffer (current-buffer)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1312 (set-buffer mh-sent-from-folder)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1313 (if mh-delete-yanked-msg-window-flag
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1314 (delete-windows-on mh-show-buffer))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1315 (set-buffer mh-show-buffer) ; Find displayed message
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1316 (let* ((from-attr (mh-extract-from-attribution))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1317 (yank-region (mh-mark-active-p nil))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1318 (mh-ins-str
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1319 (cond ((and yank-region
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1320 (or (eq 'supercite mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1321 (eq 'autosupercite mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1322 (eq t mh-yank-from-start-of-msg)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1323 ;; supercite needs the full header
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1324 (concat
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1325 (buffer-substring (point-min) (mail-header-end))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1326 "\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1327 (buffer-substring (region-beginning) (region-end))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1328 (yank-region
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1329 (buffer-substring (region-beginning) (region-end)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1330 ((or (eq 'body mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1331 (eq 'attribution
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1332 mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1333 (eq 'autoattrib
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1334 mh-yank-from-start-of-msg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1335 (buffer-substring
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1336 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1337 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1338 (mh-goto-header-end 1)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1339 (point))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1340 (point-max)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1341 ((or (eq 'supercite mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1342 (eq 'autosupercite mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1343 (eq t mh-yank-from-start-of-msg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1344 (buffer-substring (point-min) (point-max)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1345 (t
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1346 (buffer-substring (point) (point-max))))))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1347 (set-buffer to-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1348 (save-restriction
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1349 (narrow-to-region to-point to-point)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1350 (insert (mh-filter-out-non-text mh-ins-str))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1351 (goto-char (point-max)) ;Needed for sc-cite-original
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1352 (push-mark) ;Needed for sc-cite-original
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1353 (goto-char (point-min)) ;Needed for sc-cite-original
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1354 (mh-insert-prefix-string mh-ins-buf-prefix)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1355 (if (or (eq 'attribution mh-yank-from-start-of-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1356 (eq 'autoattrib mh-yank-from-start-of-msg))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1357 (insert from-attr "\n\n"))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1358 ;; If the user has selected a region, he has already "edited" the
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1359 ;; text, so leave the cursor at the end of the yanked text. In
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1360 ;; either case, leave a mark at the opposite end of the included
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1361 ;; text to make it easy to jump or delete to the other end of the
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1362 ;; text.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1363 (push-mark)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1364 (goto-char (point-max))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1365 (if (null yank-region)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1366 (mh-exchange-point-and-mark-preserving-active-mark)))))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1367 (error "There is no current message")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1369 (defun mh-filter-out-non-text (string)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1370 "Return STRING but without adornments such as MIME buttons and smileys."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1371 (with-temp-buffer
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1372 ;; Insert the string to filter
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1373 (insert string)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1374 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1375
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1376 ;; Remove the MIME buttons
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1377 (let ((can-move-forward t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1378 (in-button nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1379 (while can-move-forward
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1380 (cond ((and (not (get-text-property (point) 'mh-data))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1381 in-button)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1382 (delete-region (1- (point)) (point))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1383 (setq in-button nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1384 ((get-text-property (point) 'mh-data)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1385 (delete-region (point)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1386 (save-excursion (forward-line) (point)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1387 (setq in-button t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1388 (t (setq can-move-forward (= (forward-line) 0))))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1389
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1390 ;; Return the contents without properties... This gets rid of emphasis
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1391 ;; and smileys
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1392 (buffer-substring-no-properties (point-min) (point-max))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1393
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1394 (defun mh-insert-prefix-string (mh-ins-string)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1395 "Insert prefix string before each line in buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1396 The inserted letter is cited using `sc-cite-original' if
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1397 `mh-yank-from-start-of-msg' is one of 'supercite or 'autosupercite. Otherwise,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1398 simply insert MH-INS-STRING before each line."
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1399 (goto-char (point-min))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1400 (cond ((or (eq mh-yank-from-start-of-msg 'supercite)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1401 (eq mh-yank-from-start-of-msg 'autosupercite))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1402 (sc-cite-original))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1403 (mail-citation-hook
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1404 (run-hooks 'mail-citation-hook))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1405 (mh-yank-hooks ;old hook name
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1406 (run-hooks 'mh-yank-hooks))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1407 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1408 (or (bolp) (forward-line 1))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1409 (while (< (point) (point-max))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1410 (insert mh-ins-string)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1411 (forward-line 1))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1412 (goto-char (point-min))))) ;leave point like sc-cite-original
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1414 ;;;###mh-autoload
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1415 (defun mh-fully-kill-draft ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416 "Kill the draft message file and the draft message buffer.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1417 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
1418 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1419 (if (y-or-n-p "Kill draft message? ")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420 (let ((config mh-previous-window-config))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1421 (if (file-exists-p buffer-file-name)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1422 (delete-file buffer-file-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1423 (set-buffer-modified-p nil)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1424 (kill-buffer (buffer-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1425 (message "")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1426 (if config
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1427 (set-window-configuration config)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1428 (error "Message not killed")))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1430 (defun mh-current-fill-prefix ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1431 "Return the `fill-prefix' on the current line as a string."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1432 (save-excursion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1433 (beginning-of-line)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1434 ;; This assumes that the major-mode sets up adaptive-fill-regexp
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1435 ;; correctly such as mh-letter-mode or sendmail.el's mail-mode. But
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1436 ;; perhaps I should use the variable and simply inserts its value here,
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1437 ;; and set it locally in a let scope. --psg
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1438 (if (re-search-forward adaptive-fill-regexp nil t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1439 (match-string 0)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1440 "")))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1441
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1442 ;;;###mh-autoload
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1443 (defun mh-open-line ()
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1444 "Insert a newline and leave point after it.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1445 In addition, insert newline and quoting characters before text after point.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1446 This is useful in breaking up paragraphs in replies."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1447 (interactive)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1448 (let ((column (current-column))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1449 (prefix (mh-current-fill-prefix)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1450 (if (> (length prefix) column)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1451 (message "Sorry, point seems to be within the line prefix")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1452 (newline 2)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1453 (insert prefix)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1454 (while (> column (current-column))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1455 (insert " "))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1456 (forward-line -1))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1457
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1458 ;;;###mh-autoload
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1459 (defun mh-letter-complete (arg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1460 "Perform completion on header field or word preceding point.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1461 Alias completion is done within the mail header on selected fields and
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1462 by the function designated by `mh-letter-complete-function' elsewhere,
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1463 passing the prefix ARG if any."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1464 (interactive "P")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1465 (let ((case-fold-search t))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1466 (if (and (mh-in-header-p)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1467 (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1468 (mh-header-field-beginning)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1469 (looking-at "^.*\\(to\\|cc\\|from\\):")))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1470 (mh-alias-letter-expand-alias)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1471 (funcall mh-letter-complete-function arg))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1472
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1473 ;;; Build the letter-mode keymap:
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1474 ;;; If this changes, modify mh-letter-mode-help-messages accordingly, above.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1475 (gnus-define-keys mh-letter-mode-map
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1476 "\C-c?" mh-help
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1477 "\C-c\C-c" mh-send-letter
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1478 "\C-c\C-d" mh-insert-identity
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1479 "\C-c\C-e" mh-edit-mhn
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1480 "\C-c\C-f\C-b" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1481 "\C-c\C-f\C-c" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1482 "\C-c\C-f\C-d" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1483 "\C-c\C-f\C-f" mh-to-fcc
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1484 "\C-c\C-f\C-r" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1485 "\C-c\C-f\C-s" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1486 "\C-c\C-f\C-t" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1487 "\C-c\C-fb" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1488 "\C-c\C-fc" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1489 "\C-c\C-fd" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1490 "\C-c\C-ff" mh-to-fcc
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1491 "\C-c\C-fr" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1492 "\C-c\C-fs" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1493 "\C-c\C-ft" mh-to-field
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1494 "\C-c\C-i" mh-insert-letter
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1495 "\C-c\C-m\C-e" mh-mml-secure-message-encrypt-pgpmime
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1496 "\C-c\C-m\C-f" mh-compose-forward
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1497 "\C-c\C-m\C-i" mh-compose-insertion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1498 "\C-c\C-m\C-m" mh-mml-to-mime
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1499 "\C-c\C-m\C-s" mh-mml-secure-message-sign-pgpmime
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1500 "\C-c\C-m\C-u" mh-revert-mhn-edit
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1501 "\C-c\C-me" mh-mml-secure-message-encrypt-pgpmime
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1502 "\C-c\C-mf" mh-compose-forward
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1503 "\C-c\C-mi" mh-compose-insertion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1504 "\C-c\C-mm" mh-mml-to-mime
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1505 "\C-c\C-ms" mh-mml-secure-message-sign-pgpmime
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1506 "\C-c\C-mu" mh-revert-mhn-edit
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1507 "\C-c\C-o" mh-open-line
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1508 "\C-c\C-q" mh-fully-kill-draft
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1509 "\C-c\C-\\" mh-fully-kill-draft ;if no C-q
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1510 "\C-c\C-s" mh-insert-signature
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1511 "\C-c\C-^" mh-insert-signature ;if no C-s
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1512 "\C-c\C-w" mh-check-whom
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1513 "\C-c\C-y" mh-yank-cur-msg
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1514 "\M-\t" mh-letter-complete)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1515
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42205
diff changeset
1516 ;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 10875
diff changeset
1517
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1518 (provide 'mh-comp)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1519
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1520 ;;; Local Variables:
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1521 ;;; indent-tabs-mode: nil
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1522 ;;; sentence-end-double-space: nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1523 ;;; End:
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35975
diff changeset
1524
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35975
diff changeset
1525 ;;; mh-comp.el ends here