*** empty log message ***
[bpt/emacs.git] / lisp / gnus / message.el
CommitLineData
23f87bed 1;;; message.el --- composing mail and news messages
e84b4b86
TTN
2
3;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
c4288669 4;; 2005, 2006 Free Software Foundation, Inc.
eec82323 5
6748645f 6;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
eec82323
LMI
7;; Keywords: mail, news
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
3a35cf56
LK
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
eec82323
LMI
25
26;;; Commentary:
27
28;; This mode provides mail-sending facilities from within Emacs. It
29;; consists mainly of large chunks of code from the sendmail.el,
30;; gnus-msg.el and rnewspost.el files.
31
32;;; Code:
33
16409b0b
GM
34(eval-when-compile
35 (require 'cl)
23f87bed
MB
36 (defvar gnus-message-group-art)
37 (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary
38(require 'canlock)
eec82323 39(require 'mailheader)
18c06a99 40(require 'gmm-utils)
eec82323 41(require 'nnheader)
23f87bed
MB
42;; This is apparently necessary even though things are autoloaded.
43;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better
44;; require mailabbrev here.
16409b0b 45(if (featurep 'xemacs)
23f87bed
MB
46 (require 'mail-abbrevs)
47 (require 'mailabbrev))
16409b0b
GM
48(require 'mail-parse)
49(require 'mml)
23f87bed
MB
50(require 'rfc822)
51(eval-and-compile
52 (autoload 'gnus-find-method-for-group "gnus")
53 (autoload 'nnvirtual-find-group-art "nnvirtual")
54 (autoload 'gnus-group-decoded-name "gnus-group"))
eec82323
LMI
55
56(defgroup message '((user-mail-address custom-variable)
57 (user-full-name custom-variable))
58 "Mail and news message composing."
59 :link '(custom-manual "(message)Top")
60 :group 'mail
61 :group 'news)
62
63(put 'user-mail-address 'custom-type 'string)
64(put 'user-full-name 'custom-type 'string)
65
66(defgroup message-various nil
339ccc6a 67 "Various Message Variables."
eec82323
LMI
68 :link '(custom-manual "(message)Various Message Variables")
69 :group 'message)
70
71(defgroup message-buffers nil
339ccc6a 72 "Message Buffers."
eec82323
LMI
73 :link '(custom-manual "(message)Message Buffers")
74 :group 'message)
75
76(defgroup message-sending nil
339ccc6a 77 "Message Sending."
eec82323
LMI
78 :link '(custom-manual "(message)Sending Variables")
79 :group 'message)
80
81(defgroup message-interface nil
339ccc6a 82 "Message Interface."
eec82323
LMI
83 :link '(custom-manual "(message)Interface")
84 :group 'message)
85
86(defgroup message-forwarding nil
339ccc6a 87 "Message Forwarding."
eec82323
LMI
88 :link '(custom-manual "(message)Forwarding")
89 :group 'message-interface)
90
91(defgroup message-insertion nil
339ccc6a 92 "Message Insertion."
eec82323
LMI
93 :link '(custom-manual "(message)Insertion")
94 :group 'message)
95
96(defgroup message-headers nil
339ccc6a 97 "Message Headers."
eec82323
LMI
98 :link '(custom-manual "(message)Message Headers")
99 :group 'message)
100
101(defgroup message-news nil
339ccc6a 102 "Composing News Messages."
eec82323
LMI
103 :group 'message)
104
105(defgroup message-mail nil
339ccc6a 106 "Composing Mail Messages."
eec82323
LMI
107 :group 'message)
108
109(defgroup message-faces nil
110 "Faces used for message composing."
111 :group 'message
112 :group 'faces)
113
114(defcustom message-directory "~/Mail/"
115 "*Directory from which all other mail file variables are derived."
116 :group 'message-various
117 :type 'directory)
118
119(defcustom message-max-buffers 10
120 "*How many buffers to keep before starting to kill them off."
121 :group 'message-buffers
122 :type 'integer)
123
124(defcustom message-send-rename-function nil
125 "Function called to rename the buffer after sending it."
126 :group 'message-buffers
7d829636 127 :type '(choice function (const nil)))
eec82323
LMI
128
129(defcustom message-fcc-handler-function 'message-output
130 "*A function called to save outgoing articles.
131This function will be called with the name of the file to store the
132article in. The default function is `message-output' which saves in Unix
133mailbox format."
134 :type '(radio (function-item message-output)
135 (function :tag "Other"))
136 :group 'message-sending)
137
23f87bed
MB
138(defcustom message-fcc-externalize-attachments nil
139 "If non-nil, attachments are included as external parts in Fcc copies."
bf247b6e 140 :version "22.1"
23f87bed
MB
141 :type 'boolean
142 :group 'message-sending)
143
eec82323 144(defcustom message-courtesy-message
f129a4df 145 "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n"
eec82323
LMI
146 "*This is inserted at the start of a mailed copy of a posted message.
147If the string contains the format spec \"%s\", the Newsgroups
148the article has been posted to will be inserted there.
149If this variable is nil, no such courtesy message will be added."
150 :group 'message-sending
ad136a7c 151 :type '(radio string (const nil)))
eec82323 152
23f87bed
MB
153(defcustom message-ignored-bounced-headers
154 "^\\(Received\\|Return-Path\\|Delivered-To\\):"
eec82323
LMI
155 "*Regexp that matches headers to be removed in resent bounced mail."
156 :group 'message-interface
157 :type 'regexp)
158
159;;;###autoload
160(defcustom message-from-style 'default
161 "*Specifies how \"From\" headers look.
162
7d829636 163If nil, they contain just the return address like:
eec82323
LMI
164 king@grassland.com
165If `parens', they look like:
166 king@grassland.com (Elvis Parsley)
167If `angles', they look like:
168 Elvis Parsley <king@grassland.com>
169
170Otherwise, most addresses look like `angles', but they look like
171`parens' if `angles' would need quoting and `parens' would not."
172 :type '(choice (const :tag "simple" nil)
173 (const parens)
174 (const angles)
175 (const default))
176 :group 'message-headers)
177
23f87bed
MB
178(defcustom message-insert-canlock t
179 "Whether to insert a Cancel-Lock header in news postings."
bf247b6e 180 :version "22.1"
23f87bed
MB
181 :group 'message-headers
182 :type 'boolean)
183
184(defcustom message-syntax-checks
185 (if message-insert-canlock '((sender . disabled)) nil)
16409b0b 186 ;; Guess this one shouldn't be easy to customize...
6748645f 187 "*Controls what syntax checks should not be performed on outgoing posts.
eec82323
LMI
188To disable checking of long signatures, for instance, add
189 `(signature . disabled)' to this list.
190
191Don't touch this variable unless you really know what you're doing.
192
f362b760
MB
193Checks include `approved', `continuation-headers', `control-chars',
194`empty', `existing-newsgroups', `from', `illegible-text',
195`invisible-text', `long-header-lines', `long-lines', `message-id',
196`multiple-headers', `new-text', `newsgroups', `quoting-style',
197`repeated-newsgroups', `reply-to', `sendsys', `shoot',
198`shorten-followup-to', `signature', `size', `subject', `subject-cmsg'
199and `valid-newsgroups'."
16409b0b 200 :group 'message-news
7d829636 201 :type '(repeat sexp)) ; Fixme: improve this
eec82323 202
23f87bed
MB
203(defcustom message-required-headers '((optional . References)
204 From)
205 "*Headers to be generated or prompted for when sending a message.
206Also see `message-required-news-headers' and
207`message-required-mail-headers'."
bf247b6e 208 :version "22.1"
23f87bed
MB
209 :group 'message-news
210 :group 'message-headers
211 :link '(custom-manual "(message)Message Headers")
212 :type '(repeat sexp))
213
214(defcustom message-draft-headers '(References From)
215 "*Headers to be generated when saving a draft message."
bf247b6e 216 :version "22.1"
23f87bed
MB
217 :group 'message-news
218 :group 'message-headers
219 :link '(custom-manual "(message)Message Headers")
220 :type '(repeat sexp))
221
eec82323
LMI
222(defcustom message-required-news-headers
223 '(From Newsgroups Subject Date Message-ID
23f87bed 224 (optional . Organization)
16409b0b 225 (optional . User-Agent))
6748645f 226 "*Headers to be generated or prompted for when posting an article.
eec82323
LMI
227RFC977 and RFC1036 require From, Date, Newsgroups, Subject,
228Message-ID. Organization, Lines, In-Reply-To, Expires, and
16409b0b 229User-Agent are optional. If don't you want message to insert some
eec82323
LMI
230header, remove it from this list."
231 :group 'message-news
232 :group 'message-headers
23f87bed 233 :link '(custom-manual "(message)Message Headers")
eec82323
LMI
234 :type '(repeat sexp))
235
236(defcustom message-required-mail-headers
23f87bed 237 '(From Subject Date (optional . In-Reply-To) Message-ID
16409b0b 238 (optional . User-Agent))
6748645f 239 "*Headers to be generated or prompted for when mailing a message.
23f87bed
MB
240It is recommended that From, Date, To, Subject and Message-ID be
241included. Organization and User-Agent are optional."
eec82323
LMI
242 :group 'message-mail
243 :group 'message-headers
23f87bed 244 :link '(custom-manual "(message)Message Headers")
eec82323
LMI
245 :type '(repeat sexp))
246
247(defcustom message-deletable-headers '(Message-ID Date Lines)
248 "Headers to be deleted if they already exist and were generated by message previously."
249 :group 'message-headers
23f87bed 250 :link '(custom-manual "(message)Message Headers")
eec82323
LMI
251 :type 'sexp)
252
253(defcustom message-ignored-news-headers
23f87bed 254 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
eec82323
LMI
255 "*Regexp of headers to be removed unconditionally before posting."
256 :group 'message-news
257 :group 'message-headers
23f87bed 258 :link '(custom-manual "(message)Message Headers")
8903a9c8
MB
259 :type '(repeat :value-to-internal (lambda (widget value)
260 (custom-split-regexp-maybe value))
261 :match (lambda (widget value)
262 (or (stringp value)
263 (widget-editable-list-match widget value)))
264 regexp))
eec82323 265
23f87bed
MB
266(defcustom message-ignored-mail-headers
267 "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
eec82323
LMI
268 "*Regexp of headers to be removed unconditionally before mailing."
269 :group 'message-mail
270 :group 'message-headers
23f87bed 271 :link '(custom-manual "(message)Mail Headers")
eec82323
LMI
272 :type 'regexp)
273
23f87bed 274(defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|^X-Complaints-To:\\|^Cancel-Lock:\\|^Cancel-Key:\\|^X-Hashcash:\\|^X-Payment:"
eec82323
LMI
275 "*Header lines matching this regexp will be deleted before posting.
276It's best to delete old Path and Date headers before posting to avoid
277any confusion."
278 :group 'message-interface
23f87bed 279 :link '(custom-manual "(message)Superseding")
8903a9c8
MB
280 :type '(repeat :value-to-internal (lambda (widget value)
281 (custom-split-regexp-maybe value))
282 :match (lambda (widget value)
283 (or (stringp value)
284 (widget-editable-list-match widget value)))
285 regexp))
eec82323 286
23f87bed
MB
287(defcustom message-subject-re-regexp
288 "^[ \t]*\\([Rr][Ee]\\(\\[[0-9]*\\]\\)*:[ \t]*\\)*[ \t]*"
6748645f
LMI
289 "*Regexp matching \"Re: \" in the subject line."
290 :group 'message-various
23f87bed 291 :link '(custom-manual "(message)Message Headers")
6748645f
LMI
292 :type 'regexp)
293
23f87bed
MB
294;;; Start of variables adopted from `message-utils.el'.
295
296(defcustom message-subject-trailing-was-query 'ask
297 "*What to do with trailing \"(was: <old subject>)\" in subject lines.
298If nil, leave the subject unchanged. If it is the symbol `ask', query
299the user what do do. In this case, the subject is matched against
300`message-subject-trailing-was-ask-regexp'. If
301`message-subject-trailing-was-query' is t, always strip the trailing
302old subject. In this case, `message-subject-trailing-was-regexp' is
303used."
bf247b6e 304 :version "22.1"
23f87bed
MB
305 :type '(choice (const :tag "never" nil)
306 (const :tag "always strip" t)
307 (const ask))
308 :link '(custom-manual "(message)Message Headers")
309 :group 'message-various)
310
311(defcustom message-subject-trailing-was-ask-regexp
312 "[ \t]*\\([[(]+[Ww][Aa][Ss][ \t]*.*[\])]+\\)"
313 "*Regexp matching \"(was: <old subject>)\" in the subject line.
314
315The function `message-strip-subject-trailing-was' uses this regexp if
316`message-subject-trailing-was-query' is set to the symbol `ask'. If
317the variable is t instead of `ask', use
318`message-subject-trailing-was-regexp' instead.
319
320It is okay to create some false positives here, as the user is asked."
bf247b6e 321 :version "22.1"
23f87bed
MB
322 :group 'message-various
323 :link '(custom-manual "(message)Message Headers")
324 :type 'regexp)
325
326(defcustom message-subject-trailing-was-regexp
327 "[ \t]*\\((*[Ww][Aa][Ss]:[ \t]*.*)\\)"
328 "*Regexp matching \"(was: <old subject>)\" in the subject line.
329
330If `message-subject-trailing-was-query' is set to t, the subject is
331matched against `message-subject-trailing-was-regexp' in
332`message-strip-subject-trailing-was'. You should use a regexp creating very
333few false positives here."
bf247b6e 334 :version "22.1"
23f87bed
MB
335 :group 'message-various
336 :link '(custom-manual "(message)Message Headers")
337 :type 'regexp)
338
23f87bed
MB
339;;; marking inserted text
340
23f87bed 341(defcustom message-mark-insert-begin
f129a4df 342 "--8<---------------cut here---------------start------------->8---\n"
23f87bed 343 "How to mark the beginning of some inserted text."
bf247b6e 344 :version "22.1"
23f87bed
MB
345 :type 'string
346 :link '(custom-manual "(message)Insertion Variables")
347 :group 'message-various)
348
23f87bed 349(defcustom message-mark-insert-end
f129a4df 350 "--8<---------------cut here---------------end--------------->8---\n"
23f87bed 351 "How to mark the end of some inserted text."
bf247b6e 352 :version "22.1"
23f87bed
MB
353 :type 'string
354 :link '(custom-manual "(message)Insertion Variables")
355 :group 'message-various)
356
f129a4df 357(defcustom message-archive-header "X-No-Archive: Yes\n"
23f87bed
MB
358 "Header to insert when you don't want your article to be archived.
359Archives \(such as groups.google.com\) respect this header."
bf247b6e 360 :version "22.1"
23f87bed
MB
361 :type 'string
362 :link '(custom-manual "(message)Header Commands")
363 :group 'message-various)
364
23f87bed
MB
365(defcustom message-archive-note
366 "X-No-Archive: Yes - save http://groups.google.com/"
367 "Note to insert why you wouldn't want this posting archived.
368If nil, don't insert any text in the body."
bf247b6e 369 :version "22.1"
ad136a7c 370 :type '(radio string (const nil))
23f87bed
MB
371 :link '(custom-manual "(message)Header Commands")
372 :group 'message-various)
373
374;;; Crossposts and Followups
375;; inspired by JoH-followup-to by Jochem Huhman <joh at gmx.de>
376;; new suggestions by R. Weikusat <rw at another.de>
377
378(defvar message-cross-post-old-target nil
379 "Old target for cross-posts or follow-ups.")
380(make-variable-buffer-local 'message-cross-post-old-target)
381
23f87bed
MB
382(defcustom message-cross-post-default t
383 "When non-nil `message-cross-post-followup-to' will perform a crosspost.
384If nil, `message-cross-post-followup-to' will only do a followup. Note that
385you can explicitly override this setting by calling
386`message-cross-post-followup-to' with a prefix."
bf247b6e 387 :version "22.1"
23f87bed
MB
388 :type 'boolean
389 :group 'message-various)
390
5f5475ac 391(defcustom message-cross-post-note "Crosspost & Followup-To: "
23f87bed 392 "Note to insert before signature to notify of cross-post and follow-up."
bf247b6e 393 :version "22.1"
23f87bed
MB
394 :type 'string
395 :group 'message-various)
396
5f5475ac 397(defcustom message-followup-to-note "Followup-To: "
23f87bed 398 "Note to insert before signature to notify of follow-up only."
bf247b6e 399 :version "22.1"
23f87bed
MB
400 :type 'string
401 :group 'message-various)
402
5f5475ac 403(defcustom message-cross-post-note-function 'message-cross-post-insert-note
23f87bed
MB
404 "Function to use to insert note about Crosspost or Followup-To.
405The function will be called with four arguments. The function should not only
406insert a note, but also ensure old notes are deleted. See the documentation
407for `message-cross-post-insert-note'."
bf247b6e 408 :version "22.1"
23f87bed
MB
409 :type 'function
410 :group 'message-various)
411
412;;; End of variables adopted from `message-utils.el'.
413
eec82323
LMI
414;;;###autoload
415(defcustom message-signature-separator "^-- *$"
416 "Regexp matching the signature separator."
417 :type 'regexp
23f87bed 418 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
419 :group 'message-various)
420
f129a4df 421(defcustom message-elide-ellipsis "\n[...]\n\n"
6748645f
LMI
422 "*The string which is inserted for elided text."
423 :type 'string
23f87bed 424 :link '(custom-manual "(message)Various Commands")
6748645f 425 :group 'message-various)
eec82323 426
23f87bed 427(defcustom message-interactive t
eec82323
LMI
428 "Non-nil means when sending a message wait for and display errors.
429nil means let mailer mail back a message to report errors."
430 :group 'message-sending
431 :group 'message-mail
23f87bed 432 :link '(custom-manual "(message)Sending Variables")
eec82323
LMI
433 :type 'boolean)
434
16409b0b 435(defcustom message-generate-new-buffers 'unique
7d829636 436 "*Non-nil means create a new message buffer whenever `message-setup' is called.
eec82323
LMI
437If this is a function, call that function with three parameters: The type,
438the to address and the group name. (Any of these may be nil.) The function
439should return the new buffer name."
440 :group 'message-buffers
23f87bed 441 :link '(custom-manual "(message)Message Buffers")
eec82323 442 :type '(choice (const :tag "off" nil)
16409b0b
GM
443 (const :tag "unique" unique)
444 (const :tag "unsent" unsent)
eec82323
LMI
445 (function fun)))
446
447(defcustom message-kill-buffer-on-exit nil
448 "*Non-nil means that the message buffer will be killed after sending a message."
449 :group 'message-buffers
23f87bed 450 :link '(custom-manual "(message)Message Buffers")
eec82323
LMI
451 :type 'boolean)
452
534aa266
DL
453(eval-when-compile
454 (defvar gnus-local-organization))
eec82323
LMI
455(defcustom message-user-organization
456 (or (and (boundp 'gnus-local-organization)
457 (stringp gnus-local-organization)
458 gnus-local-organization)
459 (getenv "ORGANIZATION")
460 t)
461 "*String to be used as an Organization header.
462If t, use `message-user-organization-file'."
463 :group 'message-headers
464 :type '(choice string
465 (const :tag "consult file" t)))
466
467;;;###autoload
468(defcustom message-user-organization-file "/usr/lib/news/organization"
469 "*Local news organization file."
470 :type 'file
23f87bed 471 :link '(custom-manual "(message)News Headers")
eec82323
LMI
472 :group 'message-headers)
473
6748645f 474(defcustom message-make-forward-subject-function
23f87bed 475 #'message-forward-subject-name-subject
7d829636 476 "*List of functions called to generate subject headers for forwarded messages.
6748645f
LMI
477The subject generated by the previous function is passed into each
478successive function.
479
480The provided functions are:
481
23f87bed
MB
482* `message-forward-subject-author-subject' Source of article (author or
483 newsgroup), in brackets followed by the subject
484* `message-forward-subject-name-subject' Source of article (name of author
485 or newsgroup), in brackets followed by the subject
486* `message-forward-subject-fwd' Subject of article with 'Fwd:' prepended
6748645f 487 to it."
16409b0b 488 :group 'message-forwarding
23f87bed 489 :link '(custom-manual "(message)Forwarding")
16409b0b 490 :type '(radio (function-item message-forward-subject-author-subject)
7d829636 491 (function-item message-forward-subject-fwd)
23f87bed 492 (function-item message-forward-subject-name-subject)
7d829636 493 (repeat :tag "List of functions" function)))
16409b0b
GM
494
495(defcustom message-forward-as-mime t
23f87bed
MB
496 "*Non-nil means forward messages as an inline/rfc822 MIME section.
497Otherwise, directly inline the old message in the forwarded message."
2d447df6 498 :version "21.1"
16409b0b 499 :group 'message-forwarding
23f87bed 500 :link '(custom-manual "(message)Forwarding")
16409b0b
GM
501 :type 'boolean)
502
23f87bed
MB
503(defcustom message-forward-show-mml 'best
504 "*Non-nil means show forwarded messages as MML (decoded from MIME).
505Otherwise, forwarded messages are unchanged.
506Can also be the symbol `best' to indicate that MML should be
507used, except when it is a bad idea to use MML. One example where
508it is a bad idea is when forwarding a signed or encrypted
509message, because converting MIME to MML would invalidate the
510digital signature."
88818fbe 511 :version "21.1"
16409b0b 512 :group 'message-forwarding
23f87bed
MB
513 :type '(choice (const :tag "use MML" t)
514 (const :tag "don't use MML " nil)
515 (const :tag "use MML when appropriate" best)))
16409b0b
GM
516
517(defcustom message-forward-before-signature t
23f87bed 518 "*Non-nil means put forwarded message before signature, else after."
16409b0b
GM
519 :group 'message-forwarding
520 :type 'boolean)
6748645f
LMI
521
522(defcustom message-wash-forwarded-subjects nil
23f87bed
MB
523 "*Non-nil means try to remove as much cruft as possible from the subject.
524Done before generating the new subject of a forward."
6748645f 525 :group 'message-forwarding
23f87bed 526 :link '(custom-manual "(message)Forwarding")
6748645f
LMI
527 :type 'boolean)
528
23f87bed 529(defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From "
eec82323
LMI
530 "*All headers that match this regexp will be deleted when resending a message."
531 :group 'message-interface
23f87bed 532 :link '(custom-manual "(message)Resending")
8903a9c8
MB
533 :type '(repeat :value-to-internal (lambda (widget value)
534 (custom-split-regexp-maybe value))
535 :match (lambda (widget value)
536 (or (stringp value)
537 (widget-editable-list-match widget value)))
538 regexp))
eec82323 539
16409b0b
GM
540(defcustom message-forward-ignored-headers "^Content-Transfer-Encoding:\\|^X-Gnus"
541 "*All headers that match this regexp will be deleted when forwarding a message."
2d447df6 542 :version "21.1"
16409b0b 543 :group 'message-forwarding
8903a9c8
MB
544 :type '(repeat :value-to-internal (lambda (widget value)
545 (custom-split-regexp-maybe value))
546 :match (lambda (widget value)
547 (or (stringp value)
548 (widget-editable-list-match widget value)))
16409b0b
GM
549 regexp))
550
eec82323
LMI
551(defcustom message-ignored-cited-headers "."
552 "*Delete these headers from the messages you yank."
553 :group 'message-insertion
23f87bed
MB
554 :link '(custom-manual "(message)Insertion Variables")
555 :type 'regexp)
556
557(defcustom message-cite-prefix-regexp
558 (if (string-match "[[:digit:]]" "1") ;; support POSIX?
559 "\\([ \t]*[-_.[:word:]]+>+\\|[ \t]*[]>|}+]\\)+"
560 ;; ?-, ?_ or ?. MUST NOT be in syntax entry w.
561 (let ((old-table (syntax-table))
562 non-word-constituents)
563 (set-syntax-table text-mode-syntax-table)
564 (setq non-word-constituents
565 (concat
566 (if (string-match "\\w" "-") "" "-")
567 (if (string-match "\\w" "_") "" "_")
568 (if (string-match "\\w" ".") "" ".")))
569 (set-syntax-table old-table)
570 (if (equal non-word-constituents "")
571 "\\([ \t]*\\(\\w\\)+>+\\|[ \t]*[]>|}+]\\)+"
572 (concat "\\([ \t]*\\(\\w\\|["
573 non-word-constituents
574 "]\\)+>+\\|[ \t]*[]>|}+]\\)+"))))
575 "*Regexp matching the longest possible citation prefix on a line."
bf247b6e 576 :version "22.1"
23f87bed
MB
577 :group 'message-insertion
578 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
579 :type 'regexp)
580
f129a4df 581(defcustom message-cancel-message "I am canceling my own article.\n"
eec82323
LMI
582 "Message to be inserted in the cancel message."
583 :group 'message-interface
23f87bed 584 :link '(custom-manual "(message)Canceling News")
eec82323
LMI
585 :type 'string)
586
587;; Useful to set in site-init.el
588;;;###autoload
589(defcustom message-send-mail-function 'message-send-mail-with-sendmail
590 "Function to call to send the current buffer as mail.
591The headers should be delimited by a line whose contents match the
592variable `mail-header-separator'.
593
16409b0b 594Valid values include `message-send-mail-with-sendmail' (the default),
7d829636 595`message-send-mail-with-mh', `message-send-mail-with-qmail',
23f87bed 596`message-smtpmail-send-it', `smtpmail-send-it' and `feedmail-send-it'.
7d829636
DL
597
598See also `send-mail-function'."
eec82323
LMI
599 :type '(radio (function-item message-send-mail-with-sendmail)
600 (function-item message-send-mail-with-mh)
601 (function-item message-send-mail-with-qmail)
23f87bed 602 (function-item message-smtpmail-send-it)
6748645f 603 (function-item smtpmail-send-it)
7d829636 604 (function-item feedmail-send-it)
eec82323
LMI
605 (function :tag "Other"))
606 :group 'message-sending
23f87bed 607 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
608 :group 'message-mail)
609
610(defcustom message-send-news-function 'message-send-news
611 "Function to call to send the current buffer as news.
612The headers should be delimited by a line whose contents match the
613variable `mail-header-separator'."
614 :group 'message-sending
615 :group 'message-news
23f87bed 616 :link '(custom-manual "(message)News Variables")
eec82323
LMI
617 :type 'function)
618
619(defcustom message-reply-to-function nil
7d829636 620 "If non-nil, function that should return a list of headers.
eec82323
LMI
621This function should pick out addresses from the To, Cc, and From headers
622and respond with new To and Cc headers."
623 :group 'message-interface
23f87bed 624 :link '(custom-manual "(message)Reply")
7d829636 625 :type '(choice function (const nil)))
eec82323
LMI
626
627(defcustom message-wide-reply-to-function nil
7d829636 628 "If non-nil, function that should return a list of headers.
eec82323
LMI
629This function should pick out addresses from the To, Cc, and From headers
630and respond with new To and Cc headers."
631 :group 'message-interface
23f87bed 632 :link '(custom-manual "(message)Wide Reply")
7d829636 633 :type '(choice function (const nil)))
eec82323
LMI
634
635(defcustom message-followup-to-function nil
7d829636 636 "If non-nil, function that should return a list of headers.
eec82323
LMI
637This function should pick out addresses from the To, Cc, and From headers
638and respond with new To and Cc headers."
639 :group 'message-interface
23f87bed 640 :link '(custom-manual "(message)Followup")
7d829636 641 :type '(choice function (const nil)))
eec82323
LMI
642
643(defcustom message-use-followup-to 'ask
644 "*Specifies what to do with Followup-To header.
645If nil, always ignore the header. If it is t, use its value, but
646query before using the \"poster\" value. If it is the symbol `ask',
647always query the user whether to use the value. If it is the symbol
648`use', always use the value."
649 :group 'message-interface
23f87bed 650 :link '(custom-manual "(message)Followup")
eec82323 651 :type '(choice (const :tag "ignore" nil)
23f87bed 652 (const :tag "use & query" t)
eec82323
LMI
653 (const use)
654 (const ask)))
655
23f87bed
MB
656(defcustom message-use-mail-followup-to 'use
657 "*Specifies what to do with Mail-Followup-To header.
658If nil, always ignore the header. If it is the symbol `ask', always
659query the user whether to use the value. If it is the symbol `use',
660always use the value."
bf247b6e 661 :version "22.1"
23f87bed
MB
662 :group 'message-interface
663 :link '(custom-manual "(message)Mailing Lists")
664 :type '(choice (const :tag "ignore" nil)
665 (const use)
666 (const ask)))
667
668(defcustom message-subscribed-address-functions nil
669 "*Specifies functions for determining list subscription.
670If nil, do not attempt to determine list subscription with functions.
671If non-nil, this variable contains a list of functions which return
672regular expressions to match lists. These functions can be used in
673conjunction with `message-subscribed-regexps' and
674`message-subscribed-addresses'."
bf247b6e 675 :version "22.1"
23f87bed
MB
676 :group 'message-interface
677 :link '(custom-manual "(message)Mailing Lists")
678 :type '(repeat sexp))
679
680(defcustom message-subscribed-address-file nil
681 "*A file containing addresses the user is subscribed to.
682If nil, do not look at any files to determine list subscriptions. If
683non-nil, each line of this file should be a mailing list address."
bf247b6e 684 :version "22.1"
23f87bed
MB
685 :group 'message-interface
686 :link '(custom-manual "(message)Mailing Lists")
ad136a7c 687 :type '(radio file (const nil)))
23f87bed
MB
688
689(defcustom message-subscribed-addresses nil
690 "*Specifies a list of addresses the user is subscribed to.
691If nil, do not use any predefined list subscriptions. This list of
692addresses can be used in conjunction with
693`message-subscribed-address-functions' and `message-subscribed-regexps'."
bf247b6e 694 :version "22.1"
23f87bed
MB
695 :group 'message-interface
696 :link '(custom-manual "(message)Mailing Lists")
697 :type '(repeat string))
698
699(defcustom message-subscribed-regexps nil
700 "*Specifies a list of addresses the user is subscribed to.
701If nil, do not use any predefined list subscriptions. This list of
702regular expressions can be used in conjunction with
703`message-subscribed-address-functions' and `message-subscribed-addresses'."
bf247b6e 704 :version "22.1"
23f87bed
MB
705 :group 'message-interface
706 :link '(custom-manual "(message)Mailing Lists")
707 :type '(repeat regexp))
708
709(defcustom message-allow-no-recipients 'ask
710 "Specifies what to do when there are no recipients other than Gcc/Fcc.
711If it is the symbol `always', the posting is allowed. If it is the
712symbol `never', the posting is not allowed. If it is the symbol
713`ask', you are prompted."
bf247b6e 714 :version "22.1"
23f87bed
MB
715 :group 'message-interface
716 :link '(custom-manual "(message)Message Headers")
717 :type '(choice (const always)
718 (const never)
719 (const ask)))
720
eec82323 721(defcustom message-sendmail-f-is-evil nil
7d829636 722 "*Non-nil means don't add \"-f username\" to the sendmail command line.
16409b0b 723Doing so would be even more evil than leaving it out."
eec82323 724 :group 'message-sending
23f87bed 725 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
726 :type 'boolean)
727
23f87bed
MB
728(defcustom message-sendmail-envelope-from nil
729 "*Envelope-from when sending mail with sendmail.
730If this is nil, use `user-mail-address'. If it is the symbol
731`header', use the From: header of the message."
bf247b6e 732 :version "22.1"
23f87bed
MB
733 :type '(choice (string :tag "From name")
734 (const :tag "Use From: header from message" header)
735 (const :tag "Use `user-mail-address'" nil))
736 :link '(custom-manual "(message)Mail Variables")
737 :group 'message-sending)
738
eec82323
LMI
739;; qmail-related stuff
740(defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
741 "Location of the qmail-inject program."
742 :group 'message-sending
23f87bed 743 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
744 :type 'file)
745
746(defcustom message-qmail-inject-args nil
747 "Arguments passed to qmail-inject programs.
23f87bed
MB
748This should be a list of strings, one string for each argument. It
749may also be a function.
eec82323
LMI
750
751For e.g., if you wish to set the envelope sender address so that bounces
752go to the right place or to deal with listserv's usage of that address, you
753might set this variable to '(\"-f\" \"you@some.where\")."
754 :group 'message-sending
23f87bed
MB
755 :link '(custom-manual "(message)Mail Variables")
756 :type '(choice (function)
757 (repeat string)))
eec82323 758
16409b0b
GM
759(defvar message-cater-to-broken-inn t
760 "Non-nil means Gnus should not fold the `References' header.
761Folding `References' makes ancient versions of INN create incorrect
762NOV lines.")
763
534aa266
DL
764(eval-when-compile
765 (defvar gnus-post-method)
766 (defvar gnus-select-method))
eec82323
LMI
767(defcustom message-post-method
768 (cond ((and (boundp 'gnus-post-method)
6748645f 769 (listp gnus-post-method)
eec82323
LMI
770 gnus-post-method)
771 gnus-post-method)
772 ((boundp 'gnus-select-method)
773 gnus-select-method)
774 (t '(nnspool "")))
6748645f
LMI
775 "*Method used to post news.
776Note that when posting from inside Gnus, for instance, this
777variable isn't used."
eec82323
LMI
778 :group 'message-news
779 :group 'message-sending
780 ;; This should be the `gnus-select-method' widget, but that might
781 ;; create a dependence to `gnus.el'.
782 :type 'sexp)
783
23f87bed
MB
784;; FIXME: This should be a temporary workaround until someone implements a
785;; proper solution. If a crash happens while replying, the auto-save file
786;; will *not* have a `References:' header if `message-generate-headers-first'
787;; is nil. See: http://article.gmane.org/gmane.emacs.gnus.general/51138
788(defcustom message-generate-headers-first '(references)
789 "Which headers should be generated before starting to compose a message.
f5d01350 790If t, generate all required headers. This can also be a list of headers to
23f87bed
MB
791generate. The variables `message-required-news-headers' and
792`message-required-mail-headers' specify which headers to generate.
793
794Note that the variable `message-deletable-headers' specifies headers which
795are to be deleted and then re-generated before sending, so this variable
796will not have a visible effect for those headers."
eec82323 797 :group 'message-headers
23f87bed
MB
798 :link '(custom-manual "(message)Message Headers")
799 :type '(choice (const :tag "None" nil)
800 (const :tag "References" '(references))
801 (const :tag "All" t)
802 (repeat (sexp :tag "Header"))))
eec82323
LMI
803
804(defcustom message-setup-hook nil
805 "Normal hook, run each time a new outgoing message is initialized.
806The function `message-setup' runs this hook."
807 :group 'message-various
23f87bed 808 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
809 :type 'hook)
810
16409b0b
GM
811(defcustom message-cancel-hook nil
812 "Hook run when cancelling articles."
813 :group 'message-various
23f87bed 814 :link '(custom-manual "(message)Various Message Variables")
16409b0b
GM
815 :type 'hook)
816
eec82323
LMI
817(defcustom message-signature-setup-hook nil
818 "Normal hook, run each time a new outgoing message is initialized.
819It is run after the headers have been inserted and before
820the signature is inserted."
821 :group 'message-various
23f87bed 822 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
823 :type 'hook)
824
825(defcustom message-mode-hook nil
826 "Hook run in message mode buffers."
827 :group 'message-various
828 :type 'hook)
829
830(defcustom message-header-hook nil
831 "Hook run in a message mode buffer narrowed to the headers."
832 :group 'message-various
833 :type 'hook)
834
835(defcustom message-header-setup-hook nil
6748645f 836 "Hook called narrowed to the headers when setting up a message buffer."
eec82323 837 :group 'message-various
23f87bed 838 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
839 :type 'hook)
840
23f87bed
MB
841(defcustom message-minibuffer-local-map
842 (let ((map (make-sparse-keymap 'message-minibuffer-local-map)))
843 (set-keymap-parent map minibuffer-local-map)
844 map)
e2642250 845 "Keymap for `message-read-from-minibuffer'."
d0859c9a
MB
846 :version "22.1"
847 :group 'message-various)
23f87bed 848
eec82323
LMI
849;;;###autoload
850(defcustom message-citation-line-function 'message-insert-citation-line
23f87bed
MB
851 "*Function called to insert the \"Whomever writes:\" line.
852
853Note that Gnus provides a feature where the reader can click on
854`writes:' to hide the cited text. If you change this line too much,
855people who read your message will have to change their Gnus
856configuration. See the variable `gnus-cite-attribution-suffix'."
eec82323 857 :type 'function
23f87bed 858 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
859 :group 'message-insertion)
860
861;;;###autoload
862(defcustom message-yank-prefix "> "
23f87bed
MB
863 "*Prefix inserted on the lines of yanked messages.
864Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
865See also `message-yank-cited-prefix'."
866 :type 'string
867 :link '(custom-manual "(message)Insertion Variables")
868 :group 'message-insertion)
869
870(defcustom message-yank-cited-prefix ">"
871 "*Prefix inserted on cited or empty lines of yanked messages.
872Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
873See also `message-yank-prefix'."
bf247b6e 874 :version "22.1"
eec82323 875 :type 'string
23f87bed 876 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
877 :group 'message-insertion)
878
879(defcustom message-indentation-spaces 3
880 "*Number of spaces to insert at the beginning of each cited line.
881Used by `message-yank-original' via `message-yank-cite'."
882 :group 'message-insertion
23f87bed 883 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
884 :type 'integer)
885
886;;;###autoload
6748645f 887(defcustom message-cite-function 'message-cite-original
4a55f847
RS
888 "*Function for citing an original message.
889Predefined functions include `message-cite-original' and
890`message-cite-original-without-signature'.
6748645f 891Note that `message-cite-original' uses `mail-citation-hook' if that is non-nil."
eec82323 892 :type '(radio (function-item message-cite-original)
16409b0b 893 (function-item message-cite-original-without-signature)
eec82323
LMI
894 (function-item sc-cite-original)
895 (function :tag "Other"))
23f87bed 896 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
897 :group 'message-insertion)
898
899;;;###autoload
900(defcustom message-indent-citation-function 'message-indent-citation
901 "*Function for modifying a citation just inserted in the mail buffer.
902This can also be a list of functions. Each function can find the
903citation between (point) and (mark t). And each function should leave
904point and mark around the citation text as modified."
905 :type 'function
23f87bed 906 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
907 :group 'message-insertion)
908
eec82323
LMI
909;;;###autoload
910(defcustom message-signature t
911 "*String to be inserted at the end of the message buffer.
912If t, the `message-signature-file' file will be inserted instead.
913If a function, the result from the function will be used instead.
914If a form, the result from the form will be used instead."
915 :type 'sexp
23f87bed 916 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
917 :group 'message-insertion)
918
919;;;###autoload
920(defcustom message-signature-file "~/.signature"
5449c317
DL
921 "*Name of file containing the text inserted at end of message buffer.
922Ignored if the named file doesn't exist.
923If nil, don't insert a signature."
924 :type '(choice file (const :tags "None" nil))
23f87bed
MB
925 :link '(custom-manual "(message)Insertion Variables")
926 :group 'message-insertion)
927
928;;;###autoload
929(defcustom message-signature-insert-empty-line t
930 "*If non-nil, insert an empty line before the signature separator."
bf247b6e 931 :version "22.1"
23f87bed
MB
932 :type 'boolean
933 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
934 :group 'message-insertion)
935
936(defcustom message-distribution-function nil
937 "*Function called to return a Distribution header."
938 :group 'message-news
939 :group 'message-headers
23f87bed 940 :link '(custom-manual "(message)News Headers")
7d829636 941 :type '(choice function (const nil)))
eec82323
LMI
942
943(defcustom message-expires 14
944 "Number of days before your article expires."
945 :group 'message-news
946 :group 'message-headers
947 :link '(custom-manual "(message)News Headers")
948 :type 'integer)
949
950(defcustom message-user-path nil
951 "If nil, use the NNTP server name in the Path header.
952If stringp, use this; if non-nil, use no host name (user name only)."
953 :group 'message-news
954 :group 'message-headers
955 :link '(custom-manual "(message)News Headers")
956 :type '(choice (const :tag "nntp" nil)
957 (string :tag "name")
958 (sexp :tag "none" :format "%t" t)))
959
960(defvar message-reply-buffer nil)
23f87bed
MB
961(defvar message-reply-headers nil
962 "The headers of the current replied article.
963It is a vector of the following headers:
964\[number subject from date id references chars lines xref extra].")
eec82323
LMI
965(defvar message-newsreader nil)
966(defvar message-mailer nil)
967(defvar message-sent-message-via nil)
968(defvar message-checksum nil)
969(defvar message-send-actions nil
970 "A list of actions to be performed upon successful sending of a message.")
971(defvar message-exit-actions nil
972 "A list of actions to be performed upon exiting after sending a message.")
973(defvar message-kill-actions nil
974 "A list of actions to be performed before killing a message buffer.")
975(defvar message-postpone-actions nil
976 "A list of actions to be performed after postponing a message.")
977
6748645f
LMI
978(define-widget 'message-header-lines 'text
979 "All header lines must be LFD terminated."
3536d0c1 980 :format "%{%t%}:%n%v"
6748645f
LMI
981 :valid-regexp "^\\'"
982 :error "All header lines must be newline terminated")
983
eec82323
LMI
984(defcustom message-default-headers ""
985 "*A string containing header lines to be inserted in outgoing messages.
986It is inserted before you edit the message, so you can edit or delete
987these lines."
988 :group 'message-headers
23f87bed 989 :link '(custom-manual "(message)Message Headers")
6748645f 990 :type 'message-header-lines)
eec82323
LMI
991
992(defcustom message-default-mail-headers ""
993 "*A string of header lines to be inserted in outgoing mails."
994 :group 'message-headers
995 :group 'message-mail
23f87bed 996 :link '(custom-manual "(message)Mail Headers")
6748645f 997 :type 'message-header-lines)
eec82323
LMI
998
999(defcustom message-default-news-headers ""
16409b0b 1000 "*A string of header lines to be inserted in outgoing news articles."
eec82323
LMI
1001 :group 'message-headers
1002 :group 'message-news
23f87bed 1003 :link '(custom-manual "(message)News Headers")
6748645f 1004 :type 'message-header-lines)
eec82323
LMI
1005
1006;; Note: could use /usr/ucb/mail instead of sendmail;
1007;; options -t, and -v if not interactive.
1008(defcustom message-mailer-swallows-blank-line
1009 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)"
1010 system-configuration)
1011 (file-readable-p "/etc/sendmail.cf")
1012 (let ((buffer (get-buffer-create " *temp*")))
1013 (unwind-protect
1014 (save-excursion
1015 (set-buffer buffer)
1016 (insert-file-contents "/etc/sendmail.cf")
1017 (goto-char (point-min))
1018 (let ((case-fold-search nil))
1019 (re-search-forward "^OR\\>" nil t)))
1020 (kill-buffer buffer))))
1021 ;; According to RFC822, "The field-name must be composed of printable
1022 ;; ASCII characters (i. e., characters that have decimal values between
1023 ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
1024 ;; space, or colon.
1025 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:"))
6748645f 1026 "*Set this non-nil if the system's mailer runs the header and body together.
eec82323
LMI
1027\(This problem exists on Sunos 4 when sendmail is run in remote mode.)
1028The value should be an expression to test whether the problem will
1029actually occur."
1030 :group 'message-sending
23f87bed 1031 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
1032 :type 'sexp)
1033
961a48db 1034;;;###autoload
16409b0b
GM
1035(define-mail-user-agent 'message-user-agent
1036 'message-mail 'message-send-and-exit
1037 'message-kill-buffer 'message-send-hook)
eec82323
LMI
1038
1039(defvar message-mh-deletable-headers '(Message-ID Date Lines Sender)
1040 "If non-nil, delete the deletable headers before feeding to mh.")
1041
a8151ef7
LMI
1042(defvar message-send-method-alist
1043 '((news message-news-p message-send-via-news)
1044 (mail message-mail-p message-send-via-mail))
1045 "Alist of ways to send outgoing messages.
1046Each element has the form
1047
1048 \(TYPE PREDICATE FUNCTION)
1049
1050where TYPE is a symbol that names the method; PREDICATE is a function
1051called without any parameters to determine whether the message is
1052a message of type TYPE; and FUNCTION is a function to be called if
1053PREDICATE returns non-nil. FUNCTION is called with one parameter --
1054the prefix.")
1055
c541eb9a 1056(defcustom message-mail-alias-type 'abbrev
a8151ef7
LMI
1057 "*What alias expansion type to use in Message buffers.
1058The default is `abbrev', which uses mailabbrev. nil switches
c541eb9a
DL
1059mail aliases off."
1060 :group 'message
1061 :link '(custom-manual "(message)Mail Aliases")
1062 :type '(choice (const :tag "Use Mailabbrev" abbrev)
1063 (const :tag "No expansion" nil)))
a8151ef7 1064
6748645f 1065(defcustom message-auto-save-directory
8c6f6f4b 1066 (file-name-as-directory (nnheader-concat message-directory "drafts"))
6748645f
LMI
1067 "*Directory where Message auto-saves buffers if Gnus isn't running.
1068If nil, Message won't auto-save."
1069 :group 'message-buffers
23f87bed 1070 :link '(custom-manual "(message)Various Message Variables")
7d829636 1071 :type '(choice directory (const :tag "Don't auto-save" nil)))
6748645f 1072
7d829636 1073(defcustom message-default-charset
83595c0c
DL
1074 (and (not (mm-multibyte-p)) 'iso-8859-1)
1075 "Default charset used in non-MULE Emacsen.
1076If nil, you might be asked to input the charset."
2d447df6 1077 :version "21.1"
16409b0b 1078 :group 'message
23f87bed 1079 :link '(custom-manual "(message)Various Message Variables")
16409b0b
GM
1080 :type 'symbol)
1081
7d829636 1082(defcustom message-dont-reply-to-names
16409b0b 1083 (and (boundp 'rmail-dont-reply-to-names) rmail-dont-reply-to-names)
23f87bed
MB
1084 "*A regexp specifying addresses to prune when doing wide replies.
1085A value of nil means exclude your own user name only."
2d447df6 1086 :version "21.1"
16409b0b 1087 :group 'message
23f87bed 1088 :link '(custom-manual "(message)Wide Reply")
16409b0b
GM
1089 :type '(choice (const :tag "Yourself" nil)
1090 regexp))
1091
23f87bed
MB
1092(defvar message-shoot-gnksa-feet nil
1093 "*A list of GNKSA feet you are allowed to shoot.
1094Gnus gives you all the opportunity you could possibly want for
1095shooting yourself in the foot. Also, Gnus allows you to shoot the
1096feet of Good Net-Keeping Seal of Approval. The following are foot
1097candidates:
1098`empty-article' Allow you to post an empty article;
1099`quoted-text-only' Allow you to post quoted text only;
1100`multiple-copies' Allow you to post multiple copies;
1101`cancel-messages' Allow you to cancel or supersede messages from
1102 your other email addresses.")
1103
1104(defsubst message-gnksa-enable-p (feature)
1105 (or (not (listp message-shoot-gnksa-feet))
1106 (memq feature message-shoot-gnksa-feet)))
1107
1108(defcustom message-hidden-headers nil
1109 "Regexp of headers to be hidden when composing new messages.
1110This can also be a list of regexps to match headers. Or a list
1111starting with `not' and followed by regexps."
bf247b6e 1112 :version "22.1"
23f87bed
MB
1113 :group 'message
1114 :link '(custom-manual "(message)Message Headers")
1115 :type '(repeat regexp))
1116
eec82323
LMI
1117;;; Internal variables.
1118;;; Well, not really internal.
1119
1120(defvar message-mode-syntax-table
1121 (let ((table (copy-syntax-table text-mode-syntax-table)))
1122 (modify-syntax-entry ?% ". " table)
16409b0b
GM
1123 (modify-syntax-entry ?> ". " table)
1124 (modify-syntax-entry ?< ". " table)
eec82323
LMI
1125 table)
1126 "Syntax table used while in Message mode.")
1127
0f49874b 1128(defface message-header-to
eec82323
LMI
1129 '((((class color)
1130 (background dark))
23f87bed 1131 (:foreground "green2" :bold t))
eec82323
LMI
1132 (((class color)
1133 (background light))
23f87bed 1134 (:foreground "MidnightBlue" :bold t))
eec82323 1135 (t
23f87bed 1136 (:bold t :italic t)))
eec82323
LMI
1137 "Face used for displaying From headers."
1138 :group 'message-faces)
0f49874b
MB
1139;; backward-compatibility alias
1140(put 'message-header-to-face 'face-alias 'message-header-to)
eec82323 1141
0f49874b 1142(defface message-header-cc
eec82323
LMI
1143 '((((class color)
1144 (background dark))
23f87bed 1145 (:foreground "green4" :bold t))
eec82323
LMI
1146 (((class color)
1147 (background light))
1148 (:foreground "MidnightBlue"))
1149 (t
23f87bed 1150 (:bold t)))
eec82323
LMI
1151 "Face used for displaying Cc headers."
1152 :group 'message-faces)
0f49874b
MB
1153;; backward-compatibility alias
1154(put 'message-header-cc-face 'face-alias 'message-header-cc)
eec82323 1155
0f49874b 1156(defface message-header-subject
eec82323
LMI
1157 '((((class color)
1158 (background dark))
1159 (:foreground "green3"))
1160 (((class color)
1161 (background light))
23f87bed 1162 (:foreground "navy blue" :bold t))
eec82323 1163 (t
23f87bed 1164 (:bold t)))
eec82323
LMI
1165 "Face used for displaying subject headers."
1166 :group 'message-faces)
0f49874b
MB
1167;; backward-compatibility alias
1168(put 'message-header-subject-face 'face-alias 'message-header-subject)
eec82323 1169
0f49874b 1170(defface message-header-newsgroups
eec82323
LMI
1171 '((((class color)
1172 (background dark))
23f87bed 1173 (:foreground "yellow" :bold t :italic t))
eec82323
LMI
1174 (((class color)
1175 (background light))
23f87bed 1176 (:foreground "blue4" :bold t :italic t))
eec82323 1177 (t
23f87bed 1178 (:bold t :italic t)))
eec82323
LMI
1179 "Face used for displaying newsgroups headers."
1180 :group 'message-faces)
0f49874b
MB
1181;; backward-compatibility alias
1182(put 'message-header-newsgroups-face 'face-alias 'message-header-newsgroups)
eec82323 1183
0f49874b 1184(defface message-header-other
eec82323
LMI
1185 '((((class color)
1186 (background dark))
6748645f 1187 (:foreground "#b00000"))
eec82323
LMI
1188 (((class color)
1189 (background light))
1190 (:foreground "steel blue"))
1191 (t
23f87bed 1192 (:bold t :italic t)))
eec82323
LMI
1193 "Face used for displaying newsgroups headers."
1194 :group 'message-faces)
0f49874b
MB
1195;; backward-compatibility alias
1196(put 'message-header-other-face 'face-alias 'message-header-other)
eec82323 1197
0f49874b 1198(defface message-header-name
eec82323
LMI
1199 '((((class color)
1200 (background dark))
1201 (:foreground "DarkGreen"))
1202 (((class color)
1203 (background light))
1204 (:foreground "cornflower blue"))
1205 (t
23f87bed 1206 (:bold t)))
eec82323
LMI
1207 "Face used for displaying header names."
1208 :group 'message-faces)
0f49874b
MB
1209;; backward-compatibility alias
1210(put 'message-header-name-face 'face-alias 'message-header-name)
eec82323 1211
0f49874b 1212(defface message-header-xheader
eec82323
LMI
1213 '((((class color)
1214 (background dark))
1215 (:foreground "blue"))
1216 (((class color)
1217 (background light))
1218 (:foreground "blue"))
1219 (t
23f87bed 1220 (:bold t)))
eec82323
LMI
1221 "Face used for displaying X-Header headers."
1222 :group 'message-faces)
0f49874b
MB
1223;; backward-compatibility alias
1224(put 'message-header-xheader-face 'face-alias 'message-header-xheader)
eec82323 1225
0f49874b 1226(defface message-separator
eec82323
LMI
1227 '((((class color)
1228 (background dark))
6748645f 1229 (:foreground "blue3"))
eec82323
LMI
1230 (((class color)
1231 (background light))
1232 (:foreground "brown"))
1233 (t
23f87bed 1234 (:bold t)))
eec82323
LMI
1235 "Face used for displaying the separator."
1236 :group 'message-faces)
0f49874b
MB
1237;; backward-compatibility alias
1238(put 'message-separator-face 'face-alias 'message-separator)
eec82323 1239
0f49874b 1240(defface message-cited-text
eec82323
LMI
1241 '((((class color)
1242 (background dark))
1243 (:foreground "red"))
1244 (((class color)
1245 (background light))
1246 (:foreground "red"))
1247 (t
23f87bed 1248 (:bold t)))
eec82323
LMI
1249 "Face used for displaying cited text names."
1250 :group 'message-faces)
0f49874b
MB
1251;; backward-compatibility alias
1252(put 'message-cited-text-face 'face-alias 'message-cited-text)
eec82323 1253
0f49874b 1254(defface message-mml
16409b0b
GM
1255 '((((class color)
1256 (background dark))
1257 (:foreground "ForestGreen"))
1258 (((class color)
1259 (background light))
1260 (:foreground "ForestGreen"))
1261 (t
23f87bed 1262 (:bold t)))
16409b0b
GM
1263 "Face used for displaying MML."
1264 :group 'message-faces)
0f49874b
MB
1265;; backward-compatibility alias
1266(put 'message-mml-face 'face-alias 'message-mml)
16409b0b 1267
23f87bed
MB
1268(defun message-font-lock-make-header-matcher (regexp)
1269 (let ((form
1270 `(lambda (limit)
1271 (let ((start (point)))
1272 (save-restriction
1273 (widen)
1274 (goto-char (point-min))
1275 (if (re-search-forward
1276 (concat "^" (regexp-quote mail-header-separator) "$")
1277 nil t)
1278 (setq limit (min limit (match-beginning 0))))
1279 (goto-char start))
1280 (and (< start limit)
1281 (re-search-forward ,regexp limit t))))))
1282 (if (featurep 'bytecomp)
1283 (byte-compile form)
1284 form)))
1285
eec82323 1286(defvar message-font-lock-keywords
23f87bed
MB
1287 (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?"))
1288 `((,(message-font-lock-make-header-matcher
1289 (concat "^\\([Tt]o:\\)" content))
0f49874b
MB
1290 (1 'message-header-name)
1291 (2 'message-header-to nil t))
23f87bed
MB
1292 (,(message-font-lock-make-header-matcher
1293 (concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content))
0f49874b
MB
1294 (1 'message-header-name)
1295 (2 'message-header-cc nil t))
23f87bed
MB
1296 (,(message-font-lock-make-header-matcher
1297 (concat "^\\([Ss]ubject:\\)" content))
0f49874b
MB
1298 (1 'message-header-name)
1299 (2 'message-header-subject nil t))
23f87bed
MB
1300 (,(message-font-lock-make-header-matcher
1301 (concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content))
0f49874b
MB
1302 (1 'message-header-name)
1303 (2 'message-header-newsgroups nil t))
23f87bed
MB
1304 (,(message-font-lock-make-header-matcher
1305 (concat "^\\([A-Z][^: \n\t]+:\\)" content))
0f49874b
MB
1306 (1 'message-header-name)
1307 (2 'message-header-other nil t))
23f87bed
MB
1308 (,(message-font-lock-make-header-matcher
1309 (concat "^\\(X-[A-Za-z0-9-]+:\\|In-Reply-To:\\)" content))
0f49874b
MB
1310 (1 'message-header-name)
1311 (2 'message-header-name))
6748645f
LMI
1312 ,@(if (and mail-header-separator
1313 (not (equal mail-header-separator "")))
1314 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
0f49874b 1315 1 'message-separator))
6748645f 1316 nil)
23f87bed
MB
1317 ((lambda (limit)
1318 (re-search-forward (concat "^\\("
1319 message-cite-prefix-regexp
1320 "\\).*")
1321 limit t))
0f49874b 1322 (0 'message-cited-text))
23f87bed 1323 ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
0f49874b 1324 (0 'message-mml))))
eec82323
LMI
1325 "Additional expressions to highlight in Message mode.")
1326
23f87bed 1327
6748645f
LMI
1328;; XEmacs does it like this. For Emacs, we have to set the
1329;; `font-lock-defaults' buffer-local variable.
1330(put 'message-mode 'font-lock-defaults '(message-font-lock-keywords t))
1331
eec82323
LMI
1332(defvar message-face-alist
1333 '((bold . bold-region)
1334 (underline . underline-region)
1335 (default . (lambda (b e)
1336 (unbold-region b e)
1337 (ununderline-region b e))))
1338 "Alist of mail and news faces for facemenu.
8f688cb0 1339The cdr of each entry is a function for applying the face to a region.")
eec82323
LMI
1340
1341(defcustom message-send-hook nil
23f87bed
MB
1342 "Hook run before sending messages.
1343This hook is run quite early when sending."
eec82323
LMI
1344 :group 'message-various
1345 :options '(ispell-message)
23f87bed 1346 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
1347 :type 'hook)
1348
1349(defcustom message-send-mail-hook nil
23f87bed
MB
1350 "Hook run before sending mail messages.
1351This hook is run very late -- just before the message is sent as
1352mail."
eec82323 1353 :group 'message-various
23f87bed 1354 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
1355 :type 'hook)
1356
1357(defcustom message-send-news-hook nil
23f87bed
MB
1358 "Hook run before sending news messages.
1359This hook is run very late -- just before the message is sent as
1360news."
eec82323 1361 :group 'message-various
23f87bed 1362 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
1363 :type 'hook)
1364
1365(defcustom message-sent-hook nil
1366 "Hook run after sending messages."
1367 :group 'message-various
1368 :type 'hook)
1369
6748645f
LMI
1370(defvar message-send-coding-system 'binary
1371 "Coding system to encode outgoing mail.")
1372
16409b0b
GM
1373(defvar message-draft-coding-system
1374 mm-auto-save-coding-system
23f87bed
MB
1375 "*Coding system to compose mail.
1376If you'd like to make it possible to share draft files between XEmacs
1377and Emacs, you may use `iso-2022-7bit' for this value at your own risk.
1378Note that the coding-system `iso-2022-7bit' isn't suitable to all data.")
16409b0b
GM
1379
1380(defcustom message-send-mail-partially-limit 1000000
1381 "The limitation of messages sent as message/partial.
7d829636
DL
1382The lower bound of message size in characters, beyond which the message
1383should be sent in several parts. If it is nil, the size is unlimited."
2d447df6 1384 :version "21.1"
16409b0b 1385 :group 'message-buffers
23f87bed 1386 :link '(custom-manual "(message)Mail Variables")
16409b0b
GM
1387 :type '(choice (const :tag "unlimited" nil)
1388 (integer 1000000)))
1389
83595c0c 1390(defcustom message-alternative-emails nil
46e8fe3d
MB
1391 "*Regexp matching alternative email addresses.
1392The first address in the To, Cc or From headers of the original
1393article matching this variable is used as the From field of
1394outgoing messages.
1395
1396This variable has precedence over posting styles and anything that runs
1397off `message-setup-hook'."
83595c0c 1398 :group 'message-headers
23f87bed 1399 :link '(custom-manual "(message)Message Headers")
83595c0c
DL
1400 :type '(choice (const :tag "Always use primary" nil)
1401 regexp))
1402
23f87bed
MB
1403(defcustom message-hierarchical-addresses nil
1404 "A list of hierarchical mail address definitions.
1405
1406Inside each entry, the first address is the \"top\" address, and
1407subsequent addresses are subaddresses; this is used to indicate that
1408mail sent to the first address will automatically be delivered to the
1409subaddresses. So if the first address appears in the recipient list
1410for a message, the subaddresses will be removed (if present) before
1411the mail is sent. All addresses in this structure should be
1412downcased."
bf247b6e 1413 :version "22.1"
23f87bed
MB
1414 :group 'message-headers
1415 :type '(repeat (repeat string)))
1416
88818fbe
SZ
1417(defcustom message-mail-user-agent nil
1418 "Like `mail-user-agent'.
7d829636 1419Except if it is nil, use Gnus native MUA; if it is t, use
88818fbe 1420`mail-user-agent'."
bf247b6e 1421 :version "22.1"
88818fbe
SZ
1422 :type '(radio (const :tag "Gnus native"
1423 :format "%t\n"
1424 nil)
1425 (const :tag "`mail-user-agent'"
1426 :format "%t\n"
1427 t)
1428 (function-item :tag "Default Emacs mail"
1429 :format "%t\n"
1430 sendmail-user-agent)
1431 (function-item :tag "Emacs interface to MH"
1432 :format "%t\n"
1433 mh-e-user-agent)
1434 (function :tag "Other"))
1435 :version "21.1"
1436 :group 'message)
1437
23f87bed
MB
1438(defcustom message-wide-reply-confirm-recipients nil
1439 "Whether to confirm a wide reply to multiple email recipients.
1440If this variable is nil, don't ask whether to reply to all recipients.
1441If this variable is non-nil, pose the question \"Reply to all
1442recipients?\" before a wide reply to multiple recipients. If the user
1443answers yes, reply to all recipients as usual. If the user answers
1444no, only reply back to the author."
bf247b6e 1445 :version "22.1"
23f87bed
MB
1446 :group 'message-headers
1447 :link '(custom-manual "(message)Wide Reply")
1448 :type 'boolean)
1449
1450(defcustom message-user-fqdn nil
bcc7dd61 1451 "*Domain part of Message-Ids."
bf247b6e 1452 :version "22.1"
23f87bed
MB
1453 :group 'message-headers
1454 :link '(custom-manual "(message)News Headers")
1455 :type '(radio (const :format "%v " nil)
ad136a7c 1456 (string :format "FQDN: %v")))
23f87bed
MB
1457
1458(defcustom message-use-idna (and (condition-case nil (require 'idna)
1459 (file-error))
1460 (mm-coding-system-p 'utf-8)
1461 (executable-find idna-program)
a33704bb
MB
1462