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