Merge changes made in Gnus master
[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
61bbede6 267 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:\\|^X-Message-SMTP-Method:"
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).
a71e2379
G
595 "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:\
596\\|^X-Content-Length:\\|^X-UIDL:"
eec82323 597 "*All headers that match this regexp will be deleted when resending a message."
a71e2379 598 :version "24.4"
eec82323 599 :group 'message-interface
23f87bed 600 :link '(custom-manual "(message)Resending")
8903a9c8
MB
601 :type '(repeat :value-to-internal (lambda (widget value)
602 (custom-split-regexp-maybe value))
603 :match (lambda (widget value)
604 (or (stringp value)
605 (widget-editable-list-match widget value)))
606 regexp))
eec82323 607
16409b0b
GM
608(defcustom message-forward-ignored-headers "^Content-Transfer-Encoding:\\|^X-Gnus"
609 "*All headers that match this regexp will be deleted when forwarding a message."
2d447df6 610 :version "21.1"
16409b0b 611 :group 'message-forwarding
8903a9c8
MB
612 :type '(repeat :value-to-internal (lambda (widget value)
613 (custom-split-regexp-maybe value))
614 :match (lambda (widget value)
615 (or (stringp value)
616 (widget-editable-list-match widget value)))
16409b0b
GM
617 regexp))
618
eec82323
LMI
619(defcustom message-ignored-cited-headers "."
620 "*Delete these headers from the messages you yank."
621 :group 'message-insertion
23f87bed
MB
622 :link '(custom-manual "(message)Insertion Variables")
623 :type 'regexp)
624
e0a185ae 625(defcustom message-cite-prefix-regexp mail-citation-prefix-regexp
23f87bed 626 "*Regexp matching the longest possible citation prefix on a line."
2696d88f 627 :version "24.1"
23f87bed
MB
628 :group 'message-insertion
629 :link '(custom-manual "(message)Insertion Variables")
01c52d31
MB
630 :type 'regexp
631 :set (lambda (symbol value)
632 (prog1
633 (custom-set-default symbol value)
634 (if (boundp 'gnus-message-cite-prefix-regexp)
635 (setq gnus-message-cite-prefix-regexp
636 (concat "^\\(?:" value "\\)"))))))
eec82323 637
f129a4df 638(defcustom message-cancel-message "I am canceling my own article.\n"
eec82323
LMI
639 "Message to be inserted in the cancel message."
640 :group 'message-interface
23f87bed 641 :link '(custom-manual "(message)Canceling News")
eec82323
LMI
642 :type 'string)
643
2ea6167b
RS
644(defun message-send-mail-function ()
645 "Return suitable value for the variable `message-send-mail-function'."
b62a39c4
RS
646 (cond ((and (require 'sendmail)
647 (boundp 'sendmail-program)
648 sendmail-program
9e0a8576 649 (executable-find sendmail-program))
2ea6167b 650 'message-send-mail-with-sendmail)
9e0a8576 651 ((and (locate-library "smtpmail")
aa8f8277 652 (boundp 'smtpmail-default-smtp-server)
9e0a8576
RS
653 smtpmail-default-smtp-server)
654 'message-smtpmail-send-it)
655 ((locate-library "mailclient")
2ea6167b
RS
656 'message-send-mail-with-mailclient)
657 (t
aa8f8277 658 (error "Don't know how to send mail. Please customize `message-send-mail-function'"))))
2ea6167b 659
cc26d239 660(defun message-default-send-mail-function ()
ac1af635
GM
661 (cond ((eq send-mail-function 'smtpmail-send-it) 'message-smtpmail-send-it)
662 ((eq send-mail-function 'feedmail-send-it) 'feedmail-send-it)
3451795c 663 ((eq send-mail-function 'sendmail-query-once) 'sendmail-query-once)
ac1af635
GM
664 ((eq send-mail-function 'mailclient-send-it)
665 'message-send-mail-with-mailclient)
cc26d239
LI
666 (t (message-send-mail-function))))
667
668;; Useful to set in site-init.el
669(defcustom message-send-mail-function (message-default-send-mail-function)
eec82323
LMI
670 "Function to call to send the current buffer as mail.
671The headers should be delimited by a line whose contents match the
672variable `mail-header-separator'.
673
2ea6167b 674Valid values include `message-send-mail-with-sendmail'
7d829636 675`message-send-mail-with-mh', `message-send-mail-with-qmail',
2ea6167b
RS
676`message-smtpmail-send-it', `smtpmail-send-it',
677`feedmail-send-it' and `message-send-mail-with-mailclient'. The
8f7abae3
MB
678default is system dependent and determined by the function
679`message-send-mail-function'.
7d829636
DL
680
681See also `send-mail-function'."
eec82323
LMI
682 :type '(radio (function-item message-send-mail-with-sendmail)
683 (function-item message-send-mail-with-mh)
684 (function-item message-send-mail-with-qmail)
23f87bed 685 (function-item message-smtpmail-send-it)
6748645f 686 (function-item smtpmail-send-it)
7d829636 687 (function-item feedmail-send-it)
2ea6167b
RS
688 (function-item message-send-mail-with-mailclient
689 :tag "Use Mailclient package")
690 (function :tag "Other"))
eec82323 691 :group 'message-sending
ac1af635 692 :version "23.2"
2ea6167b 693 :initialize 'custom-initialize-default
23f87bed 694 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
695 :group 'message-mail)
696
697(defcustom message-send-news-function 'message-send-news
698 "Function to call to send the current buffer as news.
699The headers should be delimited by a line whose contents match the
700variable `mail-header-separator'."
701 :group 'message-sending
702 :group 'message-news
23f87bed 703 :link '(custom-manual "(message)News Variables")
eec82323
LMI
704 :type 'function)
705
706(defcustom message-reply-to-function nil
7d829636 707 "If non-nil, function that should return a list of headers.
eec82323
LMI
708This function should pick out addresses from the To, Cc, and From headers
709and respond with new To and Cc headers."
710 :group 'message-interface
23f87bed 711 :link '(custom-manual "(message)Reply")
7d829636 712 :type '(choice function (const nil)))
eec82323
LMI
713
714(defcustom message-wide-reply-to-function nil
7d829636 715 "If non-nil, function that should return a list of headers.
eec82323
LMI
716This function should pick out addresses from the To, Cc, and From headers
717and respond with new To and Cc headers."
718 :group 'message-interface
23f87bed 719 :link '(custom-manual "(message)Wide Reply")
7d829636 720 :type '(choice function (const nil)))
eec82323
LMI
721
722(defcustom message-followup-to-function nil
7d829636 723 "If non-nil, function that should return a list of headers.
eec82323
LMI
724This function should pick out addresses from the To, Cc, and From headers
725and respond with new To and Cc headers."
726 :group 'message-interface
23f87bed 727 :link '(custom-manual "(message)Followup")
7d829636 728 :type '(choice function (const nil)))
eec82323 729
01c52d31
MB
730(defcustom message-extra-wide-headers nil
731 "If non-nil, a list of additional address headers.
732These are used when composing a wide reply."
733 :group 'message-sending
734 :type '(repeat string))
735
eec82323
LMI
736(defcustom message-use-followup-to 'ask
737 "*Specifies what to do with Followup-To header.
738If nil, always ignore the header. If it is t, use its value, but
739query before using the \"poster\" value. If it is the symbol `ask',
740always query the user whether to use the value. If it is the symbol
741`use', always use the value."
742 :group 'message-interface
23f87bed 743 :link '(custom-manual "(message)Followup")
eec82323 744 :type '(choice (const :tag "ignore" nil)
23f87bed 745 (const :tag "use & query" t)
eec82323
LMI
746 (const use)
747 (const ask)))
748
23f87bed
MB
749(defcustom message-use-mail-followup-to 'use
750 "*Specifies what to do with Mail-Followup-To header.
751If nil, always ignore the header. If it is the symbol `ask', always
752query the user whether to use the value. If it is the symbol `use',
753always use the value."
bf247b6e 754 :version "22.1"
23f87bed
MB
755 :group 'message-interface
756 :link '(custom-manual "(message)Mailing Lists")
757 :type '(choice (const :tag "ignore" nil)
758 (const use)
759 (const ask)))
760
761(defcustom message-subscribed-address-functions nil
762 "*Specifies functions for determining list subscription.
763If nil, do not attempt to determine list subscription with functions.
764If non-nil, this variable contains a list of functions which return
765regular expressions to match lists. These functions can be used in
766conjunction with `message-subscribed-regexps' and
767`message-subscribed-addresses'."
bf247b6e 768 :version "22.1"
23f87bed
MB
769 :group 'message-interface
770 :link '(custom-manual "(message)Mailing Lists")
771 :type '(repeat sexp))
772
773(defcustom message-subscribed-address-file nil
774 "*A file containing addresses the user is subscribed to.
775If nil, do not look at any files to determine list subscriptions. If
776non-nil, each line of this file should be a mailing list address."
bf247b6e 777 :version "22.1"
23f87bed
MB
778 :group 'message-interface
779 :link '(custom-manual "(message)Mailing Lists")
ad136a7c 780 :type '(radio file (const nil)))
23f87bed
MB
781
782(defcustom message-subscribed-addresses nil
783 "*Specifies a list of addresses the user is subscribed to.
784If nil, do not use any predefined list subscriptions. This list of
785addresses can be used in conjunction with
786`message-subscribed-address-functions' and `message-subscribed-regexps'."
bf247b6e 787 :version "22.1"
23f87bed
MB
788 :group 'message-interface
789 :link '(custom-manual "(message)Mailing Lists")
790 :type '(repeat string))
791
792(defcustom message-subscribed-regexps nil
793 "*Specifies a list of addresses the user is subscribed to.
794If nil, do not use any predefined list subscriptions. This list of
795regular expressions can be used in conjunction with
796`message-subscribed-address-functions' and `message-subscribed-addresses'."
bf247b6e 797 :version "22.1"
23f87bed
MB
798 :group 'message-interface
799 :link '(custom-manual "(message)Mailing Lists")
800 :type '(repeat regexp))
801
802(defcustom message-allow-no-recipients 'ask
803 "Specifies what to do when there are no recipients other than Gcc/Fcc.
804If it is the symbol `always', the posting is allowed. If it is the
805symbol `never', the posting is not allowed. If it is the symbol
806`ask', you are prompted."
bf247b6e 807 :version "22.1"
23f87bed
MB
808 :group 'message-interface
809 :link '(custom-manual "(message)Message Headers")
810 :type '(choice (const always)
811 (const never)
812 (const ask)))
813
eec82323 814(defcustom message-sendmail-f-is-evil nil
7d829636 815 "*Non-nil means don't add \"-f username\" to the sendmail command line.
16409b0b 816Doing so would be even more evil than leaving it out."
eec82323 817 :group 'message-sending
23f87bed 818 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
819 :type 'boolean)
820
4332f3ec 821(defcustom message-sendmail-envelope-from
e0a185ae 822 ;; `mail-envelope-from' is unavailable unless sendmail.el is loaded.
937e60c8 823 (if (boundp 'mail-envelope-from) mail-envelope-from)
23f87bed
MB
824 "*Envelope-from when sending mail with sendmail.
825If this is nil, use `user-mail-address'. If it is the symbol
826`header', use the From: header of the message."
937e60c8 827 :version "23.2"
23f87bed
MB
828 :type '(choice (string :tag "From name")
829 (const :tag "Use From: header from message" header)
830 (const :tag "Use `user-mail-address'" nil))
831 :link '(custom-manual "(message)Mail Variables")
832 :group 'message-sending)
833
01c52d31
MB
834(defcustom message-sendmail-extra-arguments nil
835 "Additional arguments to `sendmail-program'."
836 ;; E.g. '("-a" "account") for msmtp
330f707b 837 :version "23.1" ;; No Gnus
01c52d31
MB
838 :type '(repeat string)
839 ;; :link '(custom-manual "(message)Mail Variables")
840 :group 'message-sending)
841
eec82323
LMI
842;; qmail-related stuff
843(defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
844 "Location of the qmail-inject program."
845 :group 'message-sending
23f87bed 846 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
847 :type 'file)
848
849(defcustom message-qmail-inject-args nil
850 "Arguments passed to qmail-inject programs.
2b8f62e9
JB
851This should be a list of strings, one string for each argument.
852It may also be a function.
eec82323
LMI
853
854For e.g., if you wish to set the envelope sender address so that bounces
855go to the right place or to deal with listserv's usage of that address, you
856might set this variable to '(\"-f\" \"you@some.where\")."
857 :group 'message-sending
23f87bed
MB
858 :link '(custom-manual "(message)Mail Variables")
859 :type '(choice (function)
860 (repeat string)))
eec82323 861
9efa445f
DN
862(defvar gnus-post-method)
863(defvar gnus-select-method)
eec82323
LMI
864(defcustom message-post-method
865 (cond ((and (boundp 'gnus-post-method)
6748645f 866 (listp gnus-post-method)
eec82323
LMI
867 gnus-post-method)
868 gnus-post-method)
869 ((boundp 'gnus-select-method)
870 gnus-select-method)
871 (t '(nnspool "")))
6748645f
LMI
872 "*Method used to post news.
873Note that when posting from inside Gnus, for instance, this
874variable isn't used."
eec82323
LMI
875 :group 'message-news
876 :group 'message-sending
877 ;; This should be the `gnus-select-method' widget, but that might
878 ;; create a dependence to `gnus.el'.
879 :type 'sexp)
880
0d1c2cc8 881(defcustom message-generate-headers-first nil
23f87bed 882 "Which headers should be generated before starting to compose a message.
f5d01350 883If t, generate all required headers. This can also be a list of headers to
23f87bed
MB
884generate. The variables `message-required-news-headers' and
885`message-required-mail-headers' specify which headers to generate.
886
887Note that the variable `message-deletable-headers' specifies headers which
888are to be deleted and then re-generated before sending, so this variable
889will not have a visible effect for those headers."
eec82323 890 :group 'message-headers
23f87bed
MB
891 :link '(custom-manual "(message)Message Headers")
892 :type '(choice (const :tag "None" nil)
01c52d31
MB
893 (const :tag "All" t)
894 (repeat (sexp :tag "Header"))))
895
896(defcustom message-fill-column 72
897 "Column beyond which automatic line-wrapping should happen.
898Local value for message buffers. If non-nil, also turn on
899auto-fill in message buffers."
900 :group 'message-various
901 ;; :link '(custom-manual "(message)Message Headers")
902 :type '(choice (const :tag "Don't turn on auto fill" nil)
903 (integer)))
eec82323 904
4e14547f
CY
905(defcustom message-setup-hook nil
906 "Normal hook, run each time a new outgoing message is initialized.
907The function `message-setup' runs this hook."
908 :group 'message-various
909 :link '(custom-manual "(message)Various Message Variables")
910 :type 'hook)
eec82323 911
16409b0b 912(defcustom message-cancel-hook nil
c80e3b4a 913 "Hook run when canceling articles."
16409b0b 914 :group 'message-various
23f87bed 915 :link '(custom-manual "(message)Various Message Variables")
16409b0b
GM
916 :type 'hook)
917
eec82323
LMI
918(defcustom message-signature-setup-hook nil
919 "Normal hook, run each time a new outgoing message is initialized.
920It is run after the headers have been inserted and before
921the signature is inserted."
922 :group 'message-various
23f87bed 923 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
924 :type 'hook)
925
926(defcustom message-mode-hook nil
927 "Hook run in message mode buffers."
928 :group 'message-various
929 :type 'hook)
930
931(defcustom message-header-hook nil
932 "Hook run in a message mode buffer narrowed to the headers."
933 :group 'message-various
934 :type 'hook)
935
936(defcustom message-header-setup-hook nil
6748645f 937 "Hook called narrowed to the headers when setting up a message buffer."
eec82323 938 :group 'message-various
23f87bed 939 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
940 :type 'hook)
941
23f87bed
MB
942(defcustom message-minibuffer-local-map
943 (let ((map (make-sparse-keymap 'message-minibuffer-local-map)))
944 (set-keymap-parent map minibuffer-local-map)
945 map)
e2642250 946 "Keymap for `message-read-from-minibuffer'."
d0859c9a
MB
947 :version "22.1"
948 :group 'message-various)
23f87bed 949
eec82323 950(defcustom message-citation-line-function 'message-insert-citation-line
23f87bed
MB
951 "*Function called to insert the \"Whomever writes:\" line.
952
01c52d31 953Predefined functions include `message-insert-citation-line' and
4d8a28ec 954`message-insert-formatted-citation-line' (see the variable
01c52d31
MB
955`message-citation-line-format').
956
23f87bed
MB
957Note that Gnus provides a feature where the reader can click on
958`writes:' to hide the cited text. If you change this line too much,
959people who read your message will have to change their Gnus
960configuration. See the variable `gnus-cite-attribution-suffix'."
01c52d31
MB
961 :type '(choice
962 (function-item :tag "plain" message-insert-citation-line)
4d8a28ec 963 (function-item :tag "formatted" message-insert-formatted-citation-line)
01c52d31 964 (function :tag "Other"))
23f87bed 965 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
966 :group 'message-insertion)
967
01c52d31
MB
968(defcustom message-citation-line-format "On %a, %b %d %Y, %N wrote:\n"
969 "Format of the \"Whomever writes:\" line.
970
971The string is formatted using `format-spec'. The following
972constructs are replaced:
973
974 %f The full From, e.g. \"John Doe <john.doe@example.invalid>\".
975 %n The mail address, e.g. \"john.doe@example.invalid\".
976 %N The real name if present, e.g.: \"John Doe\", else fall
977 back to the mail address.
978 %F The first name if present, e.g.: \"John\".
979 %L The last name if present, e.g.: \"Doe\".
980
981All other format specifiers are passed to `format-time-string'
982which is called using the date from the article your replying to.
983Extracting the first (%F) and last name (%L) is done
984heuristically, so you should always check it yourself.
985
986Please also read the note in the documentation of
987`message-citation-line-function'."
988 :type '(choice (const :tag "Plain" "%f writes:")
989 (const :tag "Include date" "On %a, %b %d %Y, %n wrote:")
990 string)
991 :link '(custom-manual "(message)Insertion Variables")
330f707b 992 :version "23.1" ;; No Gnus
01c52d31
MB
993 :group 'message-insertion)
994
e0a185ae 995(defcustom message-yank-prefix mail-yank-prefix
23f87bed
MB
996 "*Prefix inserted on the lines of yanked messages.
997Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
01c52d31 998See also `message-yank-cited-prefix' and `message-yank-empty-prefix'."
937e60c8 999 :version "23.2"
23f87bed
MB
1000 :type 'string
1001 :link '(custom-manual "(message)Insertion Variables")
1002 :group 'message-insertion)
1003
1004(defcustom message-yank-cited-prefix ">"
01c52d31 1005 "*Prefix inserted on cited lines of yanked messages.
23f87bed 1006Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
01c52d31
MB
1007See also `message-yank-prefix' and `message-yank-empty-prefix'."
1008 :version "22.1"
1009 :type 'string
1010 :link '(custom-manual "(message)Insertion Variables")
1011 :group 'message-insertion)
1012
1013(defcustom message-yank-empty-prefix ">"
1014 "*Prefix inserted on empty lines of yanked messages.
1015See also `message-yank-prefix' and `message-yank-cited-prefix'."
bf247b6e 1016 :version "22.1"
eec82323 1017 :type 'string
23f87bed 1018 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
1019 :group 'message-insertion)
1020
e0a185ae 1021(defcustom message-indentation-spaces mail-indentation-spaces
eec82323
LMI
1022 "*Number of spaces to insert at the beginning of each cited line.
1023Used by `message-yank-original' via `message-yank-cite'."
937e60c8 1024 :version "23.2"
eec82323 1025 :group 'message-insertion
23f87bed 1026 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
1027 :type 'integer)
1028
9b3ebcb6 1029(defcustom message-cite-function 'message-cite-original-without-signature
4a55f847
RS
1030 "*Function for citing an original message.
1031Predefined functions include `message-cite-original' and
1032`message-cite-original-without-signature'.
01c52d31 1033Note that these functions use `mail-citation-hook' if that is non-nil."
eec82323 1034 :type '(radio (function-item message-cite-original)
16409b0b 1035 (function-item message-cite-original-without-signature)
eec82323
LMI
1036 (function-item sc-cite-original)
1037 (function :tag "Other"))
23f87bed 1038 :link '(custom-manual "(message)Insertion Variables")
d55fe5bb 1039 :version "22.3" ;; Gnus 5.10.12 (changed default)
eec82323
LMI
1040 :group 'message-insertion)
1041
eec82323
LMI
1042(defcustom message-indent-citation-function 'message-indent-citation
1043 "*Function for modifying a citation just inserted in the mail buffer.
1044This can also be a list of functions. Each function can find the
1045citation between (point) and (mark t). And each function should leave
1046point and mark around the citation text as modified."
1047 :type 'function
23f87bed 1048 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
1049 :group 'message-insertion)
1050
937e60c8 1051(defcustom message-signature mail-signature
eec82323
LMI
1052 "*String to be inserted at the end of the message buffer.
1053If t, the `message-signature-file' file will be inserted instead.
1054If a function, the result from the function will be used instead.
1055If a form, the result from the form will be used instead."
937e60c8 1056 :version "23.2"
eec82323 1057 :type 'sexp
23f87bed 1058 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
1059 :group 'message-insertion)
1060
e0a185ae 1061(defcustom message-signature-file mail-signature-file
5449c317
DL
1062 "*Name of file containing the text inserted at end of message buffer.
1063Ignored if the named file doesn't exist.
01c52d31
MB
1064If nil, don't insert a signature.
1065If a path is specified, the value of `message-signature-directory' is ignored,
1066even if set."
937e60c8 1067 :version "23.2"
5449c317 1068 :type '(choice file (const :tags "None" nil))
23f87bed
MB
1069 :link '(custom-manual "(message)Insertion Variables")
1070 :group 'message-insertion)
1071
01c52d31
MB
1072(defcustom message-signature-directory nil
1073 "*Name of directory containing signature files.
1074Comes in handy if you have many such files, handled via posting styles for
1075instance.
1076If nil, `message-signature-file' is expected to specify the directory if
1077needed."
1078 :type '(choice string (const :tags "None" nil))
1079 :link '(custom-manual "(message)Insertion Variables")
1080 :group 'message-insertion)
1081
23f87bed
MB
1082(defcustom message-signature-insert-empty-line t
1083 "*If non-nil, insert an empty line before the signature separator."
bf247b6e 1084 :version "22.1"
23f87bed
MB
1085 :type 'boolean
1086 :link '(custom-manual "(message)Insertion Variables")
eec82323
LMI
1087 :group 'message-insertion)
1088
706b5974
G
1089(defcustom message-cite-reply-position 'traditional
1090 "*Where the reply should be positioned.
1091If `traditional', reply inline.
1092If `above', reply above quoted text.
1093If `below', reply below quoted text.
1094
1095Note: Many newsgroups frown upon nontraditional reply styles. You
1096probably want to set this variable only for specific groups,
1097e.g. using `gnus-posting-styles':
1098
b5244046 1099 (eval (set (make-local-variable 'message-cite-reply-position) 'above))"
2bed3f04 1100 :version "24.1"
706b5974
G
1101 :type '(choice (const :tag "Reply inline" 'traditional)
1102 (const :tag "Reply above" 'above)
1103 (const :tag "Reply below" 'below))
1104 :group 'message-insertion)
1105
1106(defcustom message-cite-style nil
1107 "*The overall style to be used when yanking cited text.
1108Value is either `nil' (no variable overrides) or a let-style list
1109of pairs (VARIABLE VALUE) that will be bound in
1110`message-yank-original' to do the quoting.
1111
1112Presets to impersonate popular mail agents are found in the
1113message-cite-style-* variables. This variable is intended for
1114use in `gnus-posting-styles', such as:
1115
1116 ((posting-from-work-p) (eval (set (make-local-variable 'message-cite-style) message-cite-style-outlook)))"
1117 :version "24.1"
1118 :group 'message-insertion
1119 :type '(choice (const :tag "Do not override variables" :value nil)
1120 (const :tag "MS Outlook" :value message-cite-style-outlook)
1121 (const :tag "Mozilla Thunderbird" :value message-cite-style-thunderbird)
1122 (const :tag "Gmail" :value message-cite-style-gmail)
1123 (variable :tag "User-specified")))
1124
1125(defconst message-cite-style-outlook
1126 '((message-cite-function 'message-cite-original)
1127 (message-citation-line-function 'message-insert-formatted-citation-line)
1128 (message-cite-reply-position 'above)
1129 (message-yank-prefix "")
1130 (message-yank-cited-prefix "")
1131 (message-yank-empty-prefix "")
1132 (message-citation-line-format "\n\n-----------------------\nOn %a, %b %d %Y, %N wrote:\n"))
1133 "Message citation style used by MS Outlook. Use with message-cite-style.")
1134
1135(defconst message-cite-style-thunderbird
1136 '((message-cite-function 'message-cite-original)
1137 (message-citation-line-function 'message-insert-formatted-citation-line)
1138 (message-cite-reply-position 'above)
1139 (message-yank-prefix "> ")
1140 (message-yank-cited-prefix ">")
1141 (message-yank-empty-prefix ">")
1142 (message-citation-line-format "On %D %R %p, %N wrote:"))
1143 "Message citation style used by Mozilla Thunderbird. Use with message-cite-style.")
1144
1145(defconst message-cite-style-gmail
1146 '((message-cite-function 'message-cite-original)
1147 (message-citation-line-function 'message-insert-formatted-citation-line)
1148 (message-cite-reply-position 'above)
1149 (message-yank-prefix " ")
1150 (message-yank-cited-prefix " ")
1151 (message-yank-empty-prefix " ")
1152 (message-citation-line-format "On %e %B %Y %R, %f wrote:\n"))
1153 "Message citation style used by Gmail. Use with message-cite-style.")
1154
eec82323
LMI
1155(defcustom message-distribution-function nil
1156 "*Function called to return a Distribution header."
1157 :group 'message-news
1158 :group 'message-headers
23f87bed 1159 :link '(custom-manual "(message)News Headers")
7d829636 1160 :type '(choice function (const nil)))
eec82323
LMI
1161
1162(defcustom message-expires 14
1163 "Number of days before your article expires."
1164 :group 'message-news
1165 :group 'message-headers
1166 :link '(custom-manual "(message)News Headers")
1167 :type 'integer)
1168
1169(defcustom message-user-path nil
1170 "If nil, use the NNTP server name in the Path header.
1171If stringp, use this; if non-nil, use no host name (user name only)."
1172 :group 'message-news
1173 :group 'message-headers
1174 :link '(custom-manual "(message)News Headers")
1175 :type '(choice (const :tag "nntp" nil)
1176 (string :tag "name")
1177 (sexp :tag "none" :format "%t" t)))
1178
b1ea3797
CY
1179;; This can be the name of a buffer, or a cons cell (FUNCTION . ARGS)
1180;; for yanking the original buffer.
eec82323 1181(defvar message-reply-buffer nil)
23f87bed
MB
1182(defvar message-reply-headers nil
1183 "The headers of the current replied article.
1184It is a vector of the following headers:
1185\[number subject from date id references chars lines xref extra].")
eec82323
LMI
1186(defvar message-newsreader nil)
1187(defvar message-mailer nil)
1188(defvar message-sent-message-via nil)
1189(defvar message-checksum nil)
1190(defvar message-send-actions nil
1191 "A list of actions to be performed upon successful sending of a message.")
25ca2e61 1192(defvar message-return-action nil
9173deec 1193 "Action to return to the caller after sending or postponing a message.")
eec82323
LMI
1194(defvar message-exit-actions nil
1195 "A list of actions to be performed upon exiting after sending a message.")
1196(defvar message-kill-actions nil
1197 "A list of actions to be performed before killing a message buffer.")
1198(defvar message-postpone-actions nil
1199 "A list of actions to be performed after postponing a message.")
1200
6748645f
LMI
1201(define-widget 'message-header-lines 'text
1202 "All header lines must be LFD terminated."
3536d0c1 1203 :format "%{%t%}:%n%v"
6748645f
LMI
1204 :valid-regexp "^\\'"
1205 :error "All header lines must be newline terminated")
1206
481134fd 1207(defcustom message-default-headers ""
b5c575e6
G
1208 "Header lines to be inserted in outgoing messages.
1209This can be set to a string containing or a function returning
1210header lines to be inserted before you edit the message, so you
1211can edit or delete these lines. If set to a function, it is
1212called and its result is inserted."
937e60c8 1213 :version "23.2"
eec82323 1214 :group 'message-headers
23f87bed 1215 :link '(custom-manual "(message)Message Headers")
b5c575e6
G
1216 :type '(choice
1217 (message-header-lines :tag "String")
1218 (function :tag "Function")))
eec82323 1219
dc4d6273
GM
1220(defcustom message-default-mail-headers
1221 ;; Ease the transition from mail-mode to message-mode. See bugs#4431, 5555.
1222 (concat (if (and (boundp 'mail-default-reply-to)
1223 (stringp mail-default-reply-to))
481134fd 1224 (format "Reply-to: %s\n" mail-default-reply-to))
dc4d6273
GM
1225 (if (and (boundp 'mail-self-blind)
1226 mail-self-blind)
481134fd 1227 (format "BCC: %s\n" user-mail-address))
dc4d6273
GM
1228 (if (and (boundp 'mail-archive-file-name)
1229 (stringp mail-archive-file-name))
481134fd
CY
1230 (format "FCC: %s\n" mail-archive-file-name))
1231 ;; Use the value of `mail-default-headers' if available.
5b5dafd2
KY
1232 ;; Note: as for XEmacs 21.4 and 21.5, it is unavailable
1233 ;; unless sendmail.el is loaded.
481134fd
CY
1234 (if (boundp 'mail-default-headers)
1235 mail-default-headers))
eec82323 1236 "*A string of header lines to be inserted in outgoing mails."
dc4d6273 1237 :version "23.2"
eec82323
LMI
1238 :group 'message-headers
1239 :group 'message-mail
23f87bed 1240 :link '(custom-manual "(message)Mail Headers")
6748645f 1241 :type 'message-header-lines)
eec82323
LMI
1242
1243(defcustom message-default-news-headers ""
16409b0b 1244 "*A string of header lines to be inserted in outgoing news articles."
eec82323
LMI
1245 :group 'message-headers
1246 :group 'message-news
23f87bed 1247 :link '(custom-manual "(message)News Headers")
6748645f 1248 :type 'message-header-lines)
eec82323
LMI
1249
1250;; Note: could use /usr/ucb/mail instead of sendmail;
1251;; options -t, and -v if not interactive.
1252(defcustom message-mailer-swallows-blank-line
1253 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)"
1254 system-configuration)
1255 (file-readable-p "/etc/sendmail.cf")
8dabbfd6
SM
1256 (with-temp-buffer
1257 (insert-file-contents "/etc/sendmail.cf")
1258 (goto-char (point-min))
1259 (let ((case-fold-search nil))
1260 (re-search-forward "^OR\\>" nil t))))
eec82323
LMI
1261 ;; According to RFC822, "The field-name must be composed of printable
1262 ;; ASCII characters (i. e., characters that have decimal values between
1263 ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
1264 ;; space, or colon.
1265 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:"))
6748645f 1266 "*Set this non-nil if the system's mailer runs the header and body together.
eec82323
LMI
1267\(This problem exists on Sunos 4 when sendmail is run in remote mode.)
1268The value should be an expression to test whether the problem will
1269actually occur."
1270 :group 'message-sending
23f87bed 1271 :link '(custom-manual "(message)Mail Variables")
eec82323
LMI
1272 :type 'sexp)
1273
961a48db 1274;;;###autoload
16409b0b
GM
1275(define-mail-user-agent 'message-user-agent
1276 'message-mail 'message-send-and-exit
1277 'message-kill-buffer 'message-send-hook)
eec82323
LMI
1278
1279(defvar message-mh-deletable-headers '(Message-ID Date Lines Sender)
1280 "If non-nil, delete the deletable headers before feeding to mh.")
1281
a8151ef7
LMI
1282(defvar message-send-method-alist
1283 '((news message-news-p message-send-via-news)
1284 (mail message-mail-p message-send-via-mail))
1285 "Alist of ways to send outgoing messages.
1286Each element has the form
1287
1288 \(TYPE PREDICATE FUNCTION)
1289
1290where TYPE is a symbol that names the method; PREDICATE is a function
1291called without any parameters to determine whether the message is
1292a message of type TYPE; and FUNCTION is a function to be called if
1293PREDICATE returns non-nil. FUNCTION is called with one parameter --
1294the prefix.")
1295
c541eb9a 1296(defcustom message-mail-alias-type 'abbrev
a8151ef7 1297 "*What alias expansion type to use in Message buffers.
01c52d31
MB
1298The default is `abbrev', which uses mailabbrev. `ecomplete' uses
1299an electric completion mode. nil switches mail aliases off.
1300This can also be a list of values."
c541eb9a
DL
1301 :group 'message
1302 :link '(custom-manual "(message)Mail Aliases")
1303 :type '(choice (const :tag "Use Mailabbrev" abbrev)
01c52d31 1304 (const :tag "Use ecomplete" ecomplete)
c541eb9a 1305 (const :tag "No expansion" nil)))
a8151ef7 1306
01c52d31
MB
1307(defcustom message-self-insert-commands '(self-insert-command)
1308 "List of `self-insert-command's used to trigger ecomplete.
1309When one of those commands is invoked to enter a character in To or Cc
1310header, ecomplete will suggest the candidates of recipients (see also
1311`message-mail-alias-type'). If you use some tool to enter non-ASCII
1312text and it replaces `self-insert-command' with the other command, e.g.
1313`egg-self-insert-command', you may want to add it to this list."
1314 :group 'message-various
1315 :type '(repeat function))
1316
6748645f 1317(defcustom message-auto-save-directory
4dcb0d7a 1318 (if (file-writable-p message-directory)
64a465b2
LMI
1319 (file-name-as-directory (expand-file-name "drafts" message-directory))
1320 "~/")
6748645f
LMI
1321 "*Directory where Message auto-saves buffers if Gnus isn't running.
1322If nil, Message won't auto-save."
1323 :group 'message-buffers
23f87bed 1324 :link '(custom-manual "(message)Various Message Variables")
7d829636 1325 :type '(choice directory (const :tag "Don't auto-save" nil)))
6748645f 1326
7d829636 1327(defcustom message-default-charset
83595c0c
DL
1328 (and (not (mm-multibyte-p)) 'iso-8859-1)
1329 "Default charset used in non-MULE Emacsen.
1330If nil, you might be asked to input the charset."
2d447df6 1331 :version "21.1"
16409b0b 1332 :group 'message
23f87bed 1333 :link '(custom-manual "(message)Various Message Variables")
16409b0b
GM
1334 :type 'symbol)
1335
7d829636 1336(defcustom message-dont-reply-to-names
0fb40182 1337 (and (boundp 'mail-dont-reply-to-names) mail-dont-reply-to-names)
01c52d31 1338 "*Addresses to prune when doing wide replies.
82816ba1 1339This can be a regexp or a list of regexps. Also, a value of nil means
01c52d31 1340exclude your own user name only."
2a1e2476 1341 :version "24.3"
16409b0b 1342 :group 'message
23f87bed 1343 :link '(custom-manual "(message)Wide Reply")
16409b0b 1344 :type '(choice (const :tag "Yourself" nil)
01c52d31
MB
1345 regexp
1346 (repeat :tag "Regexp List" regexp)))
1347
1348(defsubst message-dont-reply-to-names ()
1349 (gmm-regexp-concat message-dont-reply-to-names))
16409b0b 1350
23f87bed
MB
1351(defvar message-shoot-gnksa-feet nil
1352 "*A list of GNKSA feet you are allowed to shoot.
1353Gnus gives you all the opportunity you could possibly want for
1354shooting yourself in the foot. Also, Gnus allows you to shoot the
1355feet of Good Net-Keeping Seal of Approval. The following are foot
1356candidates:
1357`empty-article' Allow you to post an empty article;
1358`quoted-text-only' Allow you to post quoted text only;
1359`multiple-copies' Allow you to post multiple copies;
1360`cancel-messages' Allow you to cancel or supersede messages from
4dcb0d7a
LMI
1361 your other email addresses;
1362`canlock-verify' Allow you to cancel messages without verifying canlock.")
23f87bed
MB
1363
1364(defsubst message-gnksa-enable-p (feature)
1365 (or (not (listp message-shoot-gnksa-feet))
1366 (memq feature message-shoot-gnksa-feet)))
1367
01c52d31
MB
1368(defcustom message-hidden-headers '("^References:" "^Face:" "^X-Face:"
1369 "^X-Draft-From:")
23f87bed
MB
1370 "Regexp of headers to be hidden when composing new messages.
1371This can also be a list of regexps to match headers. Or a list
1372starting with `not' and followed by regexps."
bf247b6e 1373 :version "22.1"
23f87bed
MB
1374 :group 'message
1375 :link '(custom-manual "(message)Message Headers")
01c52d31
MB
1376 :type '(choice
1377 :format "%{%t%}: %[Value Type%] %v"
1378 (regexp :menu-tag "regexp" :format "regexp\n%t: %v")
1379 (repeat :menu-tag "(regexp ...)" :format "(regexp ...)\n%v%i"
1380 (regexp :format "%t: %v"))
1381 (cons :menu-tag "(not regexp ...)" :format "(not regexp ...)\n%v"
1382 (const not)
1383 (repeat :format "%v%i"
1384 (regexp :format "%t: %v")))))
1385
1386(defcustom message-cite-articles-with-x-no-archive t
1387 "If non-nil, cite text from articles that has X-No-Archive set."
1388 :group 'message
1389 :type 'boolean)
23f87bed 1390
eec82323
LMI
1391;;; Internal variables.
1392;;; Well, not really internal.
1393
1394(defvar message-mode-syntax-table
1395 (let ((table (copy-syntax-table text-mode-syntax-table)))
1396 (modify-syntax-entry ?% ". " table)
16409b0b
GM
1397 (modify-syntax-entry ?> ". " table)
1398 (modify-syntax-entry ?< ". " table)
eec82323
LMI
1399 table)
1400 "Syntax table used while in Message mode.")
1401
0f49874b 1402(defface message-header-to
eec82323
LMI
1403 '((((class color)
1404 (background dark))
01c52d31 1405 (:foreground "DarkOliveGreen1" :bold t))
eec82323
LMI
1406 (((class color)
1407 (background light))
23f87bed 1408 (:foreground "MidnightBlue" :bold t))
eec82323 1409 (t
23f87bed 1410 (:bold t :italic t)))
eec82323
LMI
1411 "Face used for displaying From headers."
1412 :group 'message-faces)
0f49874b
MB
1413;; backward-compatibility alias
1414(put 'message-header-to-face 'face-alias 'message-header-to)
3d493bef 1415(put 'message-header-to-face 'obsolete-face "22.1")
eec82323 1416
0f49874b 1417(defface message-header-cc
eec82323
LMI
1418 '((((class color)
1419 (background dark))
01c52d31 1420 (:foreground "chartreuse1" :bold t))
eec82323
LMI
1421 (((class color)
1422 (background light))
1423 (:foreground "MidnightBlue"))
1424 (t
23f87bed 1425 (:bold t)))
eec82323
LMI
1426 "Face used for displaying Cc headers."
1427 :group 'message-faces)
0f49874b
MB
1428;; backward-compatibility alias
1429(put 'message-header-cc-face 'face-alias 'message-header-cc)
3d493bef 1430(put 'message-header-cc-face 'obsolete-face "22.1")
eec82323 1431
0f49874b 1432(defface message-header-subject
eec82323
LMI
1433 '((((class color)
1434 (background dark))
01c52d31 1435 (:foreground "OliveDrab1"))
eec82323
LMI
1436 (((class color)
1437 (background light))
23f87bed 1438 (:foreground "navy blue" :bold t))
eec82323 1439 (t
23f87bed 1440 (:bold t)))
eec82323
LMI
1441 "Face used for displaying subject headers."
1442 :group 'message-faces)
0f49874b
MB
1443;; backward-compatibility alias
1444(put 'message-header-subject-face 'face-alias 'message-header-subject)
3d493bef 1445(put 'message-header-subject-face 'obsolete-face "22.1")
eec82323 1446
0f49874b 1447(defface message-header-newsgroups
eec82323
LMI
1448 '((((class color)
1449 (background dark))
23f87bed 1450 (:foreground "yellow" :bold t :italic t))
eec82323
LMI
1451 (((class color)
1452 (background light))
23f87bed 1453 (:foreground "blue4" :bold t :italic t))
eec82323 1454 (t
23f87bed 1455 (:bold t :italic t)))
eec82323
LMI
1456 "Face used for displaying newsgroups headers."
1457 :group 'message-faces)
0f49874b
MB
1458;; backward-compatibility alias
1459(put 'message-header-newsgroups-face 'face-alias 'message-header-newsgroups)
3d493bef 1460(put 'message-header-newsgroups-face 'obsolete-face "22.1")
eec82323 1461
0f49874b 1462(defface message-header-other
eec82323
LMI
1463 '((((class color)
1464 (background dark))
01c52d31 1465 (:foreground "VioletRed1"))
eec82323
LMI
1466 (((class color)
1467 (background light))
1468 (:foreground "steel blue"))
1469 (t
23f87bed 1470 (:bold t :italic t)))
eec82323
LMI
1471 "Face used for displaying newsgroups headers."
1472 :group 'message-faces)
0f49874b
MB
1473;; backward-compatibility alias
1474(put 'message-header-other-face 'face-alias 'message-header-other)
3d493bef 1475(put 'message-header-other-face 'obsolete-face "22.1")
eec82323 1476
0f49874b 1477(defface message-header-name
eec82323
LMI
1478 '((((class color)
1479 (background dark))
01c52d31 1480 (:foreground "green"))
eec82323
LMI
1481 (((class color)
1482 (background light))
1483 (:foreground "cornflower blue"))
1484 (t
23f87bed 1485 (:bold t)))
eec82323
LMI
1486 "Face used for displaying header names."
1487 :group 'message-faces)
0f49874b
MB
1488;; backward-compatibility alias
1489(put 'message-header-name-face 'face-alias 'message-header-name)
3d493bef 1490(put 'message-header-name-face 'obsolete-face "22.1")
eec82323 1491
0f49874b 1492(defface message-header-xheader
eec82323
LMI
1493 '((((class color)
1494 (background dark))
01c52d31 1495 (:foreground "DeepSkyBlue1"))
eec82323
LMI
1496 (((class color)
1497 (background light))
1498 (:foreground "blue"))
1499 (t
23f87bed 1500 (:bold t)))
eec82323
LMI
1501 "Face used for displaying X-Header headers."
1502 :group 'message-faces)
0f49874b
MB
1503;; backward-compatibility alias
1504(put 'message-header-xheader-face 'face-alias 'message-header-xheader)
3d493bef 1505(put 'message-header-xheader-face 'obsolete-face "22.1")
eec82323 1506
0f49874b 1507(defface message-separator
eec82323
LMI
1508 '((((class color)
1509 (background dark))
01c52d31 1510 (:foreground "LightSkyBlue1"))
eec82323
LMI
1511 (((class color)
1512 (background light))
1513 (:foreground "brown"))
1514 (t
23f87bed 1515 (:bold t)))
eec82323
LMI
1516 "Face used for displaying the separator."
1517 :group 'message-faces)
0f49874b
MB
1518;; backward-compatibility alias
1519(put 'message-separator-face 'face-alias 'message-separator)
3d493bef 1520(put 'message-separator-face 'obsolete-face "22.1")
eec82323 1521
0f49874b 1522(defface message-cited-text
eec82323
LMI
1523 '((((class color)
1524 (background dark))
01c52d31 1525 (:foreground "LightPink1"))
eec82323
LMI
1526 (((class color)
1527 (background light))
1528 (:foreground "red"))
1529 (t
23f87bed 1530 (:bold t)))
eec82323
LMI
1531 "Face used for displaying cited text names."
1532 :group 'message-faces)
0f49874b
MB
1533;; backward-compatibility alias
1534(put 'message-cited-text-face 'face-alias 'message-cited-text)
3d493bef 1535(put 'message-cited-text-face 'obsolete-face "22.1")
eec82323 1536
0f49874b 1537(defface message-mml
16409b0b
GM
1538 '((((class color)
1539 (background dark))
01c52d31 1540 (:foreground "MediumSpringGreen"))
16409b0b
GM
1541 (((class color)
1542 (background light))
1543 (:foreground "ForestGreen"))
1544 (t
23f87bed 1545 (:bold t)))
16409b0b
GM
1546 "Face used for displaying MML."
1547 :group 'message-faces)
0f49874b
MB
1548;; backward-compatibility alias
1549(put 'message-mml-face 'face-alias 'message-mml)
3d493bef 1550(put 'message-mml-face 'obsolete-face "22.1")
16409b0b 1551
23f87bed
MB
1552(defun message-font-lock-make-header-matcher (regexp)
1553 (let ((form
1554 `(lambda (limit)
1555 (let ((start (point)))
1556 (save-restriction
1557 (widen)
1558 (goto-char (point-min))
1559 (if (re-search-forward
1560 (concat "^" (regexp-quote mail-header-separator) "$")
1561 nil t)
1562 (setq limit (min limit (match-beginning 0))))
1563 (goto-char start))
1564 (and (< start limit)
1565 (re-search-forward ,regexp limit t))))))
1566 (if (featurep 'bytecomp)
1567 (byte-compile form)
1568 form)))
1569
eec82323 1570(defvar message-font-lock-keywords
23f87bed
MB
1571 (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?"))
1572 `((,(message-font-lock-make-header-matcher
1573 (concat "^\\([Tt]o:\\)" content))
0f49874b
MB
1574 (1 'message-header-name)
1575 (2 'message-header-to nil t))
23f87bed
MB
1576 (,(message-font-lock-make-header-matcher
1577 (concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content))
0f49874b
MB
1578 (1 'message-header-name)
1579 (2 'message-header-cc nil t))
23f87bed
MB
1580 (,(message-font-lock-make-header-matcher
1581 (concat "^\\([Ss]ubject:\\)" content))
0f49874b
MB
1582 (1 'message-header-name)
1583 (2 'message-header-subject nil t))
23f87bed
MB
1584 (,(message-font-lock-make-header-matcher
1585 (concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content))
0f49874b
MB
1586 (1 'message-header-name)
1587 (2 'message-header-newsgroups nil t))
23f87bed 1588 (,(message-font-lock-make-header-matcher
01c52d31 1589 (concat "^\\(X-[A-Za-z0-9-]+:\\|In-Reply-To:\\)" content))
0f49874b 1590 (1 'message-header-name)
01c52d31 1591 (2 'message-header-xheader))
23f87bed 1592 (,(message-font-lock-make-header-matcher
01c52d31 1593 (concat "^\\([A-Z][^: \n\t]+:\\)" content))
0f49874b 1594 (1 'message-header-name)
01c52d31 1595 (2 'message-header-other nil t))
6748645f
LMI
1596 ,@(if (and mail-header-separator
1597 (not (equal mail-header-separator "")))
1598 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
0f49874b 1599 1 'message-separator))
6748645f 1600 nil)
23f87bed
MB
1601 ((lambda (limit)
1602 (re-search-forward (concat "^\\("
1603 message-cite-prefix-regexp
1604 "\\).*")
1605 limit t))
0f49874b 1606 (0 'message-cited-text))
23f87bed 1607 ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
0f49874b 1608 (0 'message-mml))))
eec82323
LMI
1609 "Additional expressions to highlight in Message mode.")
1610
23f87bed 1611
6748645f
LMI
1612;; XEmacs does it like this. For Emacs, we have to set the
1613;; `font-lock-defaults' buffer-local variable.
1614(put 'message-mode 'font-lock-defaults '(message-font-lock-keywords t))
1615
eec82323 1616(defvar message-face-alist
01c52d31 1617 '((bold . message-bold-region)
eec82323
LMI
1618 (underline . underline-region)
1619 (default . (lambda (b e)
01c52d31 1620 (message-unbold-region b e)
eec82323
LMI
1621 (ununderline-region b e))))
1622 "Alist of mail and news faces for facemenu.
8f688cb0 1623The cdr of each entry is a function for applying the face to a region.")
eec82323 1624
4e14547f
CY
1625(defcustom message-send-hook nil
1626 "Hook run before sending messages.
1627This hook is run quite early when sending."
1628 :group 'message-various
1629 :options '(ispell-message)
1630 :link '(custom-manual "(message)Various Message Variables")
1631 :type 'hook)
eec82323
LMI
1632
1633(defcustom message-send-mail-hook nil
23f87bed
MB
1634 "Hook run before sending mail messages.
1635This hook is run very late -- just before the message is sent as
1636mail."
eec82323 1637 :group 'message-various
23f87bed 1638 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
1639 :type 'hook)
1640
1641(defcustom message-send-news-hook nil
23f87bed
MB
1642 "Hook run before sending news messages.
1643This hook is run very late -- just before the message is sent as
1644news."
eec82323 1645 :group 'message-various
23f87bed 1646 :link '(custom-manual "(message)Various Message Variables")
eec82323
LMI
1647 :type 'hook)
1648
1649(defcustom message-sent-hook nil
1650 "Hook run after sending messages."
1651 :group 'message-various
1652 :type 'hook)
1653
6748645f
LMI
1654(defvar message-send-coding-system 'binary
1655 "Coding system to encode outgoing mail.")
1656
16409b0b
GM
1657(defvar message-draft-coding-system
1658 mm-auto-save-coding-system
23f87bed
MB
1659 "*Coding system to compose mail.
1660If you'd like to make it possible to share draft files between XEmacs
1661and Emacs, you may use `iso-2022-7bit' for this value at your own risk.
1662Note that the coding-system `iso-2022-7bit' isn't suitable to all data.")
16409b0b 1663
8bff7c00 1664(defcustom message-send-mail-partially-limit nil
16409b0b 1665 "The limitation of messages sent as message/partial.
7d829636
DL
1666The lower bound of message size in characters, beyond which the message
1667should be sent in several parts. If it is nil, the size is unlimited."
1a10d421 1668 :version "24.1"
16409b0b 1669 :group 'message-buffers
23f87bed 1670 :link '(custom-manual "(message)Mail Variables")
16409b0b
GM
1671 :type '(choice (const :tag "unlimited" nil)
1672 (integer 1000000)))
1673
83595c0c 1674(defcustom message-alternative-emails nil
46e8fe3d
MB
1675 "*Regexp matching alternative email addresses.
1676The first address in the To, Cc or From headers of the original
1677article matching this variable is used as the From field of
1678outgoing messages.
1679
1680This variable has precedence over posting styles and anything that runs
1681off `message-setup-hook'."
83595c0c 1682 :group 'message-headers
23f87bed 1683 :link '(custom-manual "(message)Message Headers")
83595c0c
DL
1684 :type '(choice (const :tag "Always use primary" nil)
1685 regexp))
1686
23f87bed
MB
1687(defcustom message-hierarchical-addresses nil
1688 "A list of hierarchical mail address definitions.
1689
1690Inside each entry, the first address is the \"top\" address, and
1691subsequent addresses are subaddresses; this is used to indicate that
1692mail sent to the first address will automatically be delivered to the
1693subaddresses. So if the first address appears in the recipient list
1694for a message, the subaddresses will be removed (if present) before
1695the mail is sent. All addresses in this structure should be
1696downcased."
bf247b6e 1697 :version "22.1"
23f87bed
MB
1698 :group 'message-headers
1699 :type '(repeat (repeat string)))
1700
88818fbe
SZ
1701(defcustom message-mail-user-agent nil
1702 "Like `mail-user-agent'.
7d829636 1703Except if it is nil, use Gnus native MUA; if it is t, use
88818fbe 1704`mail-user-agent'."
bf247b6e 1705 :version "22.1"
88818fbe
SZ
1706 :type '(radio (const :tag "Gnus native"
1707 :format "%t\n"
1708 nil)
1709 (const :tag "`mail-user-agent'"
1710 :format "%t\n"
1711 t)
1712 (function-item :tag "Default Emacs mail"
1713 :format "%t\n"
1714 sendmail-user-agent)
1715 (function-item :tag "Emacs interface to MH"
1716 :format "%t\n"
1717 mh-e-user-agent)
1718 (function :tag "Other"))
1719 :version "21.1"
1720 :group 'message)
1721
23f87bed
MB
1722(defcustom message-wide-reply-confirm-recipients nil
1723 "Whether to confirm a wide reply to multiple email recipients.
1724If this variable is nil, don't ask whether to reply to all recipients.
1725If this variable is non-nil, pose the question \"Reply to all
1726recipients?\" before a wide reply to multiple recipients. If the user
1727answers yes, reply to all recipients as usual. If the user answers
1728no, only reply back to the author."
bf247b6e 1729 :version "22.1"
23f87bed
MB
1730 :group 'message-headers
1731 :link '(custom-manual "(message)Wide Reply")
1732 :type 'boolean)
1733
1734(defcustom message-user-fqdn nil
bcc7dd61 1735 "*Domain part of Message-Ids."
bf247b6e 1736 :version "22.1"
23f87bed
MB
1737 :group 'message-headers
1738 :link '(custom-manual "(message)News Headers")
1739 :type '(radio (const :format "%v " nil)
ad136a7c 1740 (string :format "FQDN: %v")))
23f87bed
MB
1741
1742(defcustom message-use-idna (and (condition-case nil (require 'idna)
1743 (file-error))
1744 (mm-coding-system-p 'utf-8)
1745 (executable-find idna-program)
a33704bb
MB
1746