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