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