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