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