annotate lisp/gnus/message.el @ 151:59463afc5666 r20-3b2

Import from CVS: tag r20-3b2
author cvs
date Mon, 13 Aug 2007 09:37:19 +0200
parents 1856695b1fa9
children 25f70ba0133c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; message.el --- composing mail and news messages
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: mail, news
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; This mode provides mail-sending facilities from within Emacs. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; consists mainly of large chunks of code from the sendmail.el,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; gnus-msg.el and rnewspost.el files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
32 (require 'cl)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (require 'mailheader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (require 'rmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (require 'nnheader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (require 'timezone)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (require 'easymenu)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
38 (require 'custom)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (if (string-match "XEmacs\\|Lucid" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (require 'mail-abbrevs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (require 'mailabbrev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
43 (defgroup message '((user-mail-address custom-variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
44 (user-full-name custom-variable))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
45 "Mail and news message composing."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
46 :link '(custom-manual "(message)Top")
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
47 :group 'mail
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
48 :group 'news)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
49
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
50 (put 'user-mail-address 'custom-type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
51 (put 'user-full-name 'custom-type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
52
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
53 (defgroup message-various nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
54 "Various Message Variables"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
55 :link '(custom-manual "(message)Various Message Variables")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
56 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
57
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
58 (defgroup message-buffers nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
59 "Message Buffers"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
60 :link '(custom-manual "(message)Message Buffers")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
61 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
62
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
63 (defgroup message-sending nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
64 "Message Sending"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
65 :link '(custom-manual "(message)Sending Variables")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
66 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
67
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
68 (defgroup message-interface nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
69 "Message Interface"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
70 :link '(custom-manual "(message)Interface")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
71 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
72
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
73 (defgroup message-forwarding nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
74 "Message Forwarding"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
75 :link '(custom-manual "(message)Forwarding")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
76 :group 'message-interface)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
77
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
78 (defgroup message-insertion nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
79 "Message Insertion"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
80 :link '(custom-manual "(message)Insertion")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
81 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
82
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
83 (defgroup message-headers nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
84 "Message Headers"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
85 :link '(custom-manual "(message)Message Headers")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
86 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
87
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
88 (defgroup message-news nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
89 "Composing News Messages"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
90 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
91
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
92 (defgroup message-mail nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
93 "Composing Mail Messages"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
94 :group 'message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
96 (defgroup message-faces nil
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
97 "Faces used for message composing."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
98 :group 'message
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
99 :group 'faces)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
100
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
101 (defcustom message-directory "~/Mail/"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
102 "*Directory from which all other mail file variables are derived."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
103 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
104 :type 'directory)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
105
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
106 (defcustom message-max-buffers 10
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
107 "*How many buffers to keep before starting to kill them off."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
108 :group 'message-buffers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
109 :type 'integer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
110
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
111 (defcustom message-send-rename-function nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
112 "Function called to rename the buffer after sending it."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
113 :group 'message-buffers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
114 :type 'function)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
115
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
116 (defcustom message-fcc-handler-function 'message-output
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "*A function called to save outgoing articles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 This function will be called with the name of the file to store the
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
119 article in. The default function is `message-output' which saves in Unix
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
120 mailbox format."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
121 :type '(radio (function-item message-output)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
122 (function :tag "Other"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
123 :group 'message-sending)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
124
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
125 (defcustom message-courtesy-message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
126 "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
127 "*This is inserted at the start of a mailed copy of a posted message.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
128 If the string contains the format spec \"%s\", the Newsgroups
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
129 the article has been posted to will be inserted there.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
130 If this variable is nil, no such courtesy message will be added."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
131 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
132 :type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
133
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
134 (defcustom message-ignored-bounced-headers "^\\(Received\\|Return-Path\\):"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
135 "*Regexp that matches headers to be removed in resent bounced mail."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
136 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
137 :type 'regexp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
140 (defcustom message-from-style 'default
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 "*Specifies how \"From\" headers look.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 If `nil', they contain just the return address like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 king@grassland.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 If `parens', they look like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 king@grassland.com (Elvis Parsley)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 If `angles', they look like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 Elvis Parsley <king@grassland.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Otherwise, most addresses look like `angles', but they look like
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
151 `parens' if `angles' would need quoting and `parens' would not."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
152 :type '(choice (const :tag "simple" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
153 (const parens)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
154 (const angles)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
155 (const default))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
156 :group 'message-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
157
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
158 (defcustom message-syntax-checks nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
159 ;; Guess this one shouldn't be easy to customize...
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 "Controls what syntax checks should not be performed on outgoing posts.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 To disable checking of long signatures, for instance, add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 `(signature . disabled)' to this list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 Don't touch this variable unless you really know what you're doing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 Checks include subject-cmsg multiple-headers sendsys message-id from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 long-lines control-chars size new-text redirected-followup signature
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
168 approved sender empty empty-headers message-id from subject
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
169 shorten-followup-to existing-newsgroups."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
170 :group 'message-news)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
171
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
172 (defcustom message-required-news-headers
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
173 '(From Newsgroups Subject Date Message-ID
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
174 (optional . Organization) Lines
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (optional . X-Newsreader))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
176 "Headers to be generated or prompted for when posting an article.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 RFC977 and RFC1036 require From, Date, Newsgroups, Subject,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 Message-ID. Organization, Lines, In-Reply-To, Expires, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 X-Newsreader are optional. If don't you want message to insert some
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
180 header, remove it from this list."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
181 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
182 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
183 :type '(repeat sexp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
184
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
185 (defcustom message-required-mail-headers
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 '(From Subject Date (optional . In-Reply-To) Message-ID Lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (optional . X-Mailer))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
188 "Headers to be generated or prompted for when mailing a message.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 RFC822 required that From, Date, To, Subject and Message-ID be
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
190 included. Organization, Lines and X-Mailer are optional."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
191 :group 'message-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
192 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
193 :type '(repeat sexp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
194
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
195 (defcustom message-deletable-headers '(Message-ID Date Lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
196 "Headers to be deleted if they already exist and were generated by message previously."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
197 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
198 :type 'sexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
199
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
200 (defcustom message-ignored-news-headers
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
201 "^NNTP-Posting-Host:\\|^Xref:\\|^Bcc:\\|^Gcc:\\|^Fcc:\\|^Resent-Fcc:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
202 "*Regexp of headers to be removed unconditionally before posting."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
203 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
204 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
205 :type 'regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
206
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
207 (defcustom message-ignored-mail-headers "^Gcc:\\|^Fcc:\\|^Resent-Fcc:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
208 "*Regexp of headers to be removed unconditionally before mailing."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
209 :group 'message-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
210 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
211 :type 'regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
212
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
213 (defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|Return-Path:\\|^Supersedes:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
214 "*Header lines matching this regexp will be deleted before posting.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
215 It's best to delete old Path and Date headers before posting to avoid
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
216 any confusion."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
217 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
218 :type 'regexp)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
219
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
220 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
221 (defcustom message-signature-separator "^-- *$"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
222 "Regexp matching the signature separator."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
223 :type 'regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
224 :group 'message-various)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
225
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
226 (defcustom message-elide-elipsis "\n[...]\n\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
227 "*The string which is inserted for elided text.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
228
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
229 (defcustom message-interactive nil
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
230 "Non-nil means when sending a message wait for and display errors.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
231 nil means let mailer mail back a message to report errors."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
232 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
233 :group 'message-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
234 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
235
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
236 (defcustom message-generate-new-buffers t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 "*Non-nil means that a new message buffer will be created whenever `mail-setup' is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 If this is a function, call that function with three parameters: The type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 the to address and the group name. (Any of these may be nil.) The function
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
240 should return the new buffer name."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
241 :group 'message-buffers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
242 :type '(choice (const :tag "off" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
243 (const :tag "on" t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
244 (function fun)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
245
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
246 (defcustom message-kill-buffer-on-exit nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
247 "*Non-nil means that the message buffer will be killed after sending a message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
248 :group 'message-buffers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
249 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (defvar gnus-local-organization)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
252 (defcustom message-user-organization
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (or (and (boundp 'gnus-local-organization)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
254 (stringp gnus-local-organization)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 gnus-local-organization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (getenv "ORGANIZATION")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 "*String to be used as an Organization header.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
259 If t, use `message-user-organization-file'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
260 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
261 :type '(choice string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
262 (const :tag "consult file" t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
265 (defcustom message-user-organization-file "/usr/lib/news/organization"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
266 "*Local news organization file."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
267 :type 'file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
268 :group 'message-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
269
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
270 (defcustom message-autosave-directory "~/"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
271 ; (concat (file-name-as-directory message-directory) "drafts/")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 "*Directory where message autosaves buffers.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
273 If nil, message won't autosave."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
274 :group 'message-buffers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
275 :type 'directory)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
276
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
277 (defcustom message-forward-start-separator
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
278 "------- Start of forwarded message -------\n"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
279 "*Delimiter inserted before forwarded messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
280 :group 'message-forwarding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
281 :type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
282
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
283 (defcustom message-forward-end-separator
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 "------- End of forwarded message -------\n"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
285 "*Delimiter inserted after forwarded messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
286 :group 'message-forwarding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
287 :type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
288
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
289 (defcustom message-signature-before-forwarded-message t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
290 "*If non-nil, put the signature before any included forwarded message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
291 :group 'message-forwarding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
292 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
293
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
294 (defcustom message-included-forward-headers
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
295 "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-\\|^Message-ID:\\|^References:"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
296 "*Regexp matching headers to be included in forwarded messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
297 :group 'message-forwarding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
298 :type 'regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
299
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
300 (defcustom message-ignored-resent-headers "^Return-receipt"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
301 "*All headers that match this regexp will be deleted when resending a message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
302 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
303 :type 'regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
304
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
305 (defcustom message-ignored-cited-headers "."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
306 "*Delete these headers from the messages you yank."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
307 :group 'message-insertion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
308 :type 'regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
309
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
310 (defcustom message-cancel-message "I am canceling my own article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
311 "Message to be inserted in the cancel message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
312 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
313 :type 'string)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ;; Useful to set in site-init.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
317 (defcustom message-send-mail-function 'message-send-mail-with-sendmail
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 "Function to call to send the current buffer as mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 The headers should be delimited by a line whose contents match the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 variable `mail-header-separator'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
322 Legal values include `message-send-mail-with-sendmail' (the default),
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
323 `message-send-mail-with-mh' and `message-send-mail-with-qmail'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
324 :type '(radio (function-item message-send-mail-with-sendmail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
325 (function-item message-send-mail-with-mh)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
326 (function-item message-send-mail-with-qmail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
327 (function :tag "Other"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
328 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
329 :group 'message-mail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
330
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
331 (defcustom message-send-news-function 'message-send-news
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 "Function to call to send the current buffer as news.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 The headers should be delimited by a line whose contents match the
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
334 variable `mail-header-separator'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
335 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
336 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
337 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
338
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
339 (defcustom message-reply-to-function nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
340 "Function that should return a list of headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
341 This function should pick out addresses from the To, Cc, and From headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
342 and respond with new To and Cc headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
343 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
344 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
345
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
346 (defcustom message-wide-reply-to-function nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
347 "Function that should return a list of headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
348 This function should pick out addresses from the To, Cc, and From headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
349 and respond with new To and Cc headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
350 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
351 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
352
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
353 (defcustom message-followup-to-function nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 "Function that should return a list of headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 This function should pick out addresses from the To, Cc, and From headers
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
356 and respond with new To and Cc headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
357 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
358 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
359
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
360 (defcustom message-use-followup-to 'ask
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
361 "*Specifies what to do with Followup-To header.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
362 If nil, always ignore the header. If it is t, use its value, but
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
363 query before using the \"poster\" value. If it is the symbol `ask',
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
364 always query the user whether to use the value. If it is the symbol
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
365 `use', always use the value."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
366 :group 'message-interface
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
367 :type '(choice (const :tag "ignore" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
368 (const use)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
369 (const ask)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
370
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
371 ;; stuff relating to broken sendmail in MMDF
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
372 (defcustom message-sendmail-f-is-evil nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
373 "*Non-nil means that \"-f username\" should not be added to the sendmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
374 command line, because it is even more evil than leaving it out."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
375 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
376 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
377
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
378 ;; qmail-related stuff
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
379 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
380 "Location of the qmail-inject program."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
381 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
382 :type 'file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
383
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
384 (defcustom message-qmail-inject-args nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
385 "Arguments passed to qmail-inject programs.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
386 This should be a list of strings, one string for each argument.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
387
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
388 For e.g., if you wish to set the envelope sender address so that bounces
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
389 go to the right place or to deal with listserv's usage of that address, you
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
390 might set this variable to '(\"-f\" \"you@some.where\")."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
391 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
392 :type '(repeat string))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (defvar gnus-post-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (defvar gnus-select-method)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
396 (defcustom message-post-method
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (cond ((and (boundp 'gnus-post-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 gnus-post-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 gnus-post-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ((boundp 'gnus-select-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 gnus-select-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (t '(nnspool "")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
403 "Method used to post news."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
404 :group 'message-news
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
405 :group 'message-sending
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
406 ;; This should be the `gnus-select-method' widget, but that might
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
407 ;; create a dependence to `gnus.el'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
408 :type 'sexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
409
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
410 (defcustom message-generate-headers-first nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
411 "*If non-nil, generate all possible headers before composing."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
412 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
413 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
414
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
415 (defcustom message-setup-hook nil
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
416 "Normal hook, run each time a new outgoing message is initialized.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
417 The function `message-setup' runs this hook."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
418 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
419 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
420
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
421 (defcustom message-signature-setup-hook nil
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
422 "Normal hook, run each time a new outgoing message is initialized.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
423 It is run after the headers have been inserted and before
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
424 the signature is inserted."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
425 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
426 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
427
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
428 (defcustom message-mode-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
429 "Hook run in message mode buffers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
430 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
431 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
432
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
433 (defcustom message-header-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
434 "Hook run in a message mode buffer narrowed to the headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
435 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
436 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
437
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
438 (defcustom message-header-setup-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
439 "Hook called narrowed to the headers when setting up a message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
440 buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
441 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
442 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
443
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
444 ;;;###autoload
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
445 (defcustom message-citation-line-function 'message-insert-citation-line
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
446 "*Function called to insert the \"Whomever writes:\" line."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
447 :type 'function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
448 :group 'message-insertion)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
451 (defcustom message-yank-prefix "> "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
452 "*Prefix inserted on the lines of yanked messages.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
453 nil means use indentation."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
454 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
455 :group 'message-insertion)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
456
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
457 (defcustom message-indentation-spaces 3
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
458 "*Number of spaces to insert at the beginning of each cited line.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
459 Used by `message-yank-original' via `message-yank-cite'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
460 :group 'message-insertion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
461 :type 'integer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
464 (defcustom message-cite-function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
465 (if (and (boundp 'mail-citation-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
466 mail-citation-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
467 mail-citation-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
468 'message-cite-original)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
469 "*Function for citing an original message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
470 :type '(radio (function-item message-cite-original)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
471 (function-item sc-cite-original)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
472 (function :tag "Other"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
473 :group 'message-insertion)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
476 (defcustom message-indent-citation-function 'message-indent-citation
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 "*Function for modifying a citation just inserted in the mail buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 This can also be a list of functions. Each function can find the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 citation between (point) and (mark t). And each function should leave
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
480 point and mark around the citation text as modified."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
481 :type 'function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
482 :group 'message-insertion)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (defvar message-abbrevs-loaded nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
487 (defcustom message-signature t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 "*String to be inserted at the end of the message buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 If t, the `message-signature-file' file will be inserted instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 If a function, the result from the function will be used instead.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
491 If a form, the result from the form will be used instead."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
492 :type 'sexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
493 :group 'message-insertion)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
496 (defcustom message-signature-file "~/.signature"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
497 "*File containing the text inserted at end of message buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
498 :type 'file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
499 :group 'message-insertion)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
500
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
501 (defcustom message-distribution-function nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
502 "*Function called to return a Distribution header."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
503 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
504 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
505 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
506
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
507 (defcustom message-expires 14
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
508 "Number of days before your article expires."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
509 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
510 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
511 :link '(custom-manual "(message)News Headers")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
512 :type 'integer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
513
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
514 (defcustom message-user-path nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 "If nil, use the NNTP server name in the Path header.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
516 If stringp, use this; if non-nil, use no host name (user name only)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
517 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
518 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
519 :link '(custom-manual "(message)News Headers")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
520 :type '(choice (const :tag "nntp" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
521 (string :tag "name")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
522 (sexp :tag "none" :format "%t" t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (defvar message-reply-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (defvar message-reply-headers nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (defvar message-newsreader nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (defvar message-mailer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (defvar message-sent-message-via nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (defvar message-checksum nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (defvar message-send-actions nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 "A list of actions to be performed upon successful sending of a message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (defvar message-exit-actions nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 "A list of actions to be performed upon exiting after sending a message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (defvar message-kill-actions nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 "A list of actions to be performed before killing a message buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (defvar message-postpone-actions nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 "A list of actions to be performed after postponing a message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
539 (defcustom message-default-headers ""
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 "*A string containing header lines to be inserted in outgoing messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 It is inserted before you edit the message, so you can edit or delete
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
542 these lines."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
543 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
544 :type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
545
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
546 (defcustom message-default-mail-headers ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
547 "*A string of header lines to be inserted in outgoing mails."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
548 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
549 :group 'message-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
550 :type 'string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
551
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
552 (defcustom message-default-news-headers ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
553 "*A string of header lines to be inserted in outgoing news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
554 articles."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
555 :group 'message-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
556 :group 'message-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
557 :type 'string)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ;; Note: could use /usr/ucb/mail instead of sendmail;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;; options -t, and -v if not interactive.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
561 (defcustom message-mailer-swallows-blank-line
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
562 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 system-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (file-readable-p "/etc/sendmail.cf")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (let ((buffer (get-buffer-create " *temp*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (insert-file-contents "/etc/sendmail.cf")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (re-search-forward "^OR\\>" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (kill-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ;; According to RFC822, "The field-name must be composed of printable
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
575 ;; ASCII characters (i. e., characters that have decimal values between
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
576 ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ;; space, or colon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 "Set this non-nil if the system's mailer runs the header and body together.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 \(This problem exists on Sunos 4 when sendmail is run in remote mode.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 The value should be an expression to test whether the problem will
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
582 actually occur."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
583 :group 'message-sending
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
584 :type 'sexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
585
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
586 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
587 (define-mail-user-agent 'message-user-agent
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
588 'message-mail 'message-send-and-exit
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
589 'message-kill-buffer 'message-send-hook))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
590
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
591 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
592 "If non-nil, delete the deletable headers before feeding to mh.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
593
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
594 (defvar message-send-method-alist
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
595 '((news message-news-p message-send-via-news)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
596 (mail message-mail-p message-send-via-mail))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
597 "Alist of ways to send outgoing messages.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
598 Each element has the form
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
599
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
600 \(TYPE PREDICATE FUNCTION)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
601
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
602 where TYPE is a symbol that names the method; PREDICATE is a function
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
603 called without any parameters to determine whether the message is
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
604 a message of type TYPE; and FUNCTION is a function to be called if
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
605 PREDICATE returns non-nil. FUNCTION is called with one parameter --
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
606 the prefix.")
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
607
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
608 (defvar message-mail-alias-type 'abbrev
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
609 "*What alias expansion type to use in Message buffers.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
610 The default is `abbrev', which uses mailabbrev. nil switches
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
611 mail aliases off.")
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
612
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
613 ;;; Internal variables.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
614 ;;; Well, not really internal.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
615
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
616 (defvar message-mode-syntax-table
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (let ((table (copy-syntax-table text-mode-syntax-table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (modify-syntax-entry ?% ". " table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 "Syntax table used while in Message mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
622 (defvar message-mode-abbrev-table text-mode-abbrev-table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
623 "Abbrev table used in Message mode buffers.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
624 Defaults to `text-mode-abbrev-table'.")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
625 (defgroup message-headers nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
626 "Message headers."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
627 :link '(custom-manual "(message)Variables")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
628 :group 'message)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
629
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
630 (defface message-header-to-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
631 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
632 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
633 (:foreground "green2" :bold t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
634 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
635 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
636 (:foreground "MidnightBlue" :bold t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
637 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
638 (:bold t :italic t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
639 "Face used for displaying From headers."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
640 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
641
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
642 (defface message-header-cc-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
643 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
644 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
645 (:foreground "green4" :bold t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
646 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
647 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
648 (:foreground "MidnightBlue"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
649 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
650 (:bold t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
651 "Face used for displaying Cc headers."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
652 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
653
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
654 (defface message-header-subject-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
655 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
656 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
657 (:foreground "green3"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
658 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
659 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
660 (:foreground "navy blue" :bold t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
661 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
662 (:bold t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
663 "Face used for displaying subject headers."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
664 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
665
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
666 (defface message-header-newsgroups-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
667 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
668 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
669 (:foreground "yellow" :bold t :italic t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
670 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
671 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
672 (:foreground "blue4" :bold t :italic t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
673 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
674 (:bold t :italic t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
675 "Face used for displaying newsgroups headers."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
676 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
677
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
678 (defface message-header-other-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
679 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
680 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
681 (:foreground "red4"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
682 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
683 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
684 (:foreground "steel blue"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
685 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
686 (:bold t :italic t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
687 "Face used for displaying newsgroups headers."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
688 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
689
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
690 (defface message-header-name-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
691 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
692 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
693 (:foreground "DarkGreen"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
694 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
695 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
696 (:foreground "cornflower blue"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
697 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
698 (:bold t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
699 "Face used for displaying header names."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
700 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
701
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
702 (defface message-header-xheader-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
703 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
704 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
705 (:foreground "blue"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
706 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
707 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
708 (:foreground "blue"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
709 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
710 (:bold t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
711 "Face used for displaying X-Header headers."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
712 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
713
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
714 (defface message-separator-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
715 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
716 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
717 (:foreground "blue4"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
718 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
719 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
720 (:foreground "brown"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
721 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
722 (:bold t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
723 "Face used for displaying the separator."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
724 :group 'message-faces)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
725
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
726 (defface message-cited-text-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
727 '((((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
728 (background dark))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
729 (:foreground "red"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
730 (((class color)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
731 (background light))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
732 (:foreground "red"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
733 (t
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
734 (:bold t)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
735 "Face used for displaying cited text names."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
736 :group 'message-faces)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
737
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (defvar message-font-lock-keywords
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
739 (let* ((cite-prefix "A-Za-z")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
740 (cite-suffix (concat cite-prefix "0-9_.@-"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
741 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)"))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
742 `((,(concat "^\\([Tt]o:\\)" content)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
743 (1 'message-header-name-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
744 (2 'message-header-to-face nil t))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
745 (,(concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
746 (1 'message-header-name-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
747 (2 'message-header-cc-face nil t))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
748 (,(concat "^\\([Ss]ubject:\\)" content)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
749 (1 'message-header-name-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
750 (2 'message-header-subject-face nil t))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
751 (,(concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
752 (1 'message-header-name-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
753 (2 'message-header-newsgroups-face nil t))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
754 (,(concat "^\\([A-Z][^: \n\t]+:\\)" content)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
755 (1 'message-header-name-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
756 (2 'message-header-other-face nil t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
757 (,(concat "^\\(X-[A-Za-z0-9-]+\\|In-Reply-To\\):" content)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
758 (1 'message-header-name-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
759 (2 'message-header-name-face))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
760 (,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
761 1 'message-separator-face)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
762 (,(concat "^[ \t]*"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
763 "\\([" cite-prefix "]+[" cite-suffix "]*\\)?"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
764 "[>|}].*")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
765 (0 'message-cited-text-face))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 "Additional expressions to highlight in Message mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (defvar message-face-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 '((bold . bold-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (underline . underline-region)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
771 (default . (lambda (b e)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (unbold-region b e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (ununderline-region b e))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 "Alist of mail and news faces for facemenu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 The cdr of ech entry is a function for applying the face to a region.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
777 (defcustom message-send-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
778 "Hook run before sending messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
779 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
780 :options '(ispell-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
781 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
782
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
783 (defcustom message-send-mail-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
784 "Hook run before sending mail messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
785 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
786 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
787
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
788 (defcustom message-send-news-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
789 "Hook run before sending news messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
790 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
791 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
792
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
793 (defcustom message-sent-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
794 "Hook run after sending messages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
795 :group 'message-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
796 :type 'hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 ;;; Internal variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (defvar message-buffer-list nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
801 (defvar message-this-is-news nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
802 (defvar message-this-is-mail nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
803
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
804 ;; Byte-compiler warning
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
805 (defvar gnus-active-hashtb)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
806 (defvar gnus-read-active-file)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 ;;; Regexp matching the delimiter of messages in UNIX mail format
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
809 ;;; (UNIX From lines), minus the initial ^.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (defvar message-unix-mail-delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (let ((time-zone-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 "\\|[-+]?[0-9][0-9][0-9][0-9]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 "\\) *")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 "From "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 ;; Username, perhaps with a quoted section that can contain spaces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 "\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 "[^ \n]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 "\\(\\|\".*\"[^ \n]*\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 "\\|<[^<>\n]+>"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 "\\) ?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 ;; The time the message was sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 "\\([^ \n]*\\) *" ; day of the week
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 "\\([^ ]*\\) *" ; month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 "\\([0-9]*\\) *" ; day of month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 "\\([0-9:]*\\) *" ; time of day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ;; Perhaps a time zone, specified by an abbreviation, or by a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; numeric offset.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 time-zone-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 ;; The year.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 " [0-9][0-9]\\([0-9]*\\) *"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 ;; On some systems the time zone can appear after the year, too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 time-zone-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ;; Old uucp cruft.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 "\\(remote from .*\\)?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (defvar message-unsent-separator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (concat "^ *---+ +Unsent message follows +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 "^ *---+ +Returned message +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 "^Start of returned message$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 "^ *---+ +Original message +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 "^ *--+ +begin message +--+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 "^ *---+ +Original message follows +---+ *$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 "^|? *---+ +Message text follows: +---+ *|?$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 "A regexp that matches the separator before the text of a failed message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
857 (defvar message-header-format-alist
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 `((Newsgroups)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
859 (To . message-fill-address)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (Cc . message-fill-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (Subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (In-Reply-To)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (Fcc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (Bcc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (Date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (Organization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (Distribution)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (Lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (Expires)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (Message-ID)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
871 (References)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (X-Mailer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (X-Newsreader))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 "Alist used for formatting headers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (autoload 'message-setup-toolbar "messagexmas")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
878 (autoload 'mh-send-letter "mh-comp")
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
879 (autoload 'gnus-point-at-eol "gnus-util")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
880 (autoload 'gnus-point-at-bol "gnus-util")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
881 (autoload 'gnus-output-to-mail "gnus-util")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
882 (autoload 'gnus-output-to-rmail "gnus-util")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
883 (autoload 'mail-abbrev-in-expansion-header-p "mailabbrev"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
887 ;;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 ;;; Utility functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
891 (defmacro message-y-or-n-p (question show &rest text)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
892 "Ask QUESTION, displaying the rest of the arguments in a temp. buffer if SHOW"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
893 `(message-talkative-question 'y-or-n-p ,question ,show ,@text))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
894
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 ;; Delete the current line (and the next N lines.);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (defmacro message-delete-line (&optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 `(delete-region (progn (beginning-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (progn (forward-line ,(or n 1)) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (defun message-tokenize-header (header &optional separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 "Split HEADER into a list of header elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 \",\" is used as the separator."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
903 (if (not header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
904 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
905 (let ((regexp (format "[%s]+" (or separator ",")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
906 (beg 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
907 (first t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
908 quoted elems paren)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
909 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
910 (message-set-work-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
911 (insert header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
912 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
913 (while (not (eobp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
914 (if first
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
915 (setq first nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
916 (forward-char 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
917 (cond ((and (> (point) beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
918 (or (eobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
919 (and (looking-at regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
920 (not quoted)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
921 (not paren))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
922 (push (buffer-substring beg (point)) elems)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
923 (setq beg (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
924 ((= (following-char) ?\")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
925 (setq quoted (not quoted)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
926 ((and (= (following-char) ?\()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
927 (not quoted))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
928 (setq paren t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
929 ((and (= (following-char) ?\))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
930 (not quoted))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
931 (setq paren nil))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
932 (nreverse elems)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
933
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
934 (defun message-mail-file-mbox-p (file)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
935 "Say whether FILE looks like a Unix mbox file."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
936 (when (and (file-exists-p file)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
937 (file-readable-p file)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
938 (file-regular-p file))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
939 (nnheader-temp-write nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
940 (nnheader-insert-file-contents file)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
941 (goto-char (point-min))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
942 (looking-at message-unix-mail-delimiter))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
943
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
944 (defun message-fetch-field (header &optional not-all)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 "The same as `mail-fetch-field', only remove all newlines."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
946 (let ((value (mail-fetch-field header nil (not not-all))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (when value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (nnheader-replace-chars-in-string value ?\n ? ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
950 (defun message-add-header (&rest headers)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
951 "Add the HEADERS to the message header, skipping those already present."
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
952 (while headers
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
953 (let (hclean)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
954 (unless (string-match "^\\([^:]+\\):[ \t]*[^ \t]" (car headers))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
955 (error "Invalid header `%s'" (car headers)))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
956 (setq hclean (match-string 1 (car headers)))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
957 (save-restriction
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
958 (message-narrow-to-headers)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
959 (unless (re-search-forward (concat "^" (regexp-quote hclean) ":") nil t)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
960 (insert (car headers) ?\n))))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
961 (setq headers (cdr headers))))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
962
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (defun message-fetch-reply-field (header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 "Fetch FIELD from the message we're replying to."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (when (and message-reply-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (buffer-name message-reply-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (set-buffer message-reply-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (message-fetch-field header))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (defun message-set-work-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (if (get-buffer " *message work*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (set-buffer " *message work*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (set-buffer (get-buffer-create " *message work*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (buffer-disable-undo (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (defun message-functionp (form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 "Return non-nil if FORM is funcallable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (or (and (symbolp form) (fboundp form))
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
983 (and (listp form) (eq (car form) 'lambda))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
984 (compiled-function-p form)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (defun message-strip-subject-re (subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 "Remove \"Re:\" from subject lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (if (string-match "^[Rr][Ee]: *" subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (substring subject (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 subject))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (defun message-remove-header (header &optional is-regexp first reverse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 "Remove HEADER in the narrowed buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 If REGEXP, HEADER is a regular expression.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 If FIRST, only remove the first instance of the header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 Return the number of headers removed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (let ((regexp (if is-regexp header (concat "^" header ":")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (number 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 last)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (while (and (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (not last))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (if (if reverse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (not (looking-at regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (looking-at regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (incf number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (when first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (setq last t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 ;; There might be a continuation header, so we have to search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 ;; until we find a new non-continuation line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (if (re-search-forward "^[^ \t]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (if (re-search-forward "^[^ \t]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 number))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (defun message-narrow-to-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 "Narrow the buffer to the head of the message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (defun message-narrow-to-head ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 "Narrow the buffer to the head of the message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (if (search-forward "\n\n" nil 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (defun message-news-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 "Say whether the current buffer contains a news message."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1049 (or message-this-is-news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1050 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1051 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1052 (message-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1053 (message-fetch-field "newsgroups")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (defun message-mail-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 "Say whether the current buffer contains a mail message."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1057 (or message-this-is-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1058 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1059 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1060 (message-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1061 (or (message-fetch-field "to")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1062 (message-fetch-field "cc")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1063 (message-fetch-field "bcc"))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (defun message-next-header ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 "Go to the beginning of the next header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (or (eobp) (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (not (if (re-search-forward "^[^ \t]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (goto-char (point-max)))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1072
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (defun message-sort-headers-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 "Sort the buffer as headers using `message-rank' text props."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1076 (sort-subr
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1077 nil 'message-next-header
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (message-next-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (unless (bobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (forward-char -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (or (get-text-property (point) 'message-rank)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1084 10000))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (defun message-sort-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 "Sort the headers of the current message according to `message-header-format-alist'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (let ((max (1+ (length message-header-format-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 rank)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (while (re-search-forward "^[^ \n]+:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (put-text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (match-beginning 0) (1+ (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 'message-rank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (if (setq rank (length (memq (assq (intern (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (1- (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 message-header-format-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 message-header-format-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (- max rank)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (1+ max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (message-sort-headers-1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 ;;; Message mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 ;;; Set up keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (defvar message-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (unless message-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (setq message-mode-map (copy-keymap text-mode-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (define-key message-mode-map "\C-c?" 'describe-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 (define-key message-mode-map "\C-c\C-f\C-b" 'message-goto-bcc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 (define-key message-mode-map "\C-c\C-f\C-w" 'message-goto-fcc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (define-key message-mode-map "\C-c\C-f\C-c" 'message-goto-cc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (define-key message-mode-map "\C-c\C-f\C-s" 'message-goto-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (define-key message-mode-map "\C-c\C-f\C-r" 'message-goto-reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 (define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 (define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (define-key message-mode-map "\C-c\C-b" 'message-goto-body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (define-key message-mode-map "\C-c\C-i" 'message-goto-signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (define-key message-mode-map "\C-c\C-t" 'message-insert-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (define-key message-mode-map "\C-c\C-n" 'message-insert-newsgroups)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1137
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (define-key message-mode-map "\C-c\C-y" 'message-yank-original)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (define-key message-mode-map "\C-c\C-q" 'message-fill-yanked-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (define-key message-mode-map "\C-c\C-w" 'message-insert-signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (define-key message-mode-map "\C-c\C-r" 'message-caesar-buffer-body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (define-key message-mode-map "\C-c\C-o" 'message-sort-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (define-key message-mode-map "\C-c\M-r" 'message-rename-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (define-key message-mode-map "\C-c\C-c" 'message-send-and-exit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (define-key message-mode-map "\C-c\C-s" 'message-send)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (define-key message-mode-map "\C-c\C-k" 'message-kill-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (define-key message-mode-map "\C-c\C-d" 'message-dont-send)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1150 (define-key message-mode-map "\C-c\C-e" 'message-elide-region)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1151
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (define-key message-mode-map "\t" 'message-tab))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1154 (easy-menu-define
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1155 message-mode-menu message-mode-map "Message Menu."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1156 '("Message"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1157 ["Sort Headers" message-sort-headers t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1158 ["Yank Original" message-yank-original t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1159 ["Fill Yanked Message" message-fill-yanked-message t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1160 ["Insert Signature" message-insert-signature t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1161 ["Caesar (rot13) Message" message-caesar-buffer-body t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1162 ["Caesar (rot13) Region" message-caesar-region (mark t)]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1163 ["Elide Region" message-elide-region (mark t)]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1164 ["Rename buffer" message-rename-buffer t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1165 ["Spellcheck" ispell-message t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1166 "----"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1167 ["Send Message" message-send-and-exit t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1168 ["Abort Message" message-dont-send t]))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1169
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1170 (easy-menu-define
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1171 message-mode-field-menu message-mode-map ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1172 '("Field"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1173 ["Fetch To" message-insert-to t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1174 ["Fetch Newsgroups" message-insert-newsgroups t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1175 "----"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1176 ["To" message-goto-to t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1177 ["Subject" message-goto-subject t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1178 ["Cc" message-goto-cc t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1179 ["Reply-To" message-goto-reply-to t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1180 ["Summary" message-goto-summary t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1181 ["Keywords" message-goto-keywords t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1182 ["Newsgroups" message-goto-newsgroups t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1183 ["Followup-To" message-goto-followup-to t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1184 ["Distribution" message-goto-distribution t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1185 ["Body" message-goto-body t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1186 ["Signature" message-goto-signature t]))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (defvar facemenu-add-face-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (defvar facemenu-remove-face-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (defun message-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 "Major mode for editing mail and news to be sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 Like Text Mode but with these additional commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 C-c C-s message-send (send the message) C-c C-c message-send-and-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 C-c C-f move to a header field (and create it if there isn't):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 C-c C-f C-t move to To C-c C-f C-s move to Subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 C-c C-f C-c move to Cc C-c C-f C-b move to Bcc
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1199 C-c C-f C-w move to Fcc C-c C-f C-r move to Reply-To
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 C-c C-f C-u move to Summary C-c C-f C-n move to Newsgroups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 C-c C-f C-k move to Keywords C-c C-f C-d move to Distribution
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1202 C-c C-f C-f move to Followup-To
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 C-c C-t message-insert-to (add a To header to a news followup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 C-c C-n message-insert-newsgroups (add a Newsgroup header to a news reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 C-c C-b message-goto-body (move to beginning of message text).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 C-c C-i message-goto-signature (move to the beginning of the signature).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 C-c C-w message-insert-signature (insert `message-signature-file' file).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 C-c C-y message-yank-original (insert current message, if any).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 C-c C-q message-fill-yanked-message (fill what was yanked).
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1210 C-c C-e message-elide-region (elide the text between point and mark).
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1211 C-c C-r message-caesar-buffer-body (rot13 the message body)."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (make-local-variable 'message-reply-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (setq message-reply-buffer nil)
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1216 (make-local-variable 'message-send-actions)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1217 (make-local-variable 'message-exit-actions)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1218 (make-local-variable 'message-kill-actions)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1219 (make-local-variable 'message-postpone-actions)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (set-syntax-table message-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (use-local-map message-mode-map)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1222 (setq local-abbrev-table message-mode-abbrev-table)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (setq major-mode 'message-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 (setq mode-name "Message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (setq buffer-offer-save t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (make-local-variable 'font-lock-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 (setq font-lock-defaults '(message-font-lock-keywords t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 (make-local-variable 'facemenu-add-face-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (make-local-variable 'facemenu-remove-face-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 (setq facemenu-add-face-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (lambda (face end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (let ((face-fun (cdr (assq face message-face-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 (if face-fun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (funcall face-fun (point) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (error "Face %s not configured for %s mode" face mode-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 facemenu-remove-face-function t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (make-local-variable 'paragraph-separate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (make-local-variable 'paragraph-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (setq paragraph-start (concat (regexp-quote mail-header-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 "$\\|[ \t]*[-_][-_][-_]+$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 "-- $\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 paragraph-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (setq paragraph-separate (concat (regexp-quote mail-header-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 "$\\|[ \t]*[-_][-_][-_]+$\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 "-- $\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 paragraph-separate))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (make-local-variable 'message-reply-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (setq message-reply-headers nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (make-local-variable 'message-newsreader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (make-local-variable 'message-mailer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (make-local-variable 'message-post-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (make-local-variable 'message-sent-message-via)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (setq message-sent-message-via nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (make-local-variable 'message-checksum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (setq message-checksum nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1257 ;;(when (fboundp 'mail-hist-define-keys)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1258 ;; (mail-hist-define-keys))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (when (string-match "XEmacs\\|Lucid" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 (message-setup-toolbar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (easy-menu-add message-mode-menu message-mode-map)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1262 (easy-menu-add message-mode-field-menu message-mode-map)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 ;; Allow mail alias things.
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1264 (when (eq message-mail-alias-type 'abbrev)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1265 (if (fboundp 'mail-abbrevs-setup)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1266 (mail-abbrevs-setup)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1267 (funcall (intern "mail-aliases-setup"))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (run-hooks 'text-mode-hook 'message-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 ;;; Message mode commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 ;;; Movement commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (defun message-goto-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 "Move point to the To header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (message-position-on-field "To"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (defun message-goto-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 "Move point to the Subject header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (message-position-on-field "Subject"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (defun message-goto-cc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 "Move point to the Cc header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (message-position-on-field "Cc" "To"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (defun message-goto-bcc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 "Move point to the Bcc header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (message-position-on-field "Bcc" "Cc" "To"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (defun message-goto-fcc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 "Move point to the Fcc header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 (message-position-on-field "Fcc" "To" "Newsgroups"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (defun message-goto-reply-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 "Move point to the Reply-To header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 (message-position-on-field "Reply-To" "Subject"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 (defun message-goto-newsgroups ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 "Move point to the Newsgroups header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 (message-position-on-field "Newsgroups"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (defun message-goto-distribution ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 "Move point to the Distribution header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 (message-position-on-field "Distribution"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (defun message-goto-followup-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 "Move point to the Followup-To header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 (message-position-on-field "Followup-To" "Newsgroups"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (defun message-goto-keywords ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 "Move point to the Keywords header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (message-position-on-field "Keywords" "Subject"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 (defun message-goto-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 "Move point to the Summary header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 (message-position-on-field "Summary" "Subject"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (defun message-goto-body ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 "Move point to the beginning of the message body."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (if (looking-at "[ \t]*\n") (expand-abbrev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (search-forward (concat "\n" mail-header-separator "\n") nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (defun message-goto-signature ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 "Move point to the beginning of the message signature."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1344 (if (re-search-forward message-signature-separator nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1345 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1346 (goto-char (point-max))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1350 (defun message-insert-to (&optional force)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1351 "Insert a To header that points to the author of the article being replied to.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1352 If the original author requested not to be sent mail, the function signals
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1353 an error.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1354 With the prefix argument FORCE, insert the header anyway."
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1355 (interactive "P")
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1356 (let ((co (message-fetch-reply-field "mail-copies-to")))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1357 (when (and (null force)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1358 co
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1359 (equal (downcase co) "never"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1360 (error "The user has requested not to have copies sent via mail")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (when (and (message-position-on-field "To")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (mail-fetch-field "to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (not (string-match "\\` *\\'" (mail-fetch-field "to"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (insert ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (insert (or (message-fetch-reply-field "reply-to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (message-fetch-reply-field "from") "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (defun message-insert-newsgroups ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 "Insert the Newsgroups header from the article being replied to."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (when (and (message-position-on-field "Newsgroups")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (mail-fetch-field "newsgroups")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (insert ","))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (insert (or (message-fetch-reply-field "newsgroups") "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 ;;; Various commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (defun message-insert-signature (&optional force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 "Insert a signature. See documentation for the `message-signature' variable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (interactive (list 0))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1384 (let* ((signature
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1385 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1386 ((and (null message-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1387 (eq force 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1388 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1389 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1390 (not (re-search-backward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1391 message-signature-separator nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1392 ((and (null message-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1393 force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1394 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1395 ((message-functionp message-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1396 (funcall message-signature))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1397 ((listp message-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1398 (eval message-signature))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1399 (t message-signature)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (signature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 (cond ((stringp signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 ((and (eq t signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 message-signature-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (file-exists-p message-signature-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 signature))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (when signature
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1408 (goto-char (point-max))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
1409 ;; Insert the signature.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (unless (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 (insert "\n-- \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 (if (eq signature t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 (insert-file-contents message-signature-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 (insert signature))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 (or (bolp) (insert "\n")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1419 (defun message-elide-region (b e)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1420 "Elide the text between point and mark. An ellipsis (from
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1421 message-elide-elipsis) will be inserted where the text was killed."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1422 (interactive "r")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1423 (kill-region b e)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1424 (unless (bolp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1425 (insert "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1426 (insert message-elide-elipsis))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1427
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (defvar message-caesar-translation-table nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 (defun message-caesar-region (b e &optional n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 "Caesar rotation of region by N, default 13, for decrypting netnews."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 (min (point) (or (mark t) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (max (point) (or (mark t) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 (when current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (setq n (if (numberp n) (mod n 26) 13)) ;canonize N
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (unless (or (zerop n) ; no action needed for a rot of 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (= b e)) ; no region to rotate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 ;; We build the table, if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (when (or (not message-caesar-translation-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (/= (aref message-caesar-translation-table ?a) (+ ?a n)))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1445 (setq message-caesar-translation-table
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1446 (message-make-caesar-translation-table n)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1447 ;; Then we translate the region. Do it this way to retain
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 ;; text properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 (while (< b e)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1450 (subst-char-in-region
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 b (1+ b) (char-after b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 (aref message-caesar-translation-table (char-after b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (incf b))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1455 (defun message-make-caesar-translation-table (n)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1456 "Create a rot table with offset N."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1457 (let ((i -1)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1458 (table (make-string 256 0)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1459 (while (< (incf i) 256)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1460 (aset table i i))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1461 (concat
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1462 (substring table 0 ?A)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1463 (substring table (+ ?A n) (+ ?A n (- 26 n)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1464 (substring table ?A (+ ?A n))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1465 (substring table (+ ?A 26) ?a)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1466 (substring table (+ ?a n) (+ ?a n (- 26 n)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1467 (substring table ?a (+ ?a n))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1468 (substring table (+ ?a 26) 255))))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1469
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (defun message-caesar-buffer-body (&optional rotnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 "Caesar rotates all letters in the current buffer by 13 places.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 Used to encode/decode possibly offensive messages (commonly in net.jokes).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 With prefix arg, specifies the number of places to rotate each letter forward.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 Mail and USENET news headers are not rotated."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 (interactive (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (list (prefix-numeric-value current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 (list nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 (when (message-goto-body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 (narrow-to-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (message-caesar-region (point-min) (point-max) rotnum))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1484 (defun message-pipe-buffer-body (program)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1485 "Pipe the message body in the current buffer through PROGRAM."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1486 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1487 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1488 (when (message-goto-body)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1489 (narrow-to-region (point) (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1490 (let ((body (buffer-substring (point-min) (point-max))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1491 (unless (equal 0 (call-process-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1492 (point-min) (point-max) program t t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1493 (insert body)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1494 (message "%s failed." program))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1495
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (defun message-rename-buffer (&optional enter-string)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1497 "Rename the *message* buffer to \"*message* RECIPIENT\".
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 If the function is run with a prefix, it will ask for a new buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 name, rather than giving an automatic name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 (interactive "Pbuffer name: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1504 (narrow-to-region (point)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (search-forward mail-header-separator nil 'end))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1506 (let* ((mail-to (or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1507 (if (message-news-p) (message-fetch-field "Newsgroups")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1508 (message-fetch-field "To"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1509 ""))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 (mail-trimmed-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 (if (string-match "," mail-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 (concat (substring mail-to 0 (match-beginning 0)) ", ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 mail-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 (name-default (concat "*message* " mail-trimmed-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 (name (if enter-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (read-string "New buffer name: " name-default)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1517 name-default))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1518 (default-directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1519 (file-name-as-directory message-autosave-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1520 (rename-buffer name t)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (defun message-fill-yanked-message (&optional justifyp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 "Fill the paragraphs of a message yanked into this one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 Numeric argument means justify as well."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 (search-forward (concat "\n" mail-header-separator "\n") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 (let ((fill-prefix message-yank-prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 (fill-individual-paragraphs (point) (point-max) justifyp t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 (defun message-indent-citation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 "Modify text just inserted from a message to be cited.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 The inserted text should be the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 When this function returns, the region is again around the modified text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 Normally, indent each nonblank line `message-indentation-spaces' spaces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 However, if `message-yank-prefix' is non-nil, insert that prefix on each line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 ;; Remove unwanted headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 (when message-ignored-cited-headers
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1542 (let (all-removed)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1543 (save-restriction
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1544 (narrow-to-region
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1545 (goto-char start)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1546 (if (search-forward "\n\n" nil t)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1547 (1- (point))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1548 (point)))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1549 (message-remove-header message-ignored-cited-headers t)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1550 (when (= (point-min) (point-max))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1551 (setq all-removed t))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1552 (goto-char (point-max)))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1553 (if all-removed
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1554 (goto-char start)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
1555 (forward-line 1))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1556 ;; Delete blank lines at the start of the buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1557 (while (and (point-min)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1558 (eolp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1559 (not (eobp)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1560 (message-delete-line))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1561 ;; Delete blank lines at the end of the buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1562 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1563 (unless (eolp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1564 (insert "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1565 (while (and (zerop (forward-line -1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1566 (looking-at "$"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1567 (message-delete-line))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ;; Do the indentation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 (if (null message-yank-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 (indent-rigidly start (mark t) message-indentation-spaces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 (while (< (point) (mark t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 (insert message-yank-prefix)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1575 (forward-line 1))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1576 (goto-char start)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 (defun message-yank-original (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 "Insert the message being replied to, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 Puts point before the text and mark after.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 Normally indents each nonblank line ARG spaces (default 3). However,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 if `message-yank-prefix' is non-nil, insert that prefix on each line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1584 This function uses `message-cite-function' to do the actual citing.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1585
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 Just \\[universal-argument] as argument means don't indent, insert no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 prefix, and don't delete any headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 (let ((modified (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 (when (and message-reply-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 message-cite-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 (delete-windows-on message-reply-buffer t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 (insert-buffer message-reply-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 (funcall message-cite-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 (message-exchange-point-and-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (unless (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 (unless modified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (setq message-checksum (cons (message-checksum) (buffer-size)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1601 (defun message-cite-original ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1602 "Cite function in the standard Message manner."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 (let ((start (point))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1604 (functions
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 (when message-indent-citation-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 (if (listp message-indent-citation-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 message-indent-citation-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (list message-indent-citation-function)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 (while functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (funcall (pop functions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 (when message-citation-line-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (unless (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 (funcall message-citation-line-function))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 (defun message-insert-citation-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 "Function that inserts a simple citation line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (when message-reply-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (insert (mail-header-from message-reply-headers) " writes:\n\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 (defun message-position-on-field (header &rest afters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 (progn
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1628 (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 (concat "^" (regexp-quote mail-header-separator) "$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (if (re-search-forward (concat "^" (regexp-quote header) ":") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 (re-search-forward "^[^ \t]" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 (skip-chars-backward "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 (while (and afters
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1639 (not (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 (concat "^" (regexp-quote (car afters)) ":")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 (pop afters))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 (when afters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (re-search-forward "^[^ \t]" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (beginning-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 (insert header ": \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (defun message-remove-signature ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 "Remove the signature from the text between point and mark.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 The text will also be indented the normal way."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 (let ((start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 mark)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1656 (if (not (re-search-forward message-signature-separator (mark t) t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1657 ;; No signature here, so we just indent the cited text.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1658 (message-indent-citation)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1659 ;; Find the last non-empty line.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1660 (forward-line -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1661 (while (looking-at "[ \t]*$")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1662 (forward-line -1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1663 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1664 (setq mark (set-marker (make-marker) (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1665 (goto-char start)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 (message-indent-citation)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1667 ;; Enable undoing the deletion.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1668 (undo-boundary)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1669 (delete-region mark (mark t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1670 (set-marker mark nil)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 ;;; Sending messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 (defun message-send-and-exit (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 "Send message like `message-send', then, if no errors, exit from mail buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (let ((buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 (actions message-exit-actions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 (when (and (message-send arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 (buffer-name buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 (if message-kill-buffer-on-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (kill-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 (bury-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (when (eq buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (message-bury buf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (message-do-actions actions))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 (defun message-dont-send ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 "Don't send the message you have been editing."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 (interactive)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1695 (let ((actions message-postpone-actions))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1696 (message-bury (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1697 (message-do-actions actions)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 (defun message-kill-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 "Kill the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (interactive)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1702 (when (or (not (buffer-modified-p))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1703 (yes-or-no-p "Message modified; kill anyway? "))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1704 (let ((actions message-kill-actions))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1705 (kill-buffer (current-buffer))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1706 (message-do-actions actions))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 (defun message-bury (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 "Bury this mail buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 (let ((newbuf (other-buffer buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 (bury-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 (if (and (fboundp 'frame-parameters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 (cdr (assq 'dedicated (frame-parameters)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 (not (null (delq (selected-frame) (visible-frame-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (delete-frame (selected-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 (switch-to-buffer newbuf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 (defun message-send (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 "Send the message in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 If `message-interactive' is non-nil, wait for success indication
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 or error messages, and inform user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 Otherwise any failure is reported in a message back to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 the user from the mailer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 (when (if buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (y-or-n-p (format "Send buffer contents as %s message? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 (if (message-mail-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 (if (message-news-p) "mail and news" "mail")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 "news")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (or (buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 (y-or-n-p "No changes in the buffer; really send? ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 ;; Make it possible to undo the coming changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 (undo-boundary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 (let ((inhibit-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 (put-text-property (point-min) (point-max) 'read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 (message-fix-before-sending)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (run-hooks 'message-send-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 (message "Sending...")
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1739 (let ((alist message-send-method-alist)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1740 (success t)
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1741 elem sent)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1742 (while (and success
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1743 (setq elem (pop alist)))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1744 (when (and (or (not (funcall (cadr elem)))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1745 (and (or (not (memq (car elem)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1746 message-sent-message-via))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1747 (y-or-n-p
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1748 (format
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1749 "Already sent message via %s; resend? "
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1750 (car elem))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1751 (setq success (funcall (caddr elem) arg)))))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1752 (setq sent t)))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1753 (when (and success sent)
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1754 (message-do-fcc)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1755 ;;(when (fboundp 'mail-hist-put-headers-into-history)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1756 ;; (mail-hist-put-headers-into-history))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1757 (run-hooks 'message-sent-hook)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1758 (message "Sending...done")
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1759 ;; If buffer has no file, mark it as unmodified and delete autosave.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1760 (unless buffer-file-name
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1761 (set-buffer-modified-p nil)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1762 (delete-auto-save-file-if-necessary t))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1763 ;; Delete other mail buffers and stuff.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1764 (message-do-send-housekeeping)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1765 (message-do-actions message-send-actions)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1766 ;; Return success.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1767 t))))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1768
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1769 (defun message-send-via-mail (arg)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1770 "Send the current message via mail."
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1771 (message-send-mail arg))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1772
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1773 (defun message-send-via-news (arg)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1774 "Send the current message via news."
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1775 (funcall message-send-news-function arg))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (defun message-fix-before-sending ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 "Do various things to make the message nice before sending it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 ;; Make sure there's a newline at the end of the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 (unless (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 (insert "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (defun message-add-action (action &rest types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 "Add ACTION to be performed when doing an exit of type TYPES."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 (let (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 (while types
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (set (setq var (intern (format "message-%s-actions" (pop types))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (nconc (symbol-value var) (list action))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (defun message-do-actions (actions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 "Perform all actions in ACTIONS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 ;; Now perform actions on successful sending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (while actions
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1795 (ignore-errors
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1796 (cond
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1797 ;; A simple function.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1798 ((message-functionp (car actions))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1799 (funcall (car actions)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1800 ;; Something to be evaled.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1801 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1802 (eval (car actions)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (pop actions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 (defun message-send-mail (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 (require 'mail-utils)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1807 (let ((tembuf (message-generate-new-buffer-clone-locals " message temp"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 (news (message-news-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (mailbuf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 ;; Insert some headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 (let ((message-deletable-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (if news nil message-deletable-headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 (message-generate-headers message-required-mail-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 ;; Let the user do all of the above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (run-hooks 'message-header-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 (set-buffer tembuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 (erase-buffer)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1823 ;; Avoid copying text props.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1824 (insert (format
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1825 "%s" (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1826 (set-buffer mailbuf)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1827 (buffer-string))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 ;; Remove some headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 ;; Remove some headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (message-remove-header message-ignored-mail-headers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 ;; require one newline at the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (or (= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (when (and news
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (or (message-fetch-field "cc")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (message-fetch-field "to")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (message-insert-courtesy-copy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (funcall message-send-mail-function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (kill-buffer tembuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 (set-buffer mailbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (push 'mail message-sent-message-via)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (defun message-send-mail-with-sendmail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 "Send off the prepared buffer with sendmail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 (let ((errbuf (if message-interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 (generate-new-buffer " sendmail errors")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 resend-to-addresses delimline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 (setq resend-to-addresses (message-fetch-field "resent-to")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 ;; Change header-delimiter to be what sendmail expects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 (concat "^" (regexp-quote mail-header-separator) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 (replace-match "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 (backward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 (setq delimline (point-marker))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1863 (run-hooks 'message-send-mail-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 ;; Insert an extra newline if we need it to work around
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 ;; Sun's bug that swallows newlines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 (goto-char (1+ delimline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (when (eval message-mailer-swallows-blank-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 (newline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 (when message-interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 (set-buffer errbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 (erase-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (let ((default-directory "/"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (apply 'call-process-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 (append (list (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (if (boundp 'sendmail-program)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 sendmail-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 "/usr/lib/sendmail")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 nil errbuf nil "-oi")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 ;; Always specify who from,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 ;; since some systems have broken sendmails.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1882 ;; But some systems are more broken with -f, so
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1883 ;; we'll let users override this.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1884 (if (null message-sendmail-f-is-evil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1885 (list "-f" (user-login-name)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 ;; These mean "report errors by mail"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 ;; and "deliver in background".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (if (null message-interactive) '("-oem" "-odb"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 ;; Get the addresses from the message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 ;; unless this is a resend.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 ;; We must not do that for a resend
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 ;; because we would find the original addresses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 ;; For a resend, include the specific addresses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 (if resend-to-addresses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (list resend-to-addresses)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 '("-t")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (when message-interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (set-buffer errbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 (while (re-search-forward "\n\n* *" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 (replace-match "; "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 (if (not (zerop (buffer-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 (error "Sending...failed to %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 (buffer-substring (point-min) (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 (when (bufferp errbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 (kill-buffer errbuf)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1909 (defun message-send-mail-with-qmail ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1910 "Pass the prepared message buffer to qmail-inject.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1911 Refer to the documentation for the variable `message-send-mail-function'
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1912 to find out how to use this."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1913 ;; replace the header delimiter with a blank line
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1914 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1915 (re-search-forward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1916 (concat "^" (regexp-quote mail-header-separator) "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1917 (replace-match "\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1918 (run-hooks 'message-send-mail-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1919 ;; send the message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1920 (case
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1921 (apply
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1922 'call-process-region 1 (point-max) message-qmail-inject-program
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1923 nil nil nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1924 ;; qmail-inject's default behaviour is to look for addresses on the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1925 ;; command line; if there're none, it scans the headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1926 ;; yes, it does The Right Thing w.r.t. Resent-To and it's kin.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1927 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1928 ;; in general, ALL of qmail-inject's defaults are perfect for simply
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1929 ;; reading a formatted (i. e., at least a To: or Resent-To header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1930 ;; message from stdin.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1931 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1932 ;; qmail also has the advantage of not having been raped by
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1933 ;; various vendors, so we don't have to allow for that, either --
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1934 ;; compare this with message-send-mail-with-sendmail and weep
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1935 ;; for sendmail's lost innocence.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1936 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1937 ;; all this is way cool coz it lets us keep the arguments entirely
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1938 ;; free for -inject-arguments -- a big win for the user and for us
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1939 ;; since we don't have to play that double-guessing game and the user
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1940 ;; gets full control (no gestapo'ish -f's, for instance). --sj
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1941 message-qmail-inject-args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1942 ;; qmail-inject doesn't say anything on it's stdout/stderr,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1943 ;; we have to look at the retval instead
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1944 (0 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1945 (1 (error "qmail-inject reported permanent failure."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1946 (111 (error "qmail-inject reported transient failure."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1947 ;; should never happen
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1948 (t (error "qmail-inject reported unknown failure."))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1949
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (defun message-send-mail-with-mh ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 "Send the prepared message buffer with mh."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 (let ((mh-previous-window-config nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 (name (make-temp-name
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1954 (concat (file-name-as-directory
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1955 (expand-file-name message-autosave-directory))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 "msg."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 (setq buffer-file-name name)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1958 ;; MH wants to generate these headers itself.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1959 (when message-mh-deletable-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1960 (let ((headers message-mh-deletable-headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1961 (while headers
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1962 (goto-char (point-min))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1963 (and (re-search-forward
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1964 (concat "^" (symbol-name (car headers)) ": *") nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1965 (message-delete-line))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1966 (pop headers))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1967 (run-hooks 'message-send-mail-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1968 ;; Pass it on to mh.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1969 (mh-send-letter)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 (defun message-send-news (&optional arg)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1972 (let ((tembuf (message-generate-new-buffer-clone-locals " *message temp*"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 (method (if (message-functionp message-post-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 (funcall message-post-method arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 message-post-method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 (messbuf (current-buffer))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1978 (message-syntax-checks
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1979 (if arg
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1980 (cons '(existing-newsgroups . disabled)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1981 message-syntax-checks)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1982 message-syntax-checks))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 ;; Insert some headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 (message-generate-headers message-required-news-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 ;; Let the user do all of the above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 (run-hooks 'message-header-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 (message-cleanup-headers)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1991 (if (not (message-check-news-syntax))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1992 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1993 ;;(message "Posting not performed")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1994 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 (set-buffer tembuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 (buffer-disable-undo (current-buffer))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1999 (erase-buffer)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2000 ;; Avoid copying text props.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2001 (insert (format
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2002 "%s" (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2003 (set-buffer messbuf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2004 (buffer-string))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 ;; Remove some headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 ;; Remove some headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 (message-remove-header message-ignored-news-headers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 ;; require one newline at the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 (or (= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 (let ((case-fold-search t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2015 ;; Remove the delimiter.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 (concat "^" (regexp-quote mail-header-separator) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 (replace-match "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 (backward-char 1))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2021 (run-hooks 'message-send-news-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 (require (car method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 (funcall (intern (format "%s-open-server" (car method)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 (cadr method) (cddr method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 (setq result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 (funcall (intern (format "%s-request-post" (car method))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 (kill-buffer tembuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 (set-buffer messbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 (if result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 (push 'news message-sent-message-via)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 (message "Couldn't send message via news: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 (nnheader-get-report (car method)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 ;;; Header generation & syntax checking.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2039 (defmacro message-check (type &rest forms)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2040 "Eval FORMS if TYPE is to be checked."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2041 `(or (message-check-element ,type)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 (save-excursion
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2043 ,@forms)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2044
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2045 (put 'message-check 'lisp-indent-function 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2046 (put 'message-check 'edebug-form-spec '(form body))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 (defun message-check-element (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 "Returns non-nil if this type is not to be checked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 (if (eq message-syntax-checks 'dont-check-for-anything-just-trust-me)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 (let ((able (assq type message-syntax-checks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 (and (consp able)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 (eq (cdr able) 'disabled)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2056 (defun message-check-news-syntax ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2057 "Check the syntax of the message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2058 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2059 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2060 (widen)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2061 (and
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2062 ;; We narrow to the headers and check them first.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2063 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2064 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2065 (message-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2066 (message-check-news-header-syntax)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2067 ;; Check the body.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2068 (message-check-news-body-syntax)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2069
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2070 (defun message-check-news-header-syntax ()
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2071 (and
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2072 ;; Check the Subject header.
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2073 (message-check 'subject
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2074 (let* ((case-fold-search t)
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2075 (subject (message-fetch-field "subject")))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2076 (or
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2077 (and subject
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2078 (not (string-match "\\`[ \t]*\\'" subject)))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2079 (ignore
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2080 (message
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2081 "The subject field is empty or missing. Posting is denied.")))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2082 ;; Check for commands in Subject.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2083 (message-check 'subject-cmsg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2084 (if (string-match "^cmsg " (message-fetch-field "subject"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2085 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2086 "The control code \"cmsg\" is in the subject. Really post? ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2087 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2088 ;; Check for multiple identical headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2089 (message-check 'multiple-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2090 (let (found)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2091 (while (and (not found)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2092 (re-search-forward "^[^ \t:]+: " nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2093 (save-excursion
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2094 (or (re-search-forward
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2095 (concat "^"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2096 (regexp-quote
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2097 (setq found
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2098 (buffer-substring
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2099 (match-beginning 0) (- (match-end 0) 2))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2100 ":")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2101 nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2102 (setq found nil))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2103 (if found
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2104 (y-or-n-p (format "Multiple %s headers. Really post? " found))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2105 t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2106 ;; Check for Version and Sendsys.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2107 (message-check 'sendsys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2108 (if (re-search-forward "^Sendsys:\\|^Version:" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2109 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2110 (format "The article contains a %s command. Really post? "
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2111 (buffer-substring (match-beginning 0)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2112 (1- (match-end 0)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2113 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2114 ;; See whether we can shorten Followup-To.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2115 (message-check 'shorten-followup-to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2116 (let ((newsgroups (message-fetch-field "newsgroups"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2117 (followup-to (message-fetch-field "followup-to"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2118 to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2119 (when (and newsgroups
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2120 (string-match "," newsgroups)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2121 (not followup-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2122 (not
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2123 (zerop
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2124 (length
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2125 (setq to (completing-read
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2126 "Followups to: (default all groups) "
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2127 (mapcar (lambda (g) (list g))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2128 (cons "poster"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2129 (message-tokenize-header
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2130 newsgroups)))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2131 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2132 (insert "Followup-To: " to "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2133 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2134 ;; Check "Shoot me".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2135 (message-check 'shoot
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2136 (if (re-search-forward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2137 "Message-ID.*.i-did-not-set--mail-host-address--so-shoot-me" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2138 (y-or-n-p "You appear to have a misconfigured system. Really post? ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2139 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2140 ;; Check for Approved.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2141 (message-check 'approved
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2142 (if (re-search-forward "^Approved:" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2143 (y-or-n-p "The article contains an Approved header. Really post? ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2144 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2145 ;; Check the Message-ID header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2146 (message-check 'message-id
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2147 (let* ((case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2148 (message-id (message-fetch-field "message-id" t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2149 (or (not message-id)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2150 (and (string-match "@" message-id)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2151 (string-match "@[^\\.]*\\." message-id))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2152 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2153 (format "The Message-ID looks strange: \"%s\". Really post? "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2154 message-id)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2155 ;; Check the Newsgroups & Followup-To headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2156 (message-check 'existing-newsgroups
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2157 (let* ((case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2158 (newsgroups (message-fetch-field "newsgroups"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2159 (followup-to (message-fetch-field "followup-to"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2160 (groups (message-tokenize-header
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2161 (if followup-to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2162 (concat newsgroups "," followup-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2163 newsgroups)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2164 (hashtb (and (boundp 'gnus-active-hashtb)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2165 gnus-active-hashtb))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2166 errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2167 (if (or (not hashtb)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2168 (not (boundp 'gnus-read-active-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2169 (not gnus-read-active-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2170 (eq gnus-read-active-file 'some))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2171 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2172 (while groups
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2173 (when (and (not (boundp (intern (car groups) hashtb)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2174 (not (equal (car groups) "poster")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2175 (push (car groups) errors))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2176 (pop groups))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2177 (if (not errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2178 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2179 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2180 (format
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2181 "Really post to %s unknown group%s: %s "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2182 (if (= (length errors) 1) "this" "these")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2183 (if (= (length errors) 1) "" "s")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2184 (mapconcat 'identity errors ", ")))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2185 ;; Check the Newsgroups & Followup-To headers for syntax errors.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2186 (message-check 'valid-newsgroups
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2187 (let ((case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2188 (headers '("Newsgroups" "Followup-To"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2189 header error)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2190 (while (and headers (not error))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2191 (when (setq header (mail-fetch-field (car headers)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2192 (if (or
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2193 (not
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2194 (string-match
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2195 "\\`\\([-+_&.a-zA-Z0-9]+\\)?\\(,[-+_&.a-zA-Z0-9]+\\)*\\'"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2196 header))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2197 (memq
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2198 nil (mapcar
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2199 (lambda (g)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2200 (not (string-match "\\.\\'\\|\\.\\." g)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2201 (message-tokenize-header header ","))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2202 (setq error t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2203 (unless error
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2204 (pop headers)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2205 (if (not error)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2206 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2207 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2208 (format "The %s header looks odd: \"%s\". Really post? "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2209 (car headers) header)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2210 ;; Check the From header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2211 (message-check 'from
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2212 (let* ((case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2213 (from (message-fetch-field "from"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2214 (ad (nth 1 (mail-extract-address-components from))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2215 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2216 ((not from)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2217 (message "There is no From line. Posting is denied.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2218 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2219 ((or (not (string-match "@[^\\.]*\\." ad)) ;larsi@ifi
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2220 (string-match "\\.\\." ad) ;larsi@ifi..uio
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2221 (string-match "@\\." ad) ;larsi@.ifi.uio
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2222 (string-match "\\.$" ad) ;larsi@ifi.uio.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2223 (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2224 (string-match "(.*).*(.*)" from)) ;(lars) (lars)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2225 (message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2226 "Denied posting -- the From looks strange: \"%s\"." from)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2227 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2228 (t t))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2229
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2230 (defun message-check-news-body-syntax ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2231 (and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2232 ;; Check for long lines.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2233 (message-check 'long-lines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2234 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2235 (re-search-forward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2236 (concat "^" (regexp-quote mail-header-separator) "$"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2237 (while (and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2238 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2239 (end-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2240 (< (current-column) 80))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2241 (zerop (forward-line 1))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2242 (or (bolp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2243 (eobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2244 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2245 "You have lines longer than 79 characters. Really post? ")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2246 ;; Check whether the article is empty.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2247 (message-check 'empty
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2248 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2249 (re-search-forward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2250 (concat "^" (regexp-quote mail-header-separator) "$"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2251 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2252 (let ((b (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2253 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2254 (re-search-backward message-signature-separator nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2255 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2256 (or (re-search-backward "[^ \n\t]" b t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2257 (y-or-n-p "Empty article. Really post? "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2258 ;; Check for control characters.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2259 (message-check 'control-chars
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2260 (if (re-search-forward "[\000-\007\013\015-\037\200-\237]" nil t)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2261 (y-or-n-p
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2262 "The article contains control characters. Really post? ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2263 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2264 ;; Check excessive size.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2265 (message-check 'size
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2266 (if (> (buffer-size) 60000)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2267 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2268 (format "The article is %d octets long. Really post? "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2269 (buffer-size)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2270 t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2271 ;; Check whether any new text has been added.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2272 (message-check 'new-text
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2273 (or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2274 (not message-checksum)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2275 (not (and (eq (message-checksum) (car message-checksum))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2276 (eq (buffer-size) (cdr message-checksum))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2277 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2278 "It looks like no new text has been added. Really post? ")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2279 ;; Check the length of the signature.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2280 (message-check 'signature
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2281 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2282 (if (or (not (re-search-backward message-signature-separator nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2283 (search-forward message-forward-end-separator nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2284 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2285 (if (> (count-lines (point) (point-max)) 5)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2286 (y-or-n-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2287 (format
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2288 "Your .sig is %d lines; it should be max 4. Really post? "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2289 (1- (count-lines (point) (point-max)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2290 t)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2291
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 (defun message-checksum ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 "Return a \"checksum\" for the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 (let ((sum 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 (concat "^" (regexp-quote mail-header-separator) "$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 (when (not (looking-at "[ \t\n]"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (setq sum (logxor (ash sum 1) (following-char))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 (forward-char 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 sum))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 (defun message-do-fcc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 "Process Fcc headers in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 (buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 list file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 (set-buffer (get-buffer-create " *message temp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 (insert-buffer-substring buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317 (while (setq file (message-fetch-field "fcc"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 (push file list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 (message-remove-header "fcc" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 (replace-match "" t t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 ;; Process FCC operations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 (setq file (pop list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 ;; Pipe the article to the program in question.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328 (call-process-region (point-min) (point-max) shell-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 nil nil nil shell-command-switch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 (match-string 1 file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 ;; Save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 (setq file (expand-file-name file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 (unless (file-exists-p (file-name-directory file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334 (make-directory (file-name-directory file) t))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2335 (if (and message-fcc-handler-function
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2336 (not (eq message-fcc-handler-function 'rmail-output)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2337 (funcall message-fcc-handler-function file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2338 (if (and (file-readable-p file) (mail-file-babyl-p file))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2339 (rmail-output file 1 nil t)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2340 (let ((mail-use-rfc822 t))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
2341 (rmail-output file 1 t t))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2342
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2345 (defun message-output (filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2346 "Append this article to Unix/babyl mail file.."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2347 (if (and (file-readable-p filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2348 (mail-file-babyl-p filename))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2349 (gnus-output-to-rmail filename t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2350 (gnus-output-to-mail filename t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2351
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 (defun message-cleanup-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 "Do various automatic cleanups of the headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 ;; Remove empty lines in the header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 (while (re-search-forward "^[ \t]*\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 (replace-match "" t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 ;; Correct Newsgroups and Followup-To headers: change sequence of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 ;; spaces to comma and eliminate spaces around commas. Eliminate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 ;; embedded line breaks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 (while (re-search-forward "^\\(Newsgroups\\|Followup-To\\): +" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 (if (re-search-forward "^[^ \t]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 (while (re-search-forward "\n[ \t]+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 (replace-match " " t t)) ;No line breaks (too confusing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 (while (re-search-forward "[ \t\n]*,[ \t\n]*\\|[ \t]+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 (replace-match "," t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379 ;; Remove trailing commas.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 (when (re-search-forward ",+$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 (replace-match "" t t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 (defun message-make-date ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384 "Make a valid data header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385 (let ((now (current-time)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2386 (timezone-make-date-arpa-standard
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 (current-time-string now) (current-time-zone now))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 (defun message-make-message-id ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 "Make a unique Message-ID."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2391 (concat "<" (message-unique-id)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 (let ((psubject (save-excursion (message-fetch-field "subject"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 (if (and message-reply-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 (mail-header-references message-reply-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 (mail-header-subject message-reply-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 psubject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 (mail-header-subject message-reply-headers)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2398 (not (string=
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 (message-strip-subject-re
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 (mail-header-subject message-reply-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 (message-strip-subject-re psubject))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 "_-_" ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 "@" (message-make-fqdn) ">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 (defvar message-unique-id-char nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 ;; If you ever change this function, make sure the new version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 ;; cannot generate IDs that the old version could.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 ;; You might for example insert a "." somewhere (not next to another dot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 ;; or string boundary), or modify the "fsf" string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411 (defun message-unique-id ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 ;; Don't use microseconds from (current-time), they may be unsupported.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 ;; Instead we use this randomly inited counter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 (setq message-unique-id-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 (% (1+ (or message-unique-id-char (logand (random t) (1- (lsh 1 20)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 ;; (current-time) returns 16-bit ints,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 ;; and 2^16*25 just fits into 4 digits i base 36.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 (* 25 25)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 (let ((tm (current-time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 (if (memq system-type '(ms-dos emx vax-vms))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 (let ((user (downcase (user-login-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 (while (string-match "[^a-z0-9_]" user)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 (aset user (match-beginning 0) ?_))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 user)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 (message-number-base36 (user-uid) -1))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2427 (message-number-base36 (+ (car tm)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 (lsh (% message-unique-id-char 25) 16)) 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 (message-number-base36 (+ (nth 1 tm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 (lsh (/ message-unique-id-char 25) 16)) 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 ;; Append the newsreader name, because while the generated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 ;; ID is unique to this newsreader, other newsreaders might
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 ;; otherwise generate the same ID via another algorithm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 ".fsf")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 (defun message-number-base36 (num len)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2437 (if (if (< len 0)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2438 (<= num 0)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2439 (= len 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 (concat (message-number-base36 (/ num 36) (1- len))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 (char-to-string (aref "zyxwvutsrqponmlkjihgfedcba9876543210"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 (% num 36))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 (defun message-make-organization ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 "Make an Organization header."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2447 (let* ((organization
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 (or (getenv "ORGANIZATION")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 (when message-user-organization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450 (if (message-functionp message-user-organization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 (funcall message-user-organization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 message-user-organization)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 (message-set-work-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455 (cond ((stringp organization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 (insert organization))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 ((and (eq t organization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 message-user-organization-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 (file-exists-p message-user-organization-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 (insert-file-contents message-user-organization-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 (while (re-search-forward "[\t\n]+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 (replace-match "" t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 (unless (zerop (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 (buffer-string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 (defun message-make-lines ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 "Count the number of lines and return numeric string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2473 (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 (concat "^" (regexp-quote mail-header-separator) "$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 (int-to-string (count-lines (point) (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 (defun message-make-in-reply-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 "Return the In-Reply-To header for this message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 (when message-reply-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 (let ((from (mail-header-from message-reply-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 (date (mail-header-date message-reply-headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 (when from
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2484 (let ((stop-pos
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 (string-match " *at \\| *@ \\| *(\\| *<" from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 (concat (if stop-pos (substring from 0 stop-pos) from)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2487 "'s message of "
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 (if (or (not date) (string= date ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 "(unknown date)" date)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 (defun message-make-distribution ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 "Make a Distribution header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 (let ((orig-distribution (message-fetch-reply-field "distribution")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 (cond ((message-functionp message-distribution-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 (funcall message-distribution-function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 (t orig-distribution))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 (defun message-make-expires ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 "Return an Expires header based on `message-expires'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 (let ((current (current-time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 (future (* 1.0 message-expires 60 60 24)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 ;; Add the future to current.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503 (setcar current (+ (car current) (round (/ future (expt 2 16)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 (setcar (cdr current) (+ (nth 1 current) (% (round future) (expt 2 16))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 ;; Return the date in the future in UT.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2506 (timezone-make-date-arpa-standard
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 (current-time-string current) (current-time-zone current) '(0 "UT"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 (defun message-make-path ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 "Return uucp path."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 (let ((login-name (user-login-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 (cond ((null message-user-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 (concat (system-name) "!" login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514 ((stringp message-user-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515 ;; Support GENERICPATH. Suggested by vixie@decwrl.dec.com.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 (concat message-user-path "!" login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 (t login-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519 (defun message-make-from ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520 "Make a From header."
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
2521 (let* ((style message-from-style)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
2522 (login (message-make-address))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2523 (fullname
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524 (or (and (boundp 'user-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 user-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 (user-full-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 (when (string= fullname "&")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528 (setq fullname (user-login-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 (message-set-work-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2531 (cond
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
2532 ((or (null style)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 (equal fullname ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 (insert login))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
2535 ((or (eq style 'angles)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
2536 (and (not (eq style 'parens))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 ;; Use angles if no quoting is needed, or if parens would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538 ;; need quoting too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 (or (not (string-match "[^- !#-'*+/-9=?A-Z^-~]" fullname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 (let ((tmp (concat fullname nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 (while (string-match "([^()]*)" tmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 (aset tmp (match-beginning 0) ?-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 (aset tmp (1- (match-end 0)) ?-))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 (string-match "[\\()]" tmp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 (insert fullname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 ;; Look for a character that cannot appear unquoted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 ;; according to RFC 822.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 (when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 ;; Quote fullname, escaping specials.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552 (insert "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 (while (re-search-forward "[\"\\]" nil 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554 (replace-match "\\\\\\&" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 (insert "\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 (insert " <" login ">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 (t ; 'parens or default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558 (insert login " (")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 (let ((fullname-start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560 (insert fullname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561 (goto-char fullname-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 ;; RFC 822 says \ and nonmatching parentheses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 ;; must be escaped in comments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564 ;; Escape every instance of ()\ ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565 (while (re-search-forward "[()\\]" nil 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566 (replace-match "\\\\\\&" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 ;; ... then undo escaping of matching parentheses,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 ;; including matching nested parentheses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 (goto-char fullname-start)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2570 (while (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2572 nil 1)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 (replace-match "\\1(\\3)" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 (goto-char fullname-start)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 (insert ")")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576 (buffer-string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 (defun message-make-sender ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 "Return the \"real\" user address.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2580 This function tries to ignore all user modifications, and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 give as trustworthy answer as possible."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 (concat (user-login-name) "@" (system-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 (defun message-make-address ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585 "Make the address of the user."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 (or (message-user-mail-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587 (concat (user-login-name) "@" (message-make-domain))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 (defun message-user-mail-address ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 "Return the pertinent part of `user-mail-address'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 (when user-mail-address
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2592 (if (string-match " " user-mail-address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2593 (nth 1 (mail-extract-address-components user-mail-address))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2594 user-mail-address)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 (defun message-make-fqdn ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 "Return user's fully qualified domain name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 (let ((system-name (system-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599 (user-mail (message-user-mail-address)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2600 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 ((string-match "[^.]\\.[^.]" system-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 ;; `system-name' returned the right result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603 system-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 ;; Try `mail-host-address'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 ((and (boundp 'mail-host-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 (stringp mail-host-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 (string-match "\\." mail-host-address))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 mail-host-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 ;; We try `user-mail-address' as a backup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610 ((and (string-match "\\." user-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 (string-match "@\\(.*\\)\\'" user-mail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 (match-string 1 user-mail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613 ;; Default to this bogus thing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2615 (concat system-name ".i-did-not-set--mail-host-address--so-shoot-me")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617 (defun message-make-host-name ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618 "Return the name of the host."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619 (let ((fqdn (message-make-fqdn)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 (string-match "^[^.]+\\." fqdn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621 (substring fqdn 0 (1- (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 (defun message-make-domain ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 "Return the domain name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 (or mail-host-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 (message-make-fqdn)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 (defun message-generate-headers (headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629 "Prepare article HEADERS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 Headers already prepared in the buffer are not modified."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633 (let* ((Date (message-make-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 (Message-ID (message-make-message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635 (Organization (message-make-organization))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 (From (message-make-from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 (Path (message-make-path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638 (Subject nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 (Newsgroups nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 (In-Reply-To (message-make-in-reply-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 (To nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 (Distribution (message-make-distribution))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643 (Lines (message-make-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644 (X-Newsreader message-newsreader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 (X-Mailer (and (not (message-fetch-field "X-Newsreader"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 message-mailer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 (Expires (message-make-expires))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 header value elem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 ;; First we remove any old generated headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651 (let ((headers message-deletable-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652 (while headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2654 (and (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 (concat "^" (symbol-name (car headers)) ": *") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656 (get-text-property (1+ (match-beginning 0)) 'message-deletable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 (message-delete-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 (pop headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 ;; Go through all the required headers and see if they are in the
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2660 ;; articles already. If they are not, or are empty, they are
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 ;; inserted automatically - except for Subject, Newsgroups and
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2662 ;; Distribution.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 (while headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 (setq elem (pop headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 (if (consp elem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 (if (eq (car elem) 'optional)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668 (setq header (cdr elem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 (setq header (car elem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670 (setq header elem))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2671 (when (or (not (re-search-forward
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2672 (concat "^" (downcase (symbol-name header)) ":")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 (progn
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2675 ;; The header was found. We insert a space after the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 ;; colon, if there is none.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 (if (/= (following-char) ? ) (insert " ") (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 ;; Find out whether the header is empty...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 (looking-at "[ \t]*$")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680 ;; So we find out what value we should insert.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 (setq value
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2682 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 ((and (consp elem) (eq (car elem) 'optional))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684 ;; This is an optional header. If the cdr of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 ;; is something that is nil, then we do not insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 ;; this header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 (setq header (cdr elem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 (or (and (fboundp (cdr elem)) (funcall (cdr elem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689 (and (boundp (cdr elem)) (symbol-value (cdr elem)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 ((consp elem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 ;; The element is a cons. Either the cdr is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692 ;; string to be inserted verbatim, or it is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693 ;; function, and we insert the value returned from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694 ;; this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 (or (and (stringp (cdr elem)) (cdr elem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696 (and (fboundp (cdr elem)) (funcall (cdr elem)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697 ((and (boundp header) (symbol-value header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698 ;; The element is a symbol. We insert the value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 ;; of this symbol, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700 (symbol-value header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702 ;; We couldn't generate a value for this header,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 ;; so we just ask the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 (read-from-minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 (format "Empty header for %s; enter value: " header)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 ;; Finally insert the header.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2707 (when (and value
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 (not (equal value "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 (if (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 ;; This header didn't exist, so we insert it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714 (insert (symbol-name header) ": " value "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716 ;; The value of this header was empty, so we clear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 ;; totally and insert the new value.
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2718 (delete-region (point) (gnus-point-at-eol))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 (insert value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 ;; Add the deletable property to the headers that require it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 (and (memq header message-deletable-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 (progn (beginning-of-line) (looking-at "[^:]+: "))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2723 (add-text-properties
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 (point) (match-end 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 '(message-deletable t face italic) (current-buffer)))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2726 ;; Insert new Sender if the From is strange.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 (let ((from (message-fetch-field "from"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 (sender (message-fetch-field "sender"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729 (secure-sender (message-make-sender)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2730 (when (and from
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 (not (message-check-element 'sender))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732 (not (string=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2733 (downcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734 (cadr (mail-extract-address-components from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735 (downcase secure-sender)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 (or (null sender)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2737 (not
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 (string=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2739 (downcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 (cadr (mail-extract-address-components sender)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (downcase secure-sender)))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2742 (goto-char (point-min))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 ;; Rename any old Sender headers to Original-Sender.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2744 (when (re-search-forward "^\\(Original-\\)*Sender:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 (insert "Original-")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 (beginning-of-line))
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2748 (when (or (message-news-p)
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2749 (string-match "^[^@]@.+\\..+" secure-sender))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2750 (insert "Sender: " secure-sender "\n")))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752 (defun message-insert-courtesy-copy ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 "Insert a courtesy message in mail copies of combined messages."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2754 (let (newsgroups)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2755 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2756 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2757 (message-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2758 (when (setq newsgroups (message-fetch-field "newsgroups"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 (goto-char (point-max))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2760 (insert "Posted-To: " newsgroups "\n")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2761 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2762 (when message-courtesy-message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2763 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2764 ((string-match "%s" message-courtesy-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2765 (insert (format message-courtesy-message newsgroups)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2766 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2767 (insert message-courtesy-message)))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2768
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 ;;; Setting up a message buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 (defun message-fill-address (header value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 (narrow-to-region (point) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2776 (insert (capitalize (symbol-name header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778 (if (consp value) (car value) value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2779 "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 (narrow-to-region (point-min) (1- (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781 (let (quoted last)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2782 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2783 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2784 (skip-chars-forward "^,\"" (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785 (if (or (= (following-char) ?,)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787 (when (not quoted)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 (if (and (> (current-column) 78)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2789 last)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 (goto-char last)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2793 (insert "\n\t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794 (setq last (1+ (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2795 (setq last (1+ (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796 (setq quoted (not quoted)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 (unless (eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2798 (forward-char 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2799 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803 (defun message-fill-header (header value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804 (let ((begin (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 (fill-column 78)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806 (fill-prefix "\t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 (insert (capitalize (symbol-name header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 (if (consp value) (car value) value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810 "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812 (narrow-to-region begin (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813 (fill-region-as-paragraph begin (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 ;; Tapdance around looong Message-IDs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2816 (when (looking-at "[ \t]*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2817 (message-delete-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2818 (goto-char begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2819 (re-search-forward ":" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2820 (when (looking-at "\n[ \t]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2821 (replace-match " " t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2822 (goto-char (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2824 (defun message-position-point ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2825 "Move point to where the user probably wants to find it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 (message-narrow-to-headers)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2827 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828 ((re-search-forward "^[^:]+:[ \t]*$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829 (search-backward ":" )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2830 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2831 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2832 (if (= (following-char) ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2833 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2834 (insert " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2835 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2836 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2837 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2838 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2839 (unless (looking-at "$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2840 (forward-line 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2841 (sit-for 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2842
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2843 (defun message-buffer-name (type &optional to group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2844 "Return a new (unique) buffer name based on TYPE and TO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2845 (cond
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2846 ;; Check whether `message-generate-new-buffers' is a function,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2847 ;; and if so, call it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2848 ((message-functionp message-generate-new-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2849 (funcall message-generate-new-buffers type to group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2850 ;; Generate a new buffer name The Message Way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2851 (message-generate-new-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2852 (generate-new-buffer-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2853 (concat "*" type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2854 (if to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2855 (concat " to "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856 (or (car (mail-extract-address-components to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 to) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 (if (and group (not (string= group ""))) (concat " on " group) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 ;; Use standard name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863 (format "*%s message*" type))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 (defun message-pop-to-buffer (name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866 "Pop to buffer NAME, and warn if it already exists and is modified."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867 (let ((buffer (get-buffer name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 (if (and buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869 (buffer-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871 (set-buffer (pop-to-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872 (when (and (buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873 (not (y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874 "Message already being composed; erase? ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875 (error "Message being composed")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 (set-buffer (pop-to-buffer name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878 (message-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 (defun message-do-send-housekeeping ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 "Kill old message buffers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882 ;; We might have sent this buffer already. Delete it from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883 ;; list of buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 (setq message-buffer-list (delq (current-buffer) message-buffer-list))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2885 (while (and message-max-buffers
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2886 message-buffer-list
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2887 (>= (length message-buffer-list) message-max-buffers))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888 ;; Kill the oldest buffer -- unless it has been changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 (let ((buffer (pop message-buffer-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890 (when (and (buffer-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891 (not (buffer-modified-p buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 (kill-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2893 ;; Rename the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 (if message-send-rename-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895 (funcall message-send-rename-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2896 (when (string-match "\\`\\*" (buffer-name))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2897 (rename-buffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 (concat "*sent " (substring (buffer-name) (match-end 0))) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899 ;; Push the current buffer onto the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900 (when message-max-buffers
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2901 (setq message-buffer-list
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902 (nconc message-buffer-list (list (current-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 (defvar mc-modes-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905 (defun message-setup (headers &optional replybuffer actions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906 (when (and (boundp 'mc-modes-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2907 (not (assq 'message-mode mc-modes-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 (push '(message-mode (encrypt . mc-encrypt-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909 (sign . mc-sign-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910 mc-modes-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 (when actions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912 (setq message-send-actions actions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913 (setq message-reply-buffer replybuffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915 ;; Insert all the headers.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2916 (mail-header-format
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917 (let ((h headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2918 (alist message-header-format-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 (while h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920 (unless (assq (caar h) message-header-format-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 (push (list (caar h)) alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 (pop h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924 headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 (delete-region (point) (progn (forward-line -1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 (when message-default-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 (insert message-default-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 (put-text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 (insert mail-header-separator "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 'read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 (when (message-news-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 (when message-default-news-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937 (insert message-default-news-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 (when message-generate-headers-first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939 (message-generate-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 (delq 'Lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941 (delq 'Subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 (copy-sequence message-required-news-headers))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943 (when (message-mail-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944 (when message-default-mail-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2945 (insert message-default-mail-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 (when message-generate-headers-first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 (message-generate-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948 (delq 'Lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 (delq 'Subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 (copy-sequence message-required-mail-headers))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 (run-hooks 'message-signature-setup-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952 (message-insert-signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953 (message-set-auto-save-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2954 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2956 (run-hooks 'message-header-setup-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2957 (set-buffer-modified-p nil)
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
2958 (setq buffer-undo-list nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2959 (run-hooks 'message-setup-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2960 (message-position-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2961 (undo-boundary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2963 (defun message-set-auto-save-file-name ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964 "Associate the message buffer with a file in the drafts directory."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965 (when message-autosave-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 (unless (file-exists-p message-autosave-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 (make-directory message-autosave-directory t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 (let ((name (make-temp-name
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 110
diff changeset
2969 (expand-file-name
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents: 110
diff changeset
2970 (concat (file-name-as-directory message-autosave-directory)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
2971 "msg." (buffer-name))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 (setq buffer-auto-save-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 (set-buffer (get-buffer-create " *draft tmp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 (setq buffer-file-name name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978 (make-auto-save-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980 (clear-visited-file-modtime))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2984 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2985 ;;; Commands for interfacing with message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2988 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2989 (defun message-mail (&optional to subject
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2990 other-headers continue switch-function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2991 yank-action send-actions)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 "Start editing a mail message to be sent."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2993 (interactive)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2994 (let ((message-this-is-mail t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2995 (message-pop-to-buffer (message-buffer-name "mail" to))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2996 (message-setup
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2997 (nconc
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2998 `((To . ,(or to "")) (Subject . ,(or subject "")))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2999 (when other-headers other-headers)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 (defun message-news (&optional newsgroups subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 "Start editing a news article to be sent."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3004 (interactive)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3005 (let ((message-this-is-news t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3006 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3007 (message-setup `((Newsgroups . ,(or newsgroups ""))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3008 (Subject . ,(or subject ""))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 (defun message-reply (&optional to-address wide ignore-reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 "Start editing a reply to the article in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 (let ((cur (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 from subject date reply-to to cc
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3016 references message-id follow-to
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3017 (inhibit-point-motion-hooks t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 mct never-mct gnus-warning)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019 (save-restriction
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3020 (message-narrow-to-head)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3021 ;; Allow customizations to have their say.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3022 (if (not wide)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3023 ;; This is a regular reply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3024 (if (message-functionp message-reply-to-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3025 (setq follow-to (funcall message-reply-to-function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3026 ;; This is a followup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3027 (if (message-functionp message-wide-reply-to-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3028 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3029 (setq follow-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3030 (funcall message-wide-reply-to-function)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 ;; Find all relevant headers we need.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 (setq from (message-fetch-field "from")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3033 date (message-fetch-field "date")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 subject (or (message-fetch-field "subject") "none")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 to (message-fetch-field "to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036 cc (message-fetch-field "cc")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3037 mct (message-fetch-field "mail-copies-to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3038 reply-to (unless ignore-reply-to (message-fetch-field "reply-to"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3039 references (message-fetch-field "references")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3040 message-id (message-fetch-field "message-id" t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3041 ;; Remove any (buggy) Re:'s that are present and make a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3042 ;; proper one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3043 (when (string-match "^[ \t]*[Rr][Ee]:[ \t]*" subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3044 (setq subject (substring subject (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3045 (setq subject (concat "Re: " subject))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3047 (when (and (setq gnus-warning (message-fetch-field "gnus-warning"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3048 (string-match "<[^>]+>" gnus-warning))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3049 (setq message-id (match-string 0 gnus-warning)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3050
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3051 ;; Handle special values of Mail-Copies-To.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3052 (when mct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3053 (cond ((equal (downcase mct) "never")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3054 (setq never-mct t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3055 (setq mct nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3056 ((equal (downcase mct) "always")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3057 (setq mct (or reply-to from)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3059 (unless follow-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3060 (if (or (not wide)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3061 to-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3062 (setq follow-to (list (cons 'To (or to-address reply-to from))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3063 (let (ccalist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3064 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3065 (message-set-work-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3066 (unless never-mct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3067 (insert (or reply-to from "")))
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
3068 (insert (if to (concat (if (bolp) "" ", ") to "") ""))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3069 (insert (if mct (concat (if (bolp) "" ", ") mct) ""))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3070 (insert (if cc (concat (if (bolp) "" ", ") cc) ""))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
3071 (goto-char (point-min))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
3072 (while (re-search-forward "[ \t]+" nil t)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
3073 (replace-match " " t t))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3074 ;; Remove addresses that match `rmail-dont-reply-to-names'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3075 (insert (prog1 (rmail-dont-reply-to (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3076 (erase-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3077 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3078 ;; Perhaps Mail-Copies-To: never removed the only address?
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3079 (when (eobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3080 (insert (or reply-to from "")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3081 (setq ccalist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3082 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3083 (lambda (addr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3084 (cons (mail-strip-quoted-names addr) addr))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3085 (message-tokenize-header (buffer-string))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3086 (let ((s ccalist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3087 (while s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3088 (setq ccalist (delq (assoc (car (pop s)) s) ccalist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3089 (setq follow-to (list (cons 'To (cdr (pop ccalist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3090 (when ccalist
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3091 (let ((ccs (cons 'Cc (mapconcat
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3092 (lambda (addr) (cdr addr)) ccalist ", "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3093 (when (string-match "^ +" (cdr ccs))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3094 (setcdr ccs (substring (cdr ccs) (match-end 0))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3095 (push ccs follow-to))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3096 (widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3097
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3098 (message-pop-to-buffer (message-buffer-name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3099 (if wide "wide reply" "reply") from
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3100 (if wide to-address nil)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3102 (setq message-reply-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3103 (vector 0 subject from date message-id references 0 0 ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3105 (message-setup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3106 `((Subject . ,subject)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3107 ,@follow-to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3108 ,@(if (or references message-id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3109 `((References . ,(concat (or references "") (and references " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3110 (or message-id ""))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3111 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3112 cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3114 ;;;###autoload
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
3115 (defun message-wide-reply (&optional to-address ignore-reply-to)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3116 "Make a \"wide\" reply to the message in the current buffer."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3117 (interactive)
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
3118 (message-reply to-address t ignore-reply-to))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3120 ;;;###autoload
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3121 (defun message-followup (&optional to-newsgroups)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3122 "Follow up to the message in the current buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3123 If TO-NEWSGROUPS, use that as the new Newsgroups line."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3124 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3125 (let ((cur (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3126 from subject date reply-to mct
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3127 references message-id follow-to
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3128 (inhibit-point-motion-hooks t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3129 (message-this-is-news t)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3130 followup-to distribution newsgroups gnus-warning posted-to)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3131 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3132 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3133 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3134 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3135 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3136 (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3137 (when (message-functionp message-followup-to-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3138 (setq follow-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3139 (funcall message-followup-to-function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3140 (setq from (message-fetch-field "from")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3141 date (message-fetch-field "date")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3142 subject (or (message-fetch-field "subject") "none")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3143 references (message-fetch-field "references")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3144 message-id (message-fetch-field "message-id" t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3145 followup-to (message-fetch-field "followup-to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3146 newsgroups (message-fetch-field "newsgroups")
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3147 posted-to (message-fetch-field "posted-to")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3148 reply-to (message-fetch-field "reply-to")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3149 distribution (message-fetch-field "distribution")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3150 mct (message-fetch-field "mail-copies-to"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3151 (when (and (setq gnus-warning (message-fetch-field "gnus-warning"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3152 (string-match "<[^>]+>" gnus-warning))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3153 (setq message-id (match-string 0 gnus-warning)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3154 ;; Remove bogus distribution.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3155 (when (and (stringp distribution)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3156 (let ((case-fold-search t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3157 (string-match "world" distribution)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3158 (setq distribution nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3159 ;; Remove any (buggy) Re:'s that are present and make a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3160 ;; proper one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3161 (when (string-match "^[ \t]*[Rr][Ee]:[ \t]*" subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3162 (setq subject (substring subject (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3163 (setq subject (concat "Re: " subject))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3164 (widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3166 (message-pop-to-buffer (message-buffer-name "followup" from newsgroups))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3168 (message-setup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3169 `((Subject . ,subject)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3170 ,@(cond
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3171 (to-newsgroups
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3172 (list (cons 'Newsgroups to-newsgroups)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3173 (follow-to follow-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3174 ((and followup-to message-use-followup-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3175 (list
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3176 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3177 ((equal (downcase followup-to) "poster")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3178 (if (or (eq message-use-followup-to 'use)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3179 (message-y-or-n-p "Obey Followup-To: poster? " t "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3180 You should normally obey the Followup-To: header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3182 `Followup-To: poster' sends your response via e-mail instead of news.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3184 A typical situation where `Followup-To: poster' is used is when the poster
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3185 does not read the newsgroup, so he wouldn't see any replies sent to it."))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3186 (progn
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3187 (setq message-this-is-news nil)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3188 (cons 'To (or reply-to from "")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3189 (cons 'Newsgroups newsgroups)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3190 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3191 (if (or (equal followup-to newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3192 (not (eq message-use-followup-to 'ask))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3193 (message-y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3194 (concat "Obey Followup-To: " followup-to "? ") t "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3195 You should normally obey the Followup-To: header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3197 `Followup-To: " followup-to "'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3198 directs your response to " (if (string-match "," followup-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3199 "the specified newsgroups"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3200 "that newsgroup only") ".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3202 If a message is posted to several newsgroups, Followup-To is often
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3203 used to direct the following discussion to one newsgroup only,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3204 because discussions that are spread over several newsgroup tend to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3205 be fragmented and very difficult to follow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3206
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3207 Also, some source/announcement newsgroups are not indented for discussion;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3208 responses here are directed to other newsgroups."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3209 (cons 'Newsgroups followup-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3210 (cons 'Newsgroups newsgroups))))))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3211 (posted-to
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
3212 `((Newsgroups . ,posted-to)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3213 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3214 `((Newsgroups . ,newsgroups))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3215 ,@(and distribution (list (cons 'Distribution distribution)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3216 ,@(if (or references message-id)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3217 `((References . ,(concat (or references "") (and references " ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3218 (or message-id "")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3219 ,@(when (and mct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3220 (not (equal (downcase mct) "never")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3221 (list (cons 'Cc (if (equal (downcase mct) "always")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3222 (or reply-to from "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3223 mct)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3225 cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3227 (setq message-reply-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3228 (vector 0 subject from date message-id references 0 0 ""))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3231 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3232 (defun message-cancel-news ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3233 "Cancel an article you posted."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3234 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3235 (unless (message-news-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3236 (error "This is not a news article; canceling is impossible"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3237 (when (yes-or-no-p "Do you really want to cancel this article? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3238 (let (from newsgroups message-id distribution buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3239 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3240 ;; Get header info. from original article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3241 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3242 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3243 (setq from (message-fetch-field "from")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3244 newsgroups (message-fetch-field "newsgroups")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3245 message-id (message-fetch-field "message-id" t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3246 distribution (message-fetch-field "distribution")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3247 ;; Make sure that this article was written by the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3248 (unless (string-equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3249 (downcase (cadr (mail-extract-address-components from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3250 (downcase (message-make-address)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3251 (error "This article is not yours"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3252 ;; Make control message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3253 (setq buf (set-buffer (get-buffer-create " *message cancel*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3254 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3255 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3256 (insert "Newsgroups: " newsgroups "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3257 "From: " (message-make-from) "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3258 "Subject: cmsg cancel " message-id "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3259 "Control: cancel " message-id "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3260 (if distribution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3261 (concat "Distribution: " distribution "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3262 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3263 mail-header-separator "\n"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3264 message-cancel-message)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3265 (message "Canceling your article...")
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
3266 (if (let ((message-syntax-checks
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
3267 'dont-check-for-anything-just-trust-me))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
3268 (funcall message-send-news-function))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
3269 (message "Canceling your article...done"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3270 (kill-buffer buf)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3272 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3273 (defun message-supersede ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3274 "Start composing a message to supersede the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3275 This is done simply by taking the old article and adding a Supersedes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3276 header line with the old Message-ID."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3277 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3278 (let ((cur (current-buffer)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3279 ;; Check whether the user owns the article that is to be superseded.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3280 (unless (string-equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3281 (downcase (cadr (mail-extract-address-components
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3282 (message-fetch-field "from"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3283 (downcase (message-make-address)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3284 (error "This article is not yours"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3285 ;; Get a normal message buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3286 (message-pop-to-buffer (message-buffer-name "supersede"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3287 (insert-buffer-substring cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3288 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3289 ;; Remove unwanted headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3290 (when message-ignored-supersedes-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3291 (message-remove-header message-ignored-supersedes-headers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3292 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3293 (if (not (re-search-forward "^Message-ID: " nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3294 (error "No Message-ID in this article")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3295 (replace-match "Supersedes: " t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3296 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3297 (insert mail-header-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3298 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3299 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3301 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3302 (defun message-recover ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3303 "Reread contents of current buffer from its last auto-save file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3304 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3305 (let ((file-name (make-auto-save-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3306 (cond ((save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3307 (if (not (eq system-type 'vax-vms))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3308 (with-output-to-temp-buffer "*Directory*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3309 (buffer-disable-undo standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3310 (let ((default-directory "/"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3311 (call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3312 "ls" nil standard-output nil "-l" file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3313 (yes-or-no-p (format "Recover auto save file %s? " file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3314 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3315 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3316 (insert-file-contents file-name nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3317 (t (error "message-recover cancelled")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3319 ;;; Forwarding messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3321 (defun message-make-forward-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3322 "Return a Subject header suitable for the message in the current buffer."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3323 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3324 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3325 (current-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3326 (message-narrow-to-head)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3327 (concat "[" (or (message-fetch-field
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3328 (if (message-news-p) "newsgroups" "from"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3329 "(nowhere)")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3330 "] " (or (message-fetch-field "Subject") "")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3332 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3333 (defun message-forward (&optional news)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3334 "Forward the current message via mail.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3335 Optional NEWS will use news to forward instead of mail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3336 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3337 (let ((cur (current-buffer))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3338 (subject (message-make-forward-subject))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3339 art-beg)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3340 (if news (message-news nil subject) (message-mail nil subject))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3341 ;; Put point where we want it before inserting the forwarded
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3342 ;; message.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3343 (if message-signature-before-forwarded-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3344 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3345 (message-goto-body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3346 ;; Make sure we're at the start of the line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3347 (unless (eolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3348 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3349 ;; Narrow to the area we are to insert.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3350 (narrow-to-region (point) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3351 ;; Insert the separators and the forwarded buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3352 (insert message-forward-start-separator)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3353 (setq art-beg (point))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3354 (insert-buffer-substring cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3355 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3356 (insert message-forward-end-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3357 (set-text-properties (point-min) (point-max) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3358 ;; Remove all unwanted headers.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3359 (goto-char art-beg)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3360 (narrow-to-region (point) (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3361 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3362 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3363 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3364 (message-remove-header message-included-forward-headers t nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3365 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3366 (message-position-point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3368 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3369 (defun message-resend (address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3370 "Resend the current article to ADDRESS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3371 (interactive "sResend message to: ")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3372 (message "Resending message to %s..." address)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3373 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3374 (let ((cur (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3375 beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3376 ;; We first set up a normal mail buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3377 (set-buffer (get-buffer-create " *message resend*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3378 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3379 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3380 (message-setup `((To . ,address)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3381 ;; Insert our usual headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3382 (message-generate-headers '(From Date To))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3383 (message-narrow-to-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3384 ;; Rename them all to "Resent-*".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3385 (while (re-search-forward "^[A-Za-z]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3386 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3387 (insert "Resent-"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3388 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3389 (forward-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3390 (delete-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3391 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3392 ;; Insert the message to be resent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3393 (insert-buffer-substring cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3394 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3395 (search-forward "\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3396 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3397 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3398 (narrow-to-region beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3399 (message-remove-header message-ignored-resent-headers t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3400 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3401 (insert mail-header-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3402 ;; Rename all old ("Also-")Resent headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3403 (while (re-search-backward "^\\(Also-\\)?Resent-" beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3404 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3405 (insert "Also-"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3406 ;; Quote any "From " lines at the beginning.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3407 (goto-char beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3408 (when (looking-at "From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3409 (replace-match "X-From-Line: "))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3410 ;; Send it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3411 (message-send-mail)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3412 (kill-buffer (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3413 (message "Resending message to %s...done" address)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3415 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3416 (defun message-bounce ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3417 "Re-mail the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3418 This only makes sense if the current message is a bounce message than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3419 contains some mail you have written which has been bounced back to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3420 you."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3421 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3422 (let ((cur (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3423 boundary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3424 (message-pop-to-buffer (message-buffer-name "bounce"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3425 (insert-buffer-substring cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3426 (undo-boundary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3427 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3428 (if (and (message-fetch-field "Mime-Version")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3429 (setq boundary (message-fetch-field "Content-Type")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3430 (if (string-match "boundary=\"\\([^\"]+\\)\"" boundary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3431 (setq boundary (concat (match-string 1 boundary) " *\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3432 "Content-Type: message/rfc822"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3433 (setq boundary nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3434 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3435 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3436 (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3437 (or (and boundary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3438 (re-search-forward boundary nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3439 (forward-line 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3440 (and (re-search-forward message-unsent-separator nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3441 (forward-line 1))
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
3442 (re-search-forward "^Return-Path:.*\n" nil t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3443 ;; We remove everything before the bounced mail.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3444 (delete-region
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3445 (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3446 (if (re-search-forward "^[^ \n\t]+:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3447 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3448 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3449 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3450 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3451 (message-remove-header message-ignored-bounced-headers t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3452 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3453 (insert mail-header-separator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3454 (message-position-point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3456 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3457 ;;; Interactive entry points for new message buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3458 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3460 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3461 (defun message-mail-other-window (&optional to subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3462 "Like `message-mail' command, but display mail buffer in another window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3463 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3464 (let ((pop-up-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3465 (special-display-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3466 (special-display-regexps nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3467 (same-window-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3468 (same-window-regexps nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3469 (message-pop-to-buffer (message-buffer-name "mail" to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3470 (message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3472 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3473 (defun message-mail-other-frame (&optional to subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3474 "Like `message-mail' command, but display mail buffer in another frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3475 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3476 (let ((pop-up-frames t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3477 (special-display-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3478 (special-display-regexps nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3479 (same-window-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3480 (same-window-regexps nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3481 (message-pop-to-buffer (message-buffer-name "mail" to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3482 (message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3484 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3485 (defun message-news-other-window (&optional newsgroups subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3486 "Start editing a news article to be sent."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3487 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3488 (let ((pop-up-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3489 (special-display-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3490 (special-display-regexps nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3491 (same-window-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3492 (same-window-regexps nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3493 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3494 (message-setup `((Newsgroups . ,(or newsgroups ""))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3495 (Subject . ,(or subject "")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3497 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3498 (defun message-news-other-frame (&optional newsgroups subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3499 "Start editing a news article to be sent."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3500 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3501 (let ((pop-up-frames t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3502 (special-display-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3503 (special-display-regexps nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3504 (same-window-buffer-names nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3505 (same-window-regexps nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3506 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3507 (message-setup `((Newsgroups . ,(or newsgroups ""))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3508 (Subject . ,(or subject "")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3510 ;;; underline.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3511
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3512 ;; This code should be moved to underline.el (from which it is stolen).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3514 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3515 (defun bold-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3516 "Bold all nonblank characters in the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3517 Works by overstriking characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3518 Called from program, takes two arguments START and END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3519 which specify the range to operate on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3520 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3521 (save-excursion
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3522 (let ((end1 (make-marker)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3523 (move-marker end1 (max start end))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3524 (goto-char (min start end))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3525 (while (< (point) end1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3526 (or (looking-at "[_\^@- ]")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3527 (insert (following-char) "\b"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3528 (forward-char 1)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3530 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3531 (defun unbold-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3532 "Remove all boldness (overstruck characters) in the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3533 Called from program, takes two arguments START and END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3534 which specify the range to operate on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3535 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3536 (save-excursion
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3537 (let ((end1 (make-marker)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3538 (move-marker end1 (max start end))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3539 (goto-char (min start end))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3540 (while (re-search-forward "\b" end1 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3541 (if (eq (following-char) (char-after (- (point) 2)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3542 (delete-char -2))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3543
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3544 (defalias 'message-exchange-point-and-mark 'exchange-point-and-mark)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3546 ;; Support for toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3547 (when (string-match "XEmacs\\|Lucid" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3548 (require 'messagexmas))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3550 ;;; Group name completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3552 (defvar message-newgroups-header-regexp
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3553 "^\\(Newsgroups\\|Followup-To\\|Posted-To\\|Gcc\\):"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3554 "Regexp that match headers that lists groups.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3556 (defun message-tab ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3557 "Expand group names in Newsgroups and Followup-To headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3558 Do a `tab-to-tab-stop' if not in those headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3559 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3560 (if (let ((mail-abbrev-mode-regexp message-newgroups-header-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3561 (mail-abbrev-in-expansion-header-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3562 (message-expand-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3563 (tab-to-tab-stop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3565 (defvar gnus-active-hashtb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3566 (defun message-expand-group ()
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3567 (let* ((b (save-excursion
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3568 (save-restriction
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3569 (narrow-to-region
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3570 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3571 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3572 (skip-chars-forward "^:")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3573 (1+ (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3574 (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3575 (skip-chars-backward "^, \t\n") (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3576 (completion-ignore-case t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3577 (string (buffer-substring b (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3578 (hashtb (and (boundp 'gnus-active-hashtb) gnus-active-hashtb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3579 (completions (all-completions string hashtb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3580 (cur (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3581 comp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3582 (delete-region b (point))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3583 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3584 ((= (length completions) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3585 (if (string= (car completions) string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3586 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3587 (insert string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3588 (message "Only matching group"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3589 (insert (car completions))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3590 ((and (setq comp (try-completion string hashtb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3591 (not (string= comp string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3592 (insert comp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3593 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3594 (insert string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3595 (if (not comp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3596 (message "No matching groups")
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3597 (save-selected-window
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3598 (pop-to-buffer "*Completions*")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3599 (buffer-disable-undo (current-buffer))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3600 (let ((buffer-read-only nil))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3601 (erase-buffer)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3602 (let ((standard-output (current-buffer)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3603 (display-completion-list (sort completions 'string<)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3604 (goto-char (point-min))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
3605 (delete-region (point) (progn (forward-line 3) (point))))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3607 ;;; Help stuff.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3609 (defun message-talkative-question (ask question show &rest text)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3610 "Call FUNCTION with argument QUESTION, displaying the rest of the arguments in a temporary buffer if SHOW.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3611 The following arguments may contain lists of values."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3612 (if (and show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3613 (setq text (message-flatten-list text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3614 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3615 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3616 (with-output-to-temp-buffer " *MESSAGE information message*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3617 (set-buffer " *MESSAGE information message*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3618 (mapcar 'princ text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3619 (goto-char (point-min))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3620 (funcall ask question))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3621 (funcall ask question)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3622
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3623 (defun message-flatten-list (list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3624 "Return a new, flat list that contains all elements of LIST.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3625
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3626 \(message-flatten-list '(1 (2 3 (4 5 (6))) 7))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3627 => (1 2 3 4 5 6 7)"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3628 (cond ((consp list)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3629 (apply 'append (mapcar 'message-flatten-list list)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3630 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3631 (list list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3632
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3633 (defun message-generate-new-buffer-clone-locals (name &optional varstr)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3634 "Create and return a buffer with a name based on NAME using generate-new-buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3635 Then clone the local variables and values from the old buffer to the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3636 new one, cloning only the locals having a substring matching the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3637 regexp varstr."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3638 (let ((oldlocals (buffer-local-variables)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3639 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3640 (set-buffer (generate-new-buffer name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3641 (mapcar (lambda (dude)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3642 (when (and (car dude)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3643 (or (not varstr)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3644 (string-match varstr (symbol-name (car dude)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3645 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3646 (set (make-local-variable (car dude))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3647 (cdr dude)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3648 oldlocals)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3649 (current-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3650
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3651 (run-hooks 'message-load-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3653 (provide 'message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3655 ;;; message.el ends here