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