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