1 ;;; message.el --- composing mail and news messages
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Keywords: mail, news
9 ;; This file is part of GNU Emacs.
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.
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.
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/>.
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.
33 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
40 ;; Only for the trivial macros mail-header-from, mail-header-date
41 ;; mail-header-references, mail-header-subject, mail-header-id
42 (eval-when-compile (require 'nnheader))
43 ;; This is apparently necessary even though things are autoloaded.
44 ;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better
45 ;; require mailabbrev here.
46 (if (featurep 'xemacs)
47 (require 'mail-abbrevs)
48 (require 'mailabbrev))
53 (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
55 (defvar gnus-message-group-art)
56 (defvar gnus-list-identifiers) ; gnus-sum is required where necessary
57 (defvar rmail-enable-mime-composing)
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")
66 (put 'user-mail-address 'custom-type 'string)
67 (put 'user-full-name 'custom-type 'string)
69 (defgroup message-various nil
70 "Various Message Variables."
71 :link '(custom-manual "(message)Various Message Variables")
74 (defgroup message-buffers nil
76 :link '(custom-manual "(message)Message Buffers")
79 (defgroup message-sending nil
81 :link '(custom-manual "(message)Sending Variables")
84 (defgroup message-interface nil
86 :link '(custom-manual "(message)Interface")
89 (defgroup message-forwarding nil
91 :link '(custom-manual "(message)Forwarding")
92 :group 'message-interface)
94 (defgroup message-insertion nil
96 :link '(custom-manual "(message)Insertion")
99 (defgroup message-headers nil
101 :link '(custom-manual "(message)Message Headers")
104 (defgroup message-news nil
105 "Composing News Messages."
108 (defgroup message-mail nil
109 "Composing Mail Messages."
112 (defgroup message-faces nil
113 "Faces used for message composing."
117 (defcustom message-directory "~/Mail/"
118 "*Directory from which all other mail file variables are derived."
119 :group 'message-various
122 (defcustom message-max-buffers 10
123 "*How many buffers to keep before starting to kill them off."
124 :group 'message-buffers
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)))
132 (defcustom message-fcc-handler-function 'message-output
133 "*A function called to save outgoing articles.
134 This function will be called with the name of the file to store the
135 article in. The default function is `message-output' which saves in Unix
137 :type '(radio (function-item message-output)
138 (function :tag "Other"))
139 :group 'message-sending)
141 (defcustom message-fcc-externalize-attachments nil
142 "If non-nil, attachments are included as external parts in Fcc copies."
145 :group 'message-sending)
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.
150 If the string contains the format spec \"%s\", the Newsgroups
151 the article has been posted to will be inserted there.
152 If this variable is nil, no such courtesy message will be added."
153 :group 'message-sending
154 :type '(radio string (const nil)))
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
162 (defcustom message-from-style 'default
163 "*Specifies how \"From\" headers look.
165 If nil, they contain just the return address like:
167 If `parens', they look like:
168 king@grassland.com (Elvis Parsley)
169 If `angles', they look like:
170 Elvis Parsley <king@grassland.com>
172 Otherwise, most addresses look like `angles', but they look like
173 `parens' if `angles' would need quoting and `parens' would not."
175 :type '(choice (const :tag "simple" nil)
179 :group 'message-headers)
181 (defcustom message-insert-canlock t
182 "Whether to insert a Cancel-Lock header in news postings."
184 :group 'message-headers
187 (defcustom message-syntax-checks
188 (if message-insert-canlock '((sender . disabled)) nil)
189 ;; Guess this one shouldn't be easy to customize...
190 "*Controls what syntax checks should not be performed on outgoing posts.
191 To disable checking of long signatures, for instance, add
192 `(signature . disabled)' to this list.
194 Don't touch this variable unless you really know what you're doing.
196 Checks include `approved', `bogus-recipient', `continuation-headers',
197 `control-chars', `empty', `existing-newsgroups', `from', `illegible-text',
198 `invisible-text', `long-header-lines', `long-lines', `message-id',
199 `multiple-headers', `new-text', `newsgroups', `quoting-style',
200 `repeated-newsgroups', `reply-to', `sender', `sendsys', `shoot',
201 `shorten-followup-to', `signature', `size', `subject', `subject-cmsg'
202 and `valid-newsgroups'."
204 :type '(repeat sexp)) ; Fixme: improve this
206 (defcustom message-required-headers '((optional . References)
208 "*Headers to be generated or prompted for when sending a message.
209 Also see `message-required-news-headers' and
210 `message-required-mail-headers'."
213 :group 'message-headers
214 :link '(custom-manual "(message)Message Headers")
215 :type '(repeat sexp))
217 (defcustom message-draft-headers '(References From Date)
218 "*Headers to be generated when saving a draft message."
221 :group 'message-headers
222 :link '(custom-manual "(message)Message Headers")
223 :type '(repeat sexp))
225 (defcustom message-required-news-headers
226 '(From Newsgroups Subject Date Message-ID
227 (optional . Organization)
228 (optional . User-Agent))
229 "*Headers to be generated or prompted for when posting an article.
230 RFC977 and RFC1036 require From, Date, Newsgroups, Subject,
231 Message-ID. Organization, Lines, In-Reply-To, Expires, and
232 User-Agent are optional. If you don't want message to insert some
233 header, remove it from this list."
235 :group 'message-headers
236 :link '(custom-manual "(message)Message Headers")
237 :type '(repeat sexp))
239 (defcustom message-required-mail-headers
240 '(From Subject Date (optional . In-Reply-To) Message-ID
241 (optional . User-Agent))
242 "*Headers to be generated or prompted for when mailing a message.
243 It is recommended that From, Date, To, Subject and Message-ID be
244 included. Organization and User-Agent are optional."
246 :group 'message-headers
247 :link '(custom-manual "(message)Message Headers")
248 :type '(repeat sexp))
250 (defcustom message-deletable-headers '(Message-ID Date Lines)
251 "Headers to be deleted if they already exist and were generated by message previously."
252 :group 'message-headers
253 :link '(custom-manual "(message)Message Headers")
256 (defcustom message-ignored-news-headers
257 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
258 "*Regexp of headers to be removed unconditionally before posting."
260 :group 'message-headers
261 :link '(custom-manual "(message)Message Headers")
262 :type '(repeat :value-to-internal (lambda (widget value)
263 (custom-split-regexp-maybe value))
264 :match (lambda (widget value)
266 (widget-editable-list-match widget value)))
269 (defcustom message-ignored-mail-headers
270 "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
271 "*Regexp of headers to be removed unconditionally before mailing."
273 :group 'message-headers
274 :link '(custom-manual "(message)Mail Headers")
277 (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:"
278 "*Header lines matching this regexp will be deleted before posting.
279 It's best to delete old Path and Date headers before posting to avoid
281 :group 'message-interface
282 :link '(custom-manual "(message)Superseding")
283 :type '(repeat :value-to-internal (lambda (widget value)
284 (custom-split-regexp-maybe value))
285 :match (lambda (widget value)
287 (widget-editable-list-match widget value)))
290 (defcustom message-subject-re-regexp
291 "^[ \t]*\\([Rr][Ee]\\(\\[[0-9]*\\]\\)*:[ \t]*\\)*[ \t]*"
292 "*Regexp matching \"Re: \" in the subject line."
293 :group 'message-various
294 :link '(custom-manual "(message)Message Headers")
297 ;;; Start of variables adopted from `message-utils.el'.
299 (defcustom message-subject-trailing-was-query 'ask
300 "*What to do with trailing \"(was: <old subject>)\" in subject lines.
301 If nil, leave the subject unchanged. If it is the symbol `ask', query
302 the user what do do. In this case, the subject is matched against
303 `message-subject-trailing-was-ask-regexp'. If
304 `message-subject-trailing-was-query' is t, always strip the trailing
305 old subject. In this case, `message-subject-trailing-was-regexp' is
308 :type '(choice (const :tag "never" nil)
309 (const :tag "always strip" t)
311 :link '(custom-manual "(message)Message Headers")
312 :group 'message-various)
314 (defcustom message-subject-trailing-was-ask-regexp
315 "[ \t]*\\([[(]+[Ww][Aa][Ss][ \t]*.*[\])]+\\)"
316 "*Regexp matching \"(was: <old subject>)\" in the subject line.
318 The function `message-strip-subject-trailing-was' uses this regexp if
319 `message-subject-trailing-was-query' is set to the symbol `ask'. If
320 the variable is t instead of `ask', use
321 `message-subject-trailing-was-regexp' instead.
323 It is okay to create some false positives here, as the user is asked."
325 :group 'message-various
326 :link '(custom-manual "(message)Message Headers")
329 (defcustom message-subject-trailing-was-regexp
330 "[ \t]*\\((*[Ww][Aa][Ss]:[ \t]*.*)\\)"
331 "*Regexp matching \"(was: <old subject>)\" in the subject line.
333 If `message-subject-trailing-was-query' is set to t, the subject is
334 matched against `message-subject-trailing-was-regexp' in
335 `message-strip-subject-trailing-was'. You should use a regexp creating very
336 few false positives here."
338 :group 'message-various
339 :link '(custom-manual "(message)Message Headers")
342 ;;; marking inserted text
344 (defcustom message-mark-insert-begin
345 "--8<---------------cut here---------------start------------->8---\n"
346 "How to mark the beginning of some inserted text."
349 :link '(custom-manual "(message)Insertion Variables")
350 :group 'message-various)
352 (defcustom message-mark-insert-end
353 "--8<---------------cut here---------------end--------------->8---\n"
354 "How to mark the end of some inserted text."
357 :link '(custom-manual "(message)Insertion Variables")
358 :group 'message-various)
360 (defcustom message-archive-header "X-No-Archive: Yes\n"
361 "Header to insert when you don't want your article to be archived.
362 Archives \(such as groups.google.com\) respect this header."
365 :link '(custom-manual "(message)Header Commands")
366 :group 'message-various)
368 (defcustom message-archive-note
369 "X-No-Archive: Yes - save http://groups.google.com/"
370 "Note to insert why you wouldn't want this posting archived.
371 If nil, don't insert any text in the body."
373 :type '(radio string (const nil))
374 :link '(custom-manual "(message)Header Commands")
375 :group 'message-various)
377 ;;; Crossposts and Followups
378 ;; inspired by JoH-followup-to by Jochem Huhman <joh at gmx.de>
379 ;; new suggestions by R. Weikusat <rw at another.de>
381 (defvar message-cross-post-old-target nil
382 "Old target for cross-posts or follow-ups.")
383 (make-variable-buffer-local 'message-cross-post-old-target)
385 (defcustom message-cross-post-default t
386 "When non-nil `message-cross-post-followup-to' will perform a crosspost.
387 If nil, `message-cross-post-followup-to' will only do a followup. Note that
388 you can explicitly override this setting by calling
389 `message-cross-post-followup-to' with a prefix."
392 :group 'message-various)
394 (defcustom message-cross-post-note "Crosspost & Followup-To: "
395 "Note to insert before signature to notify of cross-post and follow-up."
398 :group 'message-various)
400 (defcustom message-followup-to-note "Followup-To: "
401 "Note to insert before signature to notify of follow-up only."
404 :group 'message-various)
406 (defcustom message-cross-post-note-function 'message-cross-post-insert-note
407 "Function to use to insert note about Crosspost or Followup-To.
408 The function will be called with four arguments. The function should not only
409 insert a note, but also ensure old notes are deleted. See the documentation
410 for `message-cross-post-insert-note'."
413 :group 'message-various)
415 ;;; End of variables adopted from `message-utils.el'.
417 (defcustom message-signature-separator "^-- $"
418 "Regexp matching the signature separator.
419 This variable is used to strip off the signature from quoted text
420 when `message-cite-function' is
421 `message-cite-original-without-signature'. Most useful values
422 are \"^-- $\" (strict) and \"^-- *$\" (loose; allow missing
424 :type '(choice (const :tag "strict" "^-- $")
425 (const :tag "loose" "^-- *$")
427 :version "22.3" ;; Gnus 5.10.12 (changed default)
428 :link '(custom-manual "(message)Various Message Variables")
429 :group 'message-various)
431 (defcustom message-elide-ellipsis "\n[...]\n\n"
432 "*The string which is inserted for elided text."
434 :link '(custom-manual "(message)Various Commands")
435 :group 'message-various)
437 (defcustom message-interactive t
438 "Non-nil means when sending a message wait for and display errors.
439 nil means let mailer mail back a message to report errors."
441 :group 'message-sending
443 :link '(custom-manual "(message)Sending Variables")
446 (defcustom message-confirm-send nil
447 "When non-nil, ask for confirmation when sending a message."
448 :group 'message-sending
450 :version "23.1" ;; No Gnus
451 :link '(custom-manual "(message)Sending Variables")
454 (defcustom message-generate-new-buffers 'unique
455 "*Say whether to create a new message buffer to compose a message.
456 Valid values include:
459 Generate the buffer name in the Message way (e.g., *mail*, *news*,
460 *mail to whom*, *news on group*, etc.) and continue editing in the
461 existing buffer of that name. If there is no such buffer, it will
465 Create the new buffer with the name generated in the Message way.
468 Similar to `unique' but the buffer name begins with \"*unsent \".
471 Similar to nil but the buffer name is simpler like *mail message*.
474 If this is a function, call that function with three parameters:
475 The type, the To address and the group name (any of these may be nil).
476 The function should return the new buffer name."
477 :group 'message-buffers
478 :link '(custom-manual "(message)Message Buffers")
479 :type '(choice (const nil)
480 (sexp :tag "unique" :format "unique\n" :value unique
481 :match (lambda (widget value) (memq value '(unique t))))
484 (function :format "\n %{%t%}: %v")))
486 (defcustom message-kill-buffer-on-exit nil
487 "*Non-nil means that the message buffer will be killed after sending a message."
488 :group 'message-buffers
489 :link '(custom-manual "(message)Message Buffers")
492 (defcustom message-kill-buffer-query t
493 "*Non-nil means that killing a modified message buffer has to be confirmed.
494 This is used by `message-kill-buffer'."
495 :version "23.1" ;; No Gnus
496 :group 'message-buffers
499 (defvar gnus-local-organization)
500 (defcustom message-user-organization
501 (or (and (boundp 'gnus-local-organization)
502 (stringp gnus-local-organization)
503 gnus-local-organization)
504 (getenv "ORGANIZATION")
506 "*String to be used as an Organization header.
507 If t, use `message-user-organization-file'."
508 :group 'message-headers
509 :type '(choice string
510 (const :tag "consult file" t)))
512 (defcustom message-user-organization-file
514 (dolist (f (list "/etc/organization"
515 "/etc/news/organization"
516 "/usr/lib/news/organization"))
517 (when (file-readable-p f)
520 "*Local news organization file."
522 :link '(custom-manual "(message)News Headers")
523 :group 'message-headers)
525 (defcustom message-make-forward-subject-function
526 #'message-forward-subject-name-subject
527 "*List of functions called to generate subject headers for forwarded messages.
528 The subject generated by the previous function is passed into each
531 The provided functions are:
533 * `message-forward-subject-author-subject' Source of article (author or
534 newsgroup), in brackets followed by the subject
535 * `message-forward-subject-name-subject' Source of article (name of author
536 or newsgroup), in brackets followed by the subject
537 * `message-forward-subject-fwd' Subject of article with 'Fwd:' prepended
539 :group 'message-forwarding
540 :link '(custom-manual "(message)Forwarding")
541 :type '(radio (function-item message-forward-subject-author-subject)
542 (function-item message-forward-subject-fwd)
543 (function-item message-forward-subject-name-subject)
544 (repeat :tag "List of functions" function)))
546 (defcustom message-forward-as-mime t
547 "*Non-nil means forward messages as an inline/rfc822 MIME section.
548 Otherwise, directly inline the old message in the forwarded message."
550 :group 'message-forwarding
551 :link '(custom-manual "(message)Forwarding")
554 (defcustom message-forward-show-mml 'best
555 "*Non-nil means show forwarded messages as MML (decoded from MIME).
556 Otherwise, forwarded messages are unchanged.
557 Can also be the symbol `best' to indicate that MML should be
558 used, except when it is a bad idea to use MML. One example where
559 it is a bad idea is when forwarding a signed or encrypted
560 message, because converting MIME to MML would invalidate the
563 :group 'message-forwarding
564 :type '(choice (const :tag "use MML" t)
565 (const :tag "don't use MML " nil)
566 (const :tag "use MML when appropriate" best)))
568 (defcustom message-forward-before-signature t
569 "*Non-nil means put forwarded message before signature, else after."
570 :group 'message-forwarding
573 (defcustom message-wash-forwarded-subjects nil
574 "*Non-nil means try to remove as much cruft as possible from the subject.
575 Done before generating the new subject of a forward."
576 :group 'message-forwarding
577 :link '(custom-manual "(message)Forwarding")
580 (defcustom message-ignored-resent-headers
581 ;; `Delivered-To' needs to be removed because some mailers use it to
582 ;; detect loops, so if you resend a message to an address that ultimately
583 ;; comes back to you (e.g. a mailing-list to which you subscribe, in which
584 ;; case you may be removed from the list on the grounds that mail to you
585 ;; bounced with a "mailing loop" error).
586 "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:"
587 "*All headers that match this regexp will be deleted when resending a message."
588 :group 'message-interface
589 :link '(custom-manual "(message)Resending")
590 :type '(repeat :value-to-internal (lambda (widget value)
591 (custom-split-regexp-maybe value))
592 :match (lambda (widget value)
594 (widget-editable-list-match widget value)))
597 (defcustom message-forward-ignored-headers "^Content-Transfer-Encoding:\\|^X-Gnus"
598 "*All headers that match this regexp will be deleted when forwarding a message."
600 :group 'message-forwarding
601 :type '(repeat :value-to-internal (lambda (widget value)
602 (custom-split-regexp-maybe value))
603 :match (lambda (widget value)
605 (widget-editable-list-match widget value)))
608 (defcustom message-ignored-cited-headers "."
609 "*Delete these headers from the messages you yank."
610 :group 'message-insertion
611 :link '(custom-manual "(message)Insertion Variables")
614 (defcustom message-cite-prefix-regexp
615 (if (string-match "[[:digit:]]" "1")
616 ;; Support POSIX? XEmacs 21.5.27 doesn't.
617 "\\([ \t]*[_.[:word:]]+>+\\|[ \t]*[]>|}]\\)+"
618 ;; ?-, ?_ or ?. MUST NOT be in syntax entry w.
619 (let (non-word-constituents)
620 (with-syntax-table text-mode-syntax-table
621 (setq non-word-constituents
623 (if (string-match "\\w" "_") "" "_")
624 (if (string-match "\\w" ".") "" "."))))
625 (if (equal non-word-constituents "")
626 "\\([ \t]*\\(\\w\\)+>+\\|[ \t]*[]>|}]\\)+"
627 (concat "\\([ \t]*\\(\\w\\|["
628 non-word-constituents
629 "]\\)+>+\\|[ \t]*[]>|}]\\)+"))))
630 "*Regexp matching the longest possible citation prefix on a line."
632 :group 'message-insertion
633 :link '(custom-manual "(message)Insertion Variables")
635 :set (lambda (symbol value)
637 (custom-set-default symbol value)
638 (if (boundp 'gnus-message-cite-prefix-regexp)
639 (setq gnus-message-cite-prefix-regexp
640 (concat "^\\(?:" value "\\)"))))))
642 (defcustom message-cancel-message "I am canceling my own article.\n"
643 "Message to be inserted in the cancel message."
644 :group 'message-interface
645 :link '(custom-manual "(message)Canceling News")
648 (defun message-send-mail-function ()
649 "Return suitable value for the variable `message-send-mail-function'."
650 (cond ((and (require 'sendmail)
651 (boundp 'sendmail-program)
653 (executable-find sendmail-program))
654 'message-send-mail-with-sendmail)
655 ((and (locate-library "smtpmail")
656 (boundp 'smtpmail-default-smtp-server)
657 smtpmail-default-smtp-server)
658 'message-smtpmail-send-it)
659 ((locate-library "mailclient")
660 'message-send-mail-with-mailclient)
662 (error "Don't know how to send mail. Please customize `message-send-mail-function'"))))
664 ;; Useful to set in site-init.el
665 (defcustom message-send-mail-function
666 (cond ((eq send-mail-function 'smtpmail-send-it) 'message-smtpmail-send-it)
667 ((eq send-mail-function 'feedmail-send-it) 'feedmail-send-it)
668 ((eq send-mail-function 'mailclient-send-it)
669 'message-send-mail-with-mailclient)
670 (t (message-send-mail-function)))
671 "Function to call to send the current buffer as mail.
672 The headers should be delimited by a line whose contents match the
673 variable `mail-header-separator'.
675 Valid values include `message-send-mail-with-sendmail'
676 `message-send-mail-with-mh', `message-send-mail-with-qmail',
677 `message-smtpmail-send-it', `smtpmail-send-it',
678 `feedmail-send-it' and `message-send-mail-with-mailclient'. The
679 default is system dependent and determined by the function
680 `message-send-mail-function'.
682 See also `send-mail-function'."
683 :type '(radio (function-item message-send-mail-with-sendmail)
684 (function-item message-send-mail-with-mh)
685 (function-item message-send-mail-with-qmail)
686 (function-item message-smtpmail-send-it)
687 (function-item smtpmail-send-it)
688 (function-item feedmail-send-it)
689 (function-item message-send-mail-with-mailclient
690 :tag "Use Mailclient package")
691 (function :tag "Other"))
692 :group 'message-sending
694 :initialize 'custom-initialize-default
695 :link '(custom-manual "(message)Mail Variables")
696 :group 'message-mail)
698 (defcustom message-send-news-function 'message-send-news
699 "Function to call to send the current buffer as news.
700 The headers should be delimited by a line whose contents match the
701 variable `mail-header-separator'."
702 :group 'message-sending
704 :link '(custom-manual "(message)News Variables")
707 (defcustom message-reply-to-function nil
708 "If non-nil, function that should return a list of headers.
709 This function should pick out addresses from the To, Cc, and From headers
710 and respond with new To and Cc headers."
711 :group 'message-interface
712 :link '(custom-manual "(message)Reply")
713 :type '(choice function (const nil)))
715 (defcustom message-wide-reply-to-function nil
716 "If non-nil, function that should return a list of headers.
717 This function should pick out addresses from the To, Cc, and From headers
718 and respond with new To and Cc headers."
719 :group 'message-interface
720 :link '(custom-manual "(message)Wide Reply")
721 :type '(choice function (const nil)))
723 (defcustom message-followup-to-function nil
724 "If non-nil, function that should return a list of headers.
725 This function should pick out addresses from the To, Cc, and From headers
726 and respond with new To and Cc headers."
727 :group 'message-interface
728 :link '(custom-manual "(message)Followup")
729 :type '(choice function (const nil)))
731 (defcustom message-extra-wide-headers nil
732 "If non-nil, a list of additional address headers.
733 These are used when composing a wide reply."
734 :group 'message-sending
735 :type '(repeat string))
737 (defcustom message-use-followup-to 'ask
738 "*Specifies what to do with Followup-To header.
739 If nil, always ignore the header. If it is t, use its value, but
740 query before using the \"poster\" value. If it is the symbol `ask',
741 always query the user whether to use the value. If it is the symbol
742 `use', always use the value."
743 :group 'message-interface
744 :link '(custom-manual "(message)Followup")
745 :type '(choice (const :tag "ignore" nil)
746 (const :tag "use & query" t)
750 (defcustom message-use-mail-followup-to 'use
751 "*Specifies what to do with Mail-Followup-To header.
752 If nil, always ignore the header. If it is the symbol `ask', always
753 query the user whether to use the value. If it is the symbol `use',
754 always use the value."
756 :group 'message-interface
757 :link '(custom-manual "(message)Mailing Lists")
758 :type '(choice (const :tag "ignore" nil)
762 (defcustom message-subscribed-address-functions nil
763 "*Specifies functions for determining list subscription.
764 If nil, do not attempt to determine list subscription with functions.
765 If non-nil, this variable contains a list of functions which return
766 regular expressions to match lists. These functions can be used in
767 conjunction with `message-subscribed-regexps' and
768 `message-subscribed-addresses'."
770 :group 'message-interface
771 :link '(custom-manual "(message)Mailing Lists")
772 :type '(repeat sexp))
774 (defcustom message-subscribed-address-file nil
775 "*A file containing addresses the user is subscribed to.
776 If nil, do not look at any files to determine list subscriptions. If
777 non-nil, each line of this file should be a mailing list address."
779 :group 'message-interface
780 :link '(custom-manual "(message)Mailing Lists")
781 :type '(radio file (const nil)))
783 (defcustom message-subscribed-addresses nil
784 "*Specifies a list of addresses the user is subscribed to.
785 If nil, do not use any predefined list subscriptions. This list of
786 addresses can be used in conjunction with
787 `message-subscribed-address-functions' and `message-subscribed-regexps'."
789 :group 'message-interface
790 :link '(custom-manual "(message)Mailing Lists")
791 :type '(repeat string))
793 (defcustom message-subscribed-regexps nil
794 "*Specifies a list of addresses the user is subscribed to.
795 If nil, do not use any predefined list subscriptions. This list of
796 regular expressions can be used in conjunction with
797 `message-subscribed-address-functions' and `message-subscribed-addresses'."
799 :group 'message-interface
800 :link '(custom-manual "(message)Mailing Lists")
801 :type '(repeat regexp))
803 (defcustom message-allow-no-recipients 'ask
804 "Specifies what to do when there are no recipients other than Gcc/Fcc.
805 If it is the symbol `always', the posting is allowed. If it is the
806 symbol `never', the posting is not allowed. If it is the symbol
807 `ask', you are prompted."
809 :group 'message-interface
810 :link '(custom-manual "(message)Message Headers")
811 :type '(choice (const always)
815 (defcustom message-sendmail-f-is-evil nil
816 "*Non-nil means don't add \"-f username\" to the sendmail command line.
817 Doing so would be even more evil than leaving it out."
818 :group 'message-sending
819 :link '(custom-manual "(message)Mail Variables")
822 (defcustom message-sendmail-envelope-from nil
823 "*Envelope-from when sending mail with sendmail.
824 If this is nil, use `user-mail-address'. If it is the symbol
825 `header', use the From: header of the message."
827 :type '(choice (string :tag "From name")
828 (const :tag "Use From: header from message" header)
829 (const :tag "Use `user-mail-address'" nil))
830 :link '(custom-manual "(message)Mail Variables")
831 :group 'message-sending)
833 (defcustom message-sendmail-extra-arguments nil
834 "Additional arguments to `sendmail-program'."
835 ;; E.g. '("-a" "account") for msmtp
836 :version "23.1" ;; No Gnus
837 :type '(repeat string)
838 ;; :link '(custom-manual "(message)Mail Variables")
839 :group 'message-sending)
841 ;; qmail-related stuff
842 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
843 "Location of the qmail-inject program."
844 :group 'message-sending
845 :link '(custom-manual "(message)Mail Variables")
848 (defcustom message-qmail-inject-args nil
849 "Arguments passed to qmail-inject programs.
850 This should be a list of strings, one string for each argument. It
851 may also be a function.
853 For e.g., if you wish to set the envelope sender address so that bounces
854 go to the right place or to deal with listserv's usage of that address, you
855 might set this variable to '(\"-f\" \"you@some.where\")."
856 :group 'message-sending
857 :link '(custom-manual "(message)Mail Variables")
858 :type '(choice (function)
861 (defvar gnus-post-method)
862 (defvar gnus-select-method)
863 (defcustom message-post-method
864 (cond ((and (boundp 'gnus-post-method)
865 (listp gnus-post-method)
868 ((boundp 'gnus-select-method)
871 "*Method used to post news.
872 Note that when posting from inside Gnus, for instance, this
873 variable isn't used."
875 :group 'message-sending
876 ;; This should be the `gnus-select-method' widget, but that might
877 ;; create a dependence to `gnus.el'.
880 ;; FIXME: This should be a temporary workaround until someone implements a
881 ;; proper solution. If a crash happens while replying, the auto-save file
882 ;; will *not* have a `References:' header if `message-generate-headers-first'
883 ;; is nil. See: http://article.gmane.org/gmane.emacs.gnus.general/51138
884 (defcustom message-generate-headers-first '(references)
885 "Which headers should be generated before starting to compose a message.
886 If t, generate all required headers. This can also be a list of headers to
887 generate. The variables `message-required-news-headers' and
888 `message-required-mail-headers' specify which headers to generate.
890 Note that the variable `message-deletable-headers' specifies headers which
891 are to be deleted and then re-generated before sending, so this variable
892 will not have a visible effect for those headers."
893 :group 'message-headers
894 :link '(custom-manual "(message)Message Headers")
895 :type '(choice (const :tag "None" nil)
896 (const :tag "References" '(references))
898 (repeat (sexp :tag "Header"))))
900 (defcustom message-fill-column 72
901 "Column beyond which automatic line-wrapping should happen.
902 Local value for message buffers. If non-nil, also turn on
903 auto-fill in message buffers."
904 :group 'message-various
905 ;; :link '(custom-manual "(message)Message Headers")
906 :type '(choice (const :tag "Don't turn on auto fill" nil)
909 (defcustom message-setup-hook nil
910 "Normal hook, run each time a new outgoing message is initialized.
911 The function `message-setup' runs this hook."
912 :group 'message-various
913 :link '(custom-manual "(message)Various Message Variables")
916 (defcustom message-cancel-hook nil
917 "Hook run when cancelling articles."
918 :group 'message-various
919 :link '(custom-manual "(message)Various Message Variables")
922 (defcustom message-signature-setup-hook nil
923 "Normal hook, run each time a new outgoing message is initialized.
924 It is run after the headers have been inserted and before
925 the signature is inserted."
926 :group 'message-various
927 :link '(custom-manual "(message)Various Message Variables")
930 (defcustom message-mode-hook nil
931 "Hook run in message mode buffers."
932 :group 'message-various
935 (defcustom message-header-hook nil
936 "Hook run in a message mode buffer narrowed to the headers."
937 :group 'message-various
940 (defcustom message-header-setup-hook nil
941 "Hook called narrowed to the headers when setting up a message buffer."
942 :group 'message-various
943 :link '(custom-manual "(message)Various Message Variables")
946 (defcustom message-minibuffer-local-map
947 (let ((map (make-sparse-keymap 'message-minibuffer-local-map)))
948 (set-keymap-parent map minibuffer-local-map)
950 "Keymap for `message-read-from-minibuffer'."
952 :group 'message-various)
954 (defcustom message-citation-line-function 'message-insert-citation-line
955 "*Function called to insert the \"Whomever writes:\" line.
957 Predefined functions include `message-insert-citation-line' and
958 `message-insert-formatted-citation-line' (see the variable
959 `message-citation-line-format').
961 Note that Gnus provides a feature where the reader can click on
962 `writes:' to hide the cited text. If you change this line too much,
963 people who read your message will have to change their Gnus
964 configuration. See the variable `gnus-cite-attribution-suffix'."
966 (function-item :tag "plain" message-insert-citation-line)
967 (function-item :tag "formatted" message-insert-formatted-citation-line)
968 (function :tag "Other"))
969 :link '(custom-manual "(message)Insertion Variables")
970 :group 'message-insertion)
972 (defcustom message-citation-line-format "On %a, %b %d %Y, %N wrote:\n"
973 "Format of the \"Whomever writes:\" line.
975 The string is formatted using `format-spec'. The following
976 constructs are replaced:
978 %f The full From, e.g. \"John Doe <john.doe@example.invalid>\".
979 %n The mail address, e.g. \"john.doe@example.invalid\".
980 %N The real name if present, e.g.: \"John Doe\", else fall
981 back to the mail address.
982 %F The first name if present, e.g.: \"John\".
983 %L The last name if present, e.g.: \"Doe\".
985 All other format specifiers are passed to `format-time-string'
986 which is called using the date from the article your replying to.
987 Extracting the first (%F) and last name (%L) is done
988 heuristically, so you should always check it yourself.
990 Please also read the note in the documentation of
991 `message-citation-line-function'."
992 :type '(choice (const :tag "Plain" "%f writes:")
993 (const :tag "Include date" "On %a, %b %d %Y, %n wrote:")
995 :link '(custom-manual "(message)Insertion Variables")
996 :version "23.1" ;; No Gnus
997 :group 'message-insertion)
999 (defcustom message-yank-prefix "> "
1000 "*Prefix inserted on the lines of yanked messages.
1001 Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
1002 See also `message-yank-cited-prefix' and `message-yank-empty-prefix'."
1005 :link '(custom-manual "(message)Insertion Variables")
1006 :group 'message-insertion)
1008 (defcustom message-yank-cited-prefix ">"
1009 "*Prefix inserted on cited lines of yanked messages.
1010 Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
1011 See also `message-yank-prefix' and `message-yank-empty-prefix'."
1014 :link '(custom-manual "(message)Insertion Variables")
1015 :group 'message-insertion)
1017 (defcustom message-yank-empty-prefix ">"
1018 "*Prefix inserted on empty lines of yanked messages.
1019 See also `message-yank-prefix' and `message-yank-cited-prefix'."
1022 :link '(custom-manual "(message)Insertion Variables")
1023 :group 'message-insertion)
1025 (defcustom message-indentation-spaces 3
1026 "*Number of spaces to insert at the beginning of each cited line.
1027 Used by `message-yank-original' via `message-yank-cite'."
1029 :group 'message-insertion
1030 :link '(custom-manual "(message)Insertion Variables")
1033 (defcustom message-cite-function 'message-cite-original-without-signature
1034 "*Function for citing an original message.
1035 Predefined functions include `message-cite-original' and
1036 `message-cite-original-without-signature'.
1037 Note that these functions use `mail-citation-hook' if that is non-nil."
1038 :type '(radio (function-item message-cite-original)
1039 (function-item message-cite-original-without-signature)
1040 (function-item sc-cite-original)
1041 (function :tag "Other"))
1042 :link '(custom-manual "(message)Insertion Variables")
1043 :version "22.3" ;; Gnus 5.10.12 (changed default)
1044 :group 'message-insertion)
1046 (defcustom message-indent-citation-function 'message-indent-citation
1047 "*Function for modifying a citation just inserted in the mail buffer.
1048 This can also be a list of functions. Each function can find the
1049 citation between (point) and (mark t). And each function should leave
1050 point and mark around the citation text as modified."
1052 :link '(custom-manual "(message)Insertion Variables")
1053 :group 'message-insertion)
1055 (defcustom message-signature t
1056 "*String to be inserted at the end of the message buffer.
1057 If t, the `message-signature-file' file will be inserted instead.
1058 If a function, the result from the function will be used instead.
1059 If a form, the result from the form will be used instead."
1062 :link '(custom-manual "(message)Insertion Variables")
1063 :group 'message-insertion)
1065 (defcustom message-signature-file "~/.signature"
1066 "*Name of file containing the text inserted at end of message buffer.
1067 Ignored if the named file doesn't exist.
1068 If nil, don't insert a signature.
1069 If a path is specified, the value of `message-signature-directory' is ignored,
1072 :type '(choice file (const :tags "None" nil))
1073 :link '(custom-manual "(message)Insertion Variables")
1074 :group 'message-insertion)
1076 (defcustom message-signature-directory nil
1077 "*Name of directory containing signature files.
1078 Comes in handy if you have many such files, handled via posting styles for
1080 If nil, `message-signature-file' is expected to specify the directory if
1082 :type '(choice string (const :tags "None" nil))
1083 :link '(custom-manual "(message)Insertion Variables")
1084 :group 'message-insertion)
1086 (defcustom message-signature-insert-empty-line t
1087 "*If non-nil, insert an empty line before the signature separator."
1090 :link '(custom-manual "(message)Insertion Variables")
1091 :group 'message-insertion)
1093 (defcustom message-distribution-function nil
1094 "*Function called to return a Distribution header."
1095 :group 'message-news
1096 :group 'message-headers
1097 :link '(custom-manual "(message)News Headers")
1098 :type '(choice function (const nil)))
1100 (defcustom message-expires 14
1101 "Number of days before your article expires."
1102 :group 'message-news
1103 :group 'message-headers
1104 :link '(custom-manual "(message)News Headers")
1107 (defcustom message-user-path nil
1108 "If nil, use the NNTP server name in the Path header.
1109 If stringp, use this; if non-nil, use no host name (user name only)."
1110 :group 'message-news
1111 :group 'message-headers
1112 :link '(custom-manual "(message)News Headers")
1113 :type '(choice (const :tag "nntp" nil)
1114 (string :tag "name")
1115 (sexp :tag "none" :format "%t" t)))
1117 ;; This can be the name of a buffer, or a cons cell (FUNCTION . ARGS)
1118 ;; for yanking the original buffer.
1119 (defvar message-reply-buffer nil)
1120 (defvar message-reply-headers nil
1121 "The headers of the current replied article.
1122 It is a vector of the following headers:
1123 \[number subject from date id references chars lines xref extra].")
1124 (defvar message-newsreader nil)
1125 (defvar message-mailer nil)
1126 (defvar message-sent-message-via nil)
1127 (defvar message-checksum nil)
1128 (defvar message-send-actions nil
1129 "A list of actions to be performed upon successful sending of a message.")
1130 (defvar message-exit-actions nil
1131 "A list of actions to be performed upon exiting after sending a message.")
1132 (defvar message-kill-actions nil
1133 "A list of actions to be performed before killing a message buffer.")
1134 (defvar message-postpone-actions nil
1135 "A list of actions to be performed after postponing a message.")
1137 (define-widget 'message-header-lines 'text
1138 "All header lines must be LFD terminated."
1139 :format "%{%t%}:%n%v"
1140 :valid-regexp "^\\'"
1141 :error "All header lines must be newline terminated")
1143 (defcustom message-default-headers ""
1144 "*A string containing header lines to be inserted in outgoing messages.
1145 It is inserted before you edit the message, so you can edit or delete
1148 :group 'message-headers
1149 :link '(custom-manual "(message)Message Headers")
1150 :type 'message-header-lines)
1152 (defcustom message-default-mail-headers
1153 ;; Ease the transition from mail-mode to message-mode. See bugs#4431, 5555.
1154 (concat (if (and (boundp 'mail-default-reply-to)
1155 (stringp mail-default-reply-to))
1156 (format "Reply-to: %s\n" mail-default-reply-to)
1158 (if (and (boundp 'mail-self-blind)
1160 (format "BCC: %s\n" user-mail-address)
1162 (if (and (boundp 'mail-archive-file-name)
1163 (stringp mail-archive-file-name))
1164 (format "FCC: %s\n" mail-archive-file-name)
1166 "*A string of header lines to be inserted in outgoing mails."
1168 :group 'message-headers
1169 :group 'message-mail
1170 :link '(custom-manual "(message)Mail Headers")
1171 :type 'message-header-lines)
1173 (defcustom message-default-news-headers ""
1174 "*A string of header lines to be inserted in outgoing news articles."
1175 :group 'message-headers
1176 :group 'message-news
1177 :link '(custom-manual "(message)News Headers")
1178 :type 'message-header-lines)
1180 ;; Note: could use /usr/ucb/mail instead of sendmail;
1181 ;; options -t, and -v if not interactive.
1182 (defcustom message-mailer-swallows-blank-line
1183 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)"
1184 system-configuration)
1185 (file-readable-p "/etc/sendmail.cf")
1186 (let ((buffer (get-buffer-create " *temp*")))
1188 (with-current-buffer buffer
1189 (insert-file-contents "/etc/sendmail.cf")
1190 (goto-char (point-min))
1191 (let ((case-fold-search nil))
1192 (re-search-forward "^OR\\>" nil t)))
1193 (kill-buffer buffer))))
1194 ;; According to RFC822, "The field-name must be composed of printable
1195 ;; ASCII characters (i. e., characters that have decimal values between
1196 ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
1198 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:"))
1199 "*Set this non-nil if the system's mailer runs the header and body together.
1200 \(This problem exists on Sunos 4 when sendmail is run in remote mode.)
1201 The value should be an expression to test whether the problem will
1203 :group 'message-sending
1204 :link '(custom-manual "(message)Mail Variables")
1208 (define-mail-user-agent 'message-user-agent
1209 'message-mail 'message-send-and-exit
1210 'message-kill-buffer 'message-send-hook)
1212 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender)
1213 "If non-nil, delete the deletable headers before feeding to mh.")
1215 (defvar message-send-method-alist
1216 '((news message-news-p message-send-via-news)
1217 (mail message-mail-p message-send-via-mail))
1218 "Alist of ways to send outgoing messages.
1219 Each element has the form
1221 \(TYPE PREDICATE FUNCTION)
1223 where TYPE is a symbol that names the method; PREDICATE is a function
1224 called without any parameters to determine whether the message is
1225 a message of type TYPE; and FUNCTION is a function to be called if
1226 PREDICATE returns non-nil. FUNCTION is called with one parameter --
1229 (defcustom message-mail-alias-type 'abbrev
1230 "*What alias expansion type to use in Message buffers.
1231 The default is `abbrev', which uses mailabbrev. `ecomplete' uses
1232 an electric completion mode. nil switches mail aliases off.
1233 This can also be a list of values."
1235 :link '(custom-manual "(message)Mail Aliases")
1236 :type '(choice (const :tag "Use Mailabbrev" abbrev)
1237 (const :tag "Use ecomplete" ecomplete)
1238 (const :tag "No expansion" nil)))
1240 (defcustom message-self-insert-commands '(self-insert-command)
1241 "List of `self-insert-command's used to trigger ecomplete.
1242 When one of those commands is invoked to enter a character in To or Cc
1243 header, ecomplete will suggest the candidates of recipients (see also
1244 `message-mail-alias-type'). If you use some tool to enter non-ASCII
1245 text and it replaces `self-insert-command' with the other command, e.g.
1246 `egg-self-insert-command', you may want to add it to this list."
1247 :group 'message-various
1248 :type '(repeat function))
1250 (defcustom message-auto-save-directory
1251 (file-name-as-directory (expand-file-name "drafts" message-directory))
1252 "*Directory where Message auto-saves buffers if Gnus isn't running.
1253 If nil, Message won't auto-save."
1254 :group 'message-buffers
1255 :link '(custom-manual "(message)Various Message Variables")
1256 :type '(choice directory (const :tag "Don't auto-save" nil)))
1258 (defcustom message-default-charset
1259 (and (not (mm-multibyte-p)) 'iso-8859-1)
1260 "Default charset used in non-MULE Emacsen.
1261 If nil, you might be asked to input the charset."
1264 :link '(custom-manual "(message)Various Message Variables")
1267 (defcustom message-dont-reply-to-names
1268 (and (boundp 'rmail-dont-reply-to-names) rmail-dont-reply-to-names)
1269 "*Addresses to prune when doing wide replies.
1270 This can be a regexp or a list of regexps. Also, a value of nil means
1271 exclude your own user name only."
1274 :link '(custom-manual "(message)Wide Reply")
1275 :type '(choice (const :tag "Yourself" nil)
1277 (repeat :tag "Regexp List" regexp)))
1279 (defsubst message-dont-reply-to-names ()
1280 (gmm-regexp-concat message-dont-reply-to-names))
1282 (defvar message-shoot-gnksa-feet nil
1283 "*A list of GNKSA feet you are allowed to shoot.
1284 Gnus gives you all the opportunity you could possibly want for
1285 shooting yourself in the foot. Also, Gnus allows you to shoot the
1286 feet of Good Net-Keeping Seal of Approval. The following are foot
1288 `empty-article' Allow you to post an empty article;
1289 `quoted-text-only' Allow you to post quoted text only;
1290 `multiple-copies' Allow you to post multiple copies;
1291 `cancel-messages' Allow you to cancel or supersede messages from
1292 your other email addresses.")
1294 (defsubst message-gnksa-enable-p (feature)
1295 (or (not (listp message-shoot-gnksa-feet))
1296 (memq feature message-shoot-gnksa-feet)))
1298 (defcustom message-hidden-headers '("^References:" "^Face:" "^X-Face:"
1300 "Regexp of headers to be hidden when composing new messages.
1301 This can also be a list of regexps to match headers. Or a list
1302 starting with `not' and followed by regexps."
1305 :link '(custom-manual "(message)Message Headers")
1307 :format "%{%t%}: %[Value Type%] %v"
1308 (regexp :menu-tag "regexp" :format "regexp\n%t: %v")
1309 (repeat :menu-tag "(regexp ...)" :format "(regexp ...)\n%v%i"
1310 (regexp :format "%t: %v"))
1311 (cons :menu-tag "(not regexp ...)" :format "(not regexp ...)\n%v"
1313 (repeat :format "%v%i"
1314 (regexp :format "%t: %v")))))
1316 (defcustom message-cite-articles-with-x-no-archive t
1317 "If non-nil, cite text from articles that has X-No-Archive set."
1321 ;;; Internal variables.
1322 ;;; Well, not really internal.
1324 (defvar message-mode-syntax-table
1325 (let ((table (copy-syntax-table text-mode-syntax-table)))
1326 (modify-syntax-entry ?% ". " table)
1327 (modify-syntax-entry ?> ". " table)
1328 (modify-syntax-entry ?< ". " table)
1330 "Syntax table used while in Message mode.")
1332 (defface message-header-to
1335 (:foreground "DarkOliveGreen1" :bold t))
1338 (:foreground "MidnightBlue" :bold t))
1340 (:bold t :italic t)))
1341 "Face used for displaying From headers."
1342 :group 'message-faces)
1343 ;; backward-compatibility alias
1344 (put 'message-header-to-face 'face-alias 'message-header-to)
1345 (put 'message-header-to-face 'obsolete-face "22.1")
1347 (defface message-header-cc
1350 (:foreground "chartreuse1" :bold t))
1353 (:foreground "MidnightBlue"))
1356 "Face used for displaying Cc headers."
1357 :group 'message-faces)
1358 ;; backward-compatibility alias
1359 (put 'message-header-cc-face 'face-alias 'message-header-cc)
1360 (put 'message-header-cc-face 'obsolete-face "22.1")
1362 (defface message-header-subject
1365 (:foreground "OliveDrab1"))
1368 (:foreground "navy blue" :bold t))
1371 "Face used for displaying subject headers."
1372 :group 'message-faces)
1373 ;; backward-compatibility alias
1374 (put 'message-header-subject-face 'face-alias 'message-header-subject)
1375 (put 'message-header-subject-face 'obsolete-face "22.1")
1377 (defface message-header-newsgroups
1380 (:foreground "yellow" :bold t :italic t))
1383 (:foreground "blue4" :bold t :italic t))
1385 (:bold t :italic t)))
1386 "Face used for displaying newsgroups headers."
1387 :group 'message-faces)
1388 ;; backward-compatibility alias
1389 (put 'message-header-newsgroups-face 'face-alias 'message-header-newsgroups)
1390 (put 'message-header-newsgroups-face 'obsolete-face "22.1")
1392 (defface message-header-other
1395 (:foreground "VioletRed1"))
1398 (:foreground "steel blue"))
1400 (:bold t :italic t)))
1401 "Face used for displaying newsgroups headers."
1402 :group 'message-faces)
1403 ;; backward-compatibility alias
1404 (put 'message-header-other-face 'face-alias 'message-header-other)
1405 (put 'message-header-other-face 'obsolete-face "22.1")
1407 (defface message-header-name
1410 (:foreground "green"))
1413 (:foreground "cornflower blue"))
1416 "Face used for displaying header names."
1417 :group 'message-faces)
1418 ;; backward-compatibility alias
1419 (put 'message-header-name-face 'face-alias 'message-header-name)
1420 (put 'message-header-name-face 'obsolete-face "22.1")
1422 (defface message-header-xheader
1425 (:foreground "DeepSkyBlue1"))
1428 (:foreground "blue"))
1431 "Face used for displaying X-Header headers."
1432 :group 'message-faces)
1433 ;; backward-compatibility alias
1434 (put 'message-header-xheader-face 'face-alias 'message-header-xheader)
1435 (put 'message-header-xheader-face 'obsolete-face "22.1")
1437 (defface message-separator
1440 (:foreground "LightSkyBlue1"))
1443 (:foreground "brown"))
1446 "Face used for displaying the separator."
1447 :group 'message-faces)
1448 ;; backward-compatibility alias
1449 (put 'message-separator-face 'face-alias 'message-separator)
1450 (put 'message-separator-face 'obsolete-face "22.1")
1452 (defface message-cited-text
1455 (:foreground "LightPink1"))
1458 (:foreground "red"))
1461 "Face used for displaying cited text names."
1462 :group 'message-faces)
1463 ;; backward-compatibility alias
1464 (put 'message-cited-text-face 'face-alias 'message-cited-text)
1465 (put 'message-cited-text-face 'obsolete-face "22.1")
1467 (defface message-mml
1470 (:foreground "MediumSpringGreen"))
1473 (:foreground "ForestGreen"))
1476 "Face used for displaying MML."
1477 :group 'message-faces)
1478 ;; backward-compatibility alias
1479 (put 'message-mml-face 'face-alias 'message-mml)
1480 (put 'message-mml-face 'obsolete-face "22.1")
1482 (defun message-font-lock-make-header-matcher (regexp)
1485 (let ((start (point)))
1488 (goto-char (point-min))
1489 (if (re-search-forward
1490 (concat "^" (regexp-quote mail-header-separator) "$")
1492 (setq limit (min limit (match-beginning 0))))
1494 (and (< start limit)
1495 (re-search-forward ,regexp limit t))))))
1496 (if (featurep 'bytecomp)
1500 (defvar message-font-lock-keywords
1501 (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?"))
1502 `((,(message-font-lock-make-header-matcher
1503 (concat "^\\([Tt]o:\\)" content))
1504 (1 'message-header-name)
1505 (2 'message-header-to nil t))
1506 (,(message-font-lock-make-header-matcher
1507 (concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content))
1508 (1 'message-header-name)
1509 (2 'message-header-cc nil t))
1510 (,(message-font-lock-make-header-matcher
1511 (concat "^\\([Ss]ubject:\\)" content))
1512 (1 'message-header-name)
1513 (2 'message-header-subject nil t))
1514 (,(message-font-lock-make-header-matcher
1515 (concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content))
1516 (1 'message-header-name)
1517 (2 'message-header-newsgroups nil t))
1518 (,(message-font-lock-make-header-matcher
1519 (concat "^\\(X-[A-Za-z0-9-]+:\\|In-Reply-To:\\)" content))
1520 (1 'message-header-name)
1521 (2 'message-header-xheader))
1522 (,(message-font-lock-make-header-matcher
1523 (concat "^\\([A-Z][^: \n\t]+:\\)" content))
1524 (1 'message-header-name)
1525 (2 'message-header-other nil t))
1526 ,@(if (and mail-header-separator
1527 (not (equal mail-header-separator "")))
1528 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
1529 1 'message-separator))
1532 (re-search-forward (concat "^\\("
1533 message-cite-prefix-regexp
1536 (0 'message-cited-text))
1537 ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
1539 "Additional expressions to highlight in Message mode.")
1542 ;; XEmacs does it like this. For Emacs, we have to set the
1543 ;; `font-lock-defaults' buffer-local variable.
1544 (put 'message-mode 'font-lock-defaults '(message-font-lock-keywords t))
1546 (defvar message-face-alist
1547 '((bold . message-bold-region)
1548 (underline . underline-region)
1549 (default . (lambda (b e)
1550 (message-unbold-region b e)
1551 (ununderline-region b e))))
1552 "Alist of mail and news faces for facemenu.
1553 The cdr of each entry is a function for applying the face to a region.")
1555 (defcustom message-send-hook nil
1556 "Hook run before sending messages.
1557 This hook is run quite early when sending."
1558 :group 'message-various
1559 :options '(ispell-message)
1560 :link '(custom-manual "(message)Various Message Variables")
1563 (defcustom message-send-mail-hook nil
1564 "Hook run before sending mail messages.
1565 This hook is run very late -- just before the message is sent as
1567 :group 'message-various
1568 :link '(custom-manual "(message)Various Message Variables")
1571 (defcustom message-send-news-hook nil
1572 "Hook run before sending news messages.
1573 This hook is run very late -- just before the message is sent as
1575 :group 'message-various
1576 :link '(custom-manual "(message)Various Message Variables")
1579 (defcustom message-sent-hook nil
1580 "Hook run after sending messages."
1581 :group 'message-various
1584 (defvar message-send-coding-system 'binary
1585 "Coding system to encode outgoing mail.")
1587 (defvar message-draft-coding-system
1588 mm-auto-save-coding-system
1589 "*Coding system to compose mail.
1590 If you'd like to make it possible to share draft files between XEmacs
1591 and Emacs, you may use `iso-2022-7bit' for this value at your own risk.
1592 Note that the coding-system `iso-2022-7bit' isn't suitable to all data.")
1594 (defcustom message-send-mail-partially-limit 1000000
1595 "The limitation of messages sent as message/partial.
1596 The lower bound of message size in characters, beyond which the message
1597 should be sent in several parts. If it is nil, the size is unlimited."
1599 :group 'message-buffers
1600 :link '(custom-manual "(message)Mail Variables")
1601 :type '(choice (const :tag "unlimited" nil)
1604 (defcustom message-alternative-emails nil
1605 "*Regexp matching alternative email addresses.
1606 The first address in the To, Cc or From headers of the original
1607 article matching this variable is used as the From field of
1610 This variable has precedence over posting styles and anything that runs
1611 off `message-setup-hook'."
1612 :group 'message-headers
1613 :link '(custom-manual "(message)Message Headers")
1614 :type '(choice (const :tag "Always use primary" nil)
1617 (defcustom message-hierarchical-addresses nil
1618 "A list of hierarchical mail address definitions.
1620 Inside each entry, the first address is the \"top\" address, and
1621 subsequent addresses are subaddresses; this is used to indicate that
1622 mail sent to the first address will automatically be delivered to the
1623 subaddresses. So if the first address appears in the recipient list
1624 for a message, the subaddresses will be removed (if present) before
1625 the mail is sent. All addresses in this structure should be
1628 :group 'message-headers
1629 :type '(repeat (repeat string)))
1631 (defcustom message-mail-user-agent nil
1632 "Like `mail-user-agent'.
1633 Except if it is nil, use Gnus native MUA; if it is t, use
1636 :type '(radio (const :tag "Gnus native"
1639 (const :tag "`mail-user-agent'"
1642 (function-item :tag "Default Emacs mail"
1644 sendmail-user-agent)
1645 (function-item :tag "Emacs interface to MH"
1648 (function :tag "Other"))
1652 (defcustom message-wide-reply-confirm-recipients nil
1653 "Whether to confirm a wide reply to multiple email recipients.
1654 If this variable is nil, don't ask whether to reply to all recipients.
1655 If this variable is non-nil, pose the question \"Reply to all
1656 recipients?\" before a wide reply to multiple recipients. If the user
1657 answers yes, reply to all recipients as usual. If the user answers
1658 no, only reply back to the author."
1660 :group 'message-headers
1661 :link '(custom-manual "(message)Wide Reply")
1664 (defcustom message-user-fqdn nil
1665 "*Domain part of Message-Ids."
1667 :group 'message-headers
1668 :link '(custom-manual "(message)News Headers")
1669 :type '(radio (const :format "%v " nil)
1670 (string :format "FQDN: %v")))