1 ;;; message.el --- composing mail and news messages
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: mail, news
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; This mode provides mail-sending facilities from within Emacs. It
28 ;; consists mainly of large chunks of code from the sendmail.el,
29 ;; gnus-msg.el and rnewspost.el files.
33 (eval-when-compile (require 'cl))
37 (if (string-match "XEmacs\\|Lucid" emacs-version)
38 (require 'mail-abbrevs)
39 (require 'mailabbrev))
45 (defgroup message '((user-mail-address custom-variable)
46 (user-full-name custom-variable))
47 "Mail and news message composing."
48 :link '(custom-manual "(message)Top")
52 (put 'user-mail-address 'custom-type 'string)
53 (put 'user-full-name 'custom-type 'string)
55 (defgroup message-various nil
56 "Various Message Variables"
57 :link '(custom-manual "(message)Various Message Variables")
60 (defgroup message-buffers nil
62 :link '(custom-manual "(message)Message Buffers")
65 (defgroup message-sending nil
67 :link '(custom-manual "(message)Sending Variables")
70 (defgroup message-interface nil
72 :link '(custom-manual "(message)Interface")
75 (defgroup message-forwarding nil
77 :link '(custom-manual "(message)Forwarding")
78 :group 'message-interface)
80 (defgroup message-insertion nil
82 :link '(custom-manual "(message)Insertion")
85 (defgroup message-headers nil
87 :link '(custom-manual "(message)Message Headers")
90 (defgroup message-news nil
91 "Composing News Messages"
94 (defgroup message-mail nil
95 "Composing Mail Messages"
98 (defgroup message-faces nil
99 "Faces used for message composing."
103 (defcustom message-directory "~/Mail/"
104 "*Directory from which all other mail file variables are derived."
105 :group 'message-various
108 (defcustom message-max-buffers 10
109 "*How many buffers to keep before starting to kill them off."
110 :group 'message-buffers
113 (defcustom message-send-rename-function nil
114 "Function called to rename the buffer after sending it."
115 :group 'message-buffers
118 (defcustom message-fcc-handler-function 'message-output
119 "*A function called to save outgoing articles.
120 This function will be called with the name of the file to store the
121 article in. The default function is `message-output' which saves in Unix
123 :type '(radio (function-item message-output)
124 (function :tag "Other"))
125 :group 'message-sending)
127 (defcustom message-courtesy-message
128 "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n"
129 "*This is inserted at the start of a mailed copy of a posted message.
130 If the string contains the format spec \"%s\", the Newsgroups
131 the article has been posted to will be inserted there.
132 If this variable is nil, no such courtesy message will be added."
133 :group 'message-sending
136 (defcustom message-ignored-bounced-headers "^\\(Received\\|Return-Path\\):"
137 "*Regexp that matches headers to be removed in resent bounced mail."
138 :group 'message-interface
142 (defcustom message-from-style 'default
143 "*Specifies how \"From\" headers look.
145 If `nil', they contain just the return address like:
147 If `parens', they look like:
148 king@grassland.com (Elvis Parsley)
149 If `angles', they look like:
150 Elvis Parsley <king@grassland.com>
152 Otherwise, most addresses look like `angles', but they look like
153 `parens' if `angles' would need quoting and `parens' would not."
154 :type '(choice (const :tag "simple" nil)
158 :group 'message-headers)
160 (defcustom message-syntax-checks nil
161 ;; Guess this one shouldn't be easy to customize...
162 "*Controls what syntax checks should not be performed on outgoing posts.
163 To disable checking of long signatures, for instance, add
164 `(signature . disabled)' to this list.
166 Don't touch this variable unless you really know what you're doing.
168 Checks include subject-cmsg multiple-headers sendsys message-id from
169 long-lines control-chars size new-text redirected-followup signature
170 approved sender empty empty-headers message-id from subject
171 shorten-followup-to existing-newsgroups buffer-file-name unchanged
173 :group 'message-news)
175 (defcustom message-required-news-headers
176 '(From Newsgroups Subject Date Message-ID
177 (optional . Organization) Lines
178 (optional . User-Agent))
179 "*Headers to be generated or prompted for when posting an article.
180 RFC977 and RFC1036 require From, Date, Newsgroups, Subject,
181 Message-ID. Organization, Lines, In-Reply-To, Expires, and
182 User-Agent are optional. If don't you want message to insert some
183 header, remove it from this list."
185 :group 'message-headers
186 :type '(repeat sexp))
188 (defcustom message-required-mail-headers
189 '(From Subject Date (optional . In-Reply-To) Message-ID Lines
190 (optional . User-Agent))
191 "*Headers to be generated or prompted for when mailing a message.
192 RFC822 required that From, Date, To, Subject and Message-ID be
193 included. Organization, Lines and User-Agent are optional."
195 :group 'message-headers
196 :type '(repeat sexp))
198 (defcustom message-deletable-headers '(Message-ID Date Lines)
199 "Headers to be deleted if they already exist and were generated by message previously."
200 :group 'message-headers
203 (defcustom message-ignored-news-headers
204 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:"
205 "*Regexp of headers to be removed unconditionally before posting."
207 :group 'message-headers
210 (defcustom message-ignored-mail-headers "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:"
211 "*Regexp of headers to be removed unconditionally before mailing."
213 :group 'message-headers
216 (defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|^X-Complaints-To:"
217 "*Header lines matching this regexp will be deleted before posting.
218 It's best to delete old Path and Date headers before posting to avoid
220 :group 'message-interface
223 (defcustom message-subject-re-regexp "^[ \t]*\\([Rr][Ee]:[ \t]*\\)*[ \t]*"
224 "*Regexp matching \"Re: \" in the subject line."
225 :group 'message-various
229 (defcustom message-signature-separator "^-- *$"
230 "Regexp matching the signature separator."
232 :group 'message-various)
234 (defcustom message-elide-ellipsis "\n[...]\n\n"
235 "*The string which is inserted for elided text."
237 :group 'message-various)
239 (defcustom message-interactive nil
240 "Non-nil means when sending a message wait for and display errors.
241 nil means let mailer mail back a message to report errors."
242 :group 'message-sending
246 (defcustom message-generate-new-buffers 'unique
247 "*Non-nil means that a new message buffer will be created whenever `message-setup' is called.
248 If this is a function, call that function with three parameters: The type,
249 the to address and the group name. (Any of these may be nil.) The function
250 should return the new buffer name."
251 :group 'message-buffers
252 :type '(choice (const :tag "off" nil)
253 (const :tag "unique" unique)
254 (const :tag "unsent" unsent)
257 (defcustom message-kill-buffer-on-exit nil
258 "*Non-nil means that the message buffer will be killed after sending a message."
259 :group 'message-buffers
262 (defvar gnus-local-organization)
263 (defcustom message-user-organization
264 (or (and (boundp 'gnus-local-organization)
265 (stringp gnus-local-organization)
266 gnus-local-organization)
267 (getenv "ORGANIZATION")
269 "*String to be used as an Organization header.
270 If t, use `message-user-organization-file'."
271 :group 'message-headers
272 :type '(choice string
273 (const :tag "consult file" t)))
276 (defcustom message-user-organization-file "/usr/lib/news/organization"
277 "*Local news organization file."
279 :group 'message-headers)
281 (defcustom message-make-forward-subject-function
282 'message-forward-subject-author-subject
283 "*A list of functions that are called to generate a subject header for forwarded messages.
284 The subject generated by the previous function is passed into each
287 The provided functions are:
289 * message-forward-subject-author-subject (Source of article (author or
290 newsgroup)), in brackets followed by the subject
291 * message-forward-subject-fwd (Subject of article with 'Fwd:' prepended
293 :group 'message-forwarding
294 :type '(radio (function-item message-forward-subject-author-subject)
295 (function-item message-forward-subject-fwd)))
297 (defcustom message-forward-as-mime t
298 "*If non-nil, forward messages as an inline/rfc822 MIME section. Otherwise, directly inline the old message in the forwarded message."
299 :group 'message-forwarding
302 (defcustom message-forward-show-mml t
303 "*If non-nil, forward messages are shown as mml. Otherwise, forward messages are unchanged."
304 :group 'message-forwarding
307 (defcustom message-forward-before-signature t
308 "*If non-nil, put forwarded message before signature, else after."
309 :group 'message-forwarding
312 (defcustom message-wash-forwarded-subjects nil
313 "*If non-nil, try to remove as much old cruft as possible from the subject of messages before generating the new subject of a forward."
314 :group 'message-forwarding
317 (defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:"
318 "*All headers that match this regexp will be deleted when resending a message."
319 :group 'message-interface
322 (defcustom message-forward-ignored-headers "Content-Transfer-Encoding"
323 "*All headers that match this regexp will be deleted when forwarding a message."
324 :group 'message-forwarding
325 :type '(choice (const :tag "None" nil)
328 (defcustom message-ignored-cited-headers "."
329 "*Delete these headers from the messages you yank."
330 :group 'message-insertion
333 (defcustom message-cancel-message "I am canceling my own article.\n"
334 "Message to be inserted in the cancel message."
335 :group 'message-interface
338 ;; Useful to set in site-init.el
340 (defcustom message-send-mail-function 'message-send-mail-with-sendmail
341 "Function to call to send the current buffer as mail.
342 The headers should be delimited by a line whose contents match the
343 variable `mail-header-separator'.
345 Valid values include `message-send-mail-with-sendmail' (the default),
346 `message-send-mail-with-mh', `message-send-mail-with-qmail' and
348 :type '(radio (function-item message-send-mail-with-sendmail)
349 (function-item message-send-mail-with-mh)
350 (function-item message-send-mail-with-qmail)
351 (function-item smtpmail-send-it)
352 (function :tag "Other"))
353 :group 'message-sending
354 :group 'message-mail)
356 (defcustom message-send-news-function 'message-send-news
357 "Function to call to send the current buffer as news.
358 The headers should be delimited by a line whose contents match the
359 variable `mail-header-separator'."
360 :group 'message-sending
364 (defcustom message-reply-to-function nil
365 "Function that should return a list of headers.
366 This function should pick out addresses from the To, Cc, and From headers
367 and respond with new To and Cc headers."
368 :group 'message-interface
371 (defcustom message-wide-reply-to-function nil
372 "Function that should return a list of headers.
373 This function should pick out addresses from the To, Cc, and From headers
374 and respond with new To and Cc headers."
375 :group 'message-interface
378 (defcustom message-followup-to-function nil
379 "Function that should return a list of headers.
380 This function should pick out addresses from the To, Cc, and From headers
381 and respond with new To and Cc headers."
382 :group 'message-interface
385 (defcustom message-use-followup-to 'ask
386 "*Specifies what to do with Followup-To header.
387 If nil, always ignore the header. If it is t, use its value, but
388 query before using the \"poster\" value. If it is the symbol `ask',
389 always query the user whether to use the value. If it is the symbol
390 `use', always use the value."
391 :group 'message-interface
392 :type '(choice (const :tag "ignore" nil)
396 (defcustom message-sendmail-f-is-evil nil
397 "*Non-nil means that \"-f username\" should not be added to the sendmail command line.
398 Doing so would be even more evil than leaving it out."
399 :group 'message-sending
402 ;; qmail-related stuff
403 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
404 "Location of the qmail-inject program."
405 :group 'message-sending
408 (defcustom message-qmail-inject-args nil
409 "Arguments passed to qmail-inject programs.
410 This should be a list of strings, one string for each argument.
412 For e.g., if you wish to set the envelope sender address so that bounces
413 go to the right place or to deal with listserv's usage of that address, you
414 might set this variable to '(\"-f\" \"you@some.where\")."
415 :group 'message-sending
416 :type '(repeat string))
418 (defvar message-cater-to-broken-inn t
419 "Non-nil means Gnus should not fold the `References' header.
420 Folding `References' makes ancient versions of INN create incorrect
423 (defvar gnus-post-method)
424 (defvar gnus-select-method)
425 (defcustom message-post-method
426 (cond ((and (boundp 'gnus-post-method)
427 (listp gnus-post-method)
430 ((boundp 'gnus-select-method)
433 "*Method used to post news.
434 Note that when posting from inside Gnus, for instance, this
435 variable isn't used."
437 :group 'message-sending
438 ;; This should be the `gnus-select-method' widget, but that might
439 ;; create a dependence to `gnus.el'.
442 (defcustom message-generate-headers-first nil
443 "*If non-nil, generate all possible headers before composing."
444 :group 'message-headers
447 (defcustom message-setup-hook nil
448 "Normal hook, run each time a new outgoing message is initialized.
449 The function `message-setup' runs this hook."
450 :group 'message-various
453 (defcustom message-cancel-hook nil
454 "Hook run when cancelling articles."
455 :group 'message-various
458 (defcustom message-signature-setup-hook nil
459 "Normal hook, run each time a new outgoing message is initialized.
460 It is run after the headers have been inserted and before
461 the signature is inserted."
462 :group 'message-various
465 (defcustom message-mode-hook nil
466 "Hook run in message mode buffers."
467 :group 'message-various
470 (defcustom message-header-hook nil
471 "Hook run in a message mode buffer narrowed to the headers."
472 :group 'message-various
475 (defcustom message-header-setup-hook nil
476 "Hook called narrowed to the headers when setting up a message buffer."
477 :group 'message-various
481 (defcustom message-citation-line-function 'message-insert-citation-line
482 "*Function called to insert the \"Whomever writes:\" line."
484 :group 'message-insertion)
487 (defcustom message-yank-prefix "> "
488 "*Prefix inserted on the lines of yanked messages."
490 :group 'message-insertion)
492 (defcustom message-indentation-spaces 3
493 "*Number of spaces to insert at the beginning of each cited line.
494 Used by `message-yank-original' via `message-yank-cite'."
495 :group 'message-insertion
499 (defcustom message-cite-function 'message-cite-original
500 "*Function for citing an original message.
501 Predefined functions include `message-cite-original' and
502 `message-cite-original-without-signature'.
503 Note that `message-cite-original' uses `mail-citation-hook' if that is non-nil."
504 :type '(radio (function-item message-cite-original)
505 (function-item message-cite-original-without-signature)
506 (function-item sc-cite-original)
507 (function :tag "Other"))
508 :group 'message-insertion)
511 (defcustom message-indent-citation-function 'message-indent-citation
512 "*Function for modifying a citation just inserted in the mail buffer.
513 This can also be a list of functions. Each function can find the
514 citation between (point) and (mark t). And each function should leave
515 point and mark around the citation text as modified."
517 :group 'message-insertion)
519 (defvar message-abbrevs-loaded nil)
522 (defcustom message-signature t
523 "*String to be inserted at the end of the message buffer.
524 If t, the `message-signature-file' file will be inserted instead.
525 If a function, the result from the function will be used instead.
526 If a form, the result from the form will be used instead."
528 :group 'message-insertion)
531 (defcustom message-signature-file "~/.signature"
532 "*File containing the text inserted at end of message buffer."
534 :group 'message-insertion)
536 (defcustom message-distribution-function nil
537 "*Function called to return a Distribution header."
539 :group 'message-headers
542 (defcustom message-expires 14
543 "Number of days before your article expires."
545 :group 'message-headers
546 :link '(custom-manual "(message)News Headers")
549 (defcustom message-user-path nil
550 "If nil, use the NNTP server name in the Path header.
551 If stringp, use this; if non-nil, use no host name (user name only)."
553 :group 'message-headers
554 :link '(custom-manual "(message)News Headers")
555 :type '(choice (const :tag "nntp" nil)
557 (sexp :tag "none" :format "%t" t)))
559 (defvar message-reply-buffer nil)
560 (defvar message-reply-headers nil)
561 (defvar message-newsreader nil)
562 (defvar message-mailer nil)
563 (defvar message-sent-message-via nil)
564 (defvar message-checksum nil)
565 (defvar message-send-actions nil
566 "A list of actions to be performed upon successful sending of a message.")
567 (defvar message-exit-actions nil
568 "A list of actions to be performed upon exiting after sending a message.")
569 (defvar message-kill-actions nil
570 "A list of actions to be performed before killing a message buffer.")
571 (defvar message-postpone-actions nil
572 "A list of actions to be performed after postponing a message.")
574 (define-widget 'message-header-lines 'text
575 "All header lines must be LFD terminated."
578 :error "All header lines must be newline terminated")
580 (defcustom message-default-headers ""
581 "*A string containing header lines to be inserted in outgoing messages.
582 It is inserted before you edit the message, so you can edit or delete
584 :group 'message-headers
585 :type 'message-header-lines)
587 (defcustom message-default-mail-headers ""
588 "*A string of header lines to be inserted in outgoing mails."
589 :group 'message-headers
591 :type 'message-header-lines)
593 (defcustom message-default-news-headers ""
594 "*A string of header lines to be inserted in outgoing news articles."
595 :group 'message-headers
597 :type 'message-header-lines)
599 ;; Note: could use /usr/ucb/mail instead of sendmail;
600 ;; options -t, and -v if not interactive.
601 (defcustom message-mailer-swallows-blank-line
602 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)"
603 system-configuration)
604 (file-readable-p "/etc/sendmail.cf")
605 (let ((buffer (get-buffer-create " *temp*")))
609 (insert-file-contents "/etc/sendmail.cf")
610 (goto-char (point-min))
611 (let ((case-fold-search nil))
612 (re-search-forward "^OR\\>" nil t)))
613 (kill-buffer buffer))))
614 ;; According to RFC822, "The field-name must be composed of printable
615 ;; ASCII characters (i. e., characters that have decimal values between
616 ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
618 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:"))
619 "*Set this non-nil if the system's mailer runs the header and body together.
620 \(This problem exists on Sunos 4 when sendmail is run in remote mode.)
621 The value should be an expression to test whether the problem will
623 :group 'message-sending
626 ;; Ignore errors in case this is used in Emacs 19.
627 ;; Don't use ignore-errors because this is copied into loaddefs.el.
630 (define-mail-user-agent 'message-user-agent
631 'message-mail 'message-send-and-exit
632 'message-kill-buffer 'message-send-hook))
634 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender)
635 "If non-nil, delete the deletable headers before feeding to mh.")
637 (defvar message-send-method-alist
638 '((news message-news-p message-send-via-news)
639 (mail message-mail-p message-send-via-mail))
640 "Alist of ways to send outgoing messages.
641 Each element has the form
643 \(TYPE PREDICATE FUNCTION)
645 where TYPE is a symbol that names the method; PREDICATE is a function
646 called without any parameters to determine whether the message is
647 a message of type TYPE; and FUNCTION is a function to be called if
648 PREDICATE returns non-nil. FUNCTION is called with one parameter --
651 (defvar message-mail-alias-type 'abbrev
652 "*What alias expansion type to use in Message buffers.
653 The default is `abbrev', which uses mailabbrev. nil switches
656 (defcustom message-auto-save-directory
657 (nnheader-concat message-directory "drafts/")
658 "*Directory where Message auto-saves buffers if Gnus isn't running.
659 If nil, Message won't auto-save."
660 :group 'message-buffers
663 (defcustom message-buffer-naming-style 'unique
664 "*The way new message buffers are named.
665 Valid valued are `unique' and `unsent'."
666 :group 'message-buffers
667 :type '(choice (const :tag "unique" unique)
668 (const :tag "unsent" unsent)))
670 (defcustom message-default-charset nil
671 "Default charset used in non-MULE XEmacsen."
675 (defcustom message-dont-reply-to-names rmail-dont-reply-to-names
676 "*A regexp specifying names to prune when doing wide replies.
677 A value of nil means exclude your own name only."
679 :type '(choice (const :tag "Yourself" nil)
682 ;;; Internal variables.
683 ;;; Well, not really internal.
685 (defvar message-mode-syntax-table
686 (let ((table (copy-syntax-table text-mode-syntax-table)))
687 (modify-syntax-entry ?% ". " table)
688 (modify-syntax-entry ?> ". " table)
689 (modify-syntax-entry ?< ". " table)
691 "Syntax table used while in Message mode.")
693 (defvar message-mode-abbrev-table text-mode-abbrev-table
694 "Abbrev table used in Message mode buffers.
695 Defaults to `text-mode-abbrev-table'.")
696 (defgroup message-headers nil
698 :link '(custom-manual "(message)Variables")
701 (defface message-header-to-face
704 (:foreground "green2" :bold t))
707 (:foreground "MidnightBlue" :bold t))
709 (:bold t :italic t)))
710 "Face used for displaying From headers."
711 :group 'message-faces)
713 (defface message-header-cc-face
716 (:foreground "green4" :bold t))
719 (:foreground "MidnightBlue"))
722 "Face used for displaying Cc headers."
723 :group 'message-faces)
725 (defface message-header-subject-face
728 (:foreground "green3"))
731 (:foreground "navy blue" :bold t))
734 "Face used for displaying subject headers."
735 :group 'message-faces)
737 (defface message-header-newsgroups-face
740 (:foreground "yellow" :bold t :italic t))
743 (:foreground "blue4" :bold t :italic t))
745 (:bold t :italic t)))
746 "Face used for displaying newsgroups headers."
747 :group 'message-faces)
749 (defface message-header-other-face
752 (:foreground "#b00000"))
755 (:foreground "steel blue"))
757 (:bold t :italic t)))
758 "Face used for displaying newsgroups headers."
759 :group 'message-faces)
761 (defface message-header-name-face
764 (:foreground "DarkGreen"))
767 (:foreground "cornflower blue"))
770 "Face used for displaying header names."
771 :group 'message-faces)
773 (defface message-header-xheader-face
776 (:foreground "blue"))
779 (:foreground "blue"))
782 "Face used for displaying X-Header headers."
783 :group 'message-faces)
785 (defface message-separator-face
788 (:foreground "blue3"))
791 (:foreground "brown"))
794 "Face used for displaying the separator."
795 :group 'message-faces)
797 (defface message-cited-text-face
806 "Face used for displaying cited text names."
807 :group 'message-faces)
809 (defface message-mml-face
812 (:foreground "ForestGreen"))
815 (:foreground "ForestGreen"))
818 "Face used for displaying MML."
819 :group 'message-faces)
821 (defvar message-font-lock-keywords
822 (let* ((cite-prefix "A-Za-z")
823 (cite-suffix (concat cite-prefix "0-9_.@-"))
824 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)"))
825 `((,(concat "^\\([Tt]o:\\)" content)
826 (1 'message-header-name-face)
827 (2 'message-header-to-face nil t))
828 (,(concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content)
829 (1 'message-header-name-face)
830 (2 'message-header-cc-face nil t))
831 (,(concat "^\\([Ss]ubject:\\)" content)
832 (1 'message-header-name-face)
833 (2 'message-header-subject-face nil t))
834 (,(concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content)
835 (1 'message-header-name-face)
836 (2 'message-header-newsgroups-face nil t))
837 (,(concat "^\\([A-Z][^: \n\t]+:\\)" content)
838 (1 'message-header-name-face)
839 (2 'message-header-other-face nil t))
840 (,(concat "^\\(X-[A-Za-z0-9-]+\\|In-Reply-To\\):" content)
841 (1 'message-header-name-face)
842 (2 'message-header-name-face))
843 ,@(if (and mail-header-separator
844 (not (equal mail-header-separator "")))
845 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
846 1 'message-separator-face))
849 "\\([" cite-prefix "]+[" cite-suffix "]*\\)?"
851 (0 'message-cited-text-face))
852 ("<#/?\\(multipart\\|part\\|external\\|mml\\).*>"
853 (0 'message-mml-face))))
854 "Additional expressions to highlight in Message mode.")
856 ;; XEmacs does it like this. For Emacs, we have to set the
857 ;; `font-lock-defaults' buffer-local variable.
858 (put 'message-mode 'font-lock-defaults '(message-font-lock-keywords t))
860 (defvar message-face-alist
861 '((bold . bold-region)
862 (underline . underline-region)
863 (default . (lambda (b e)
865 (ununderline-region b e))))
866 "Alist of mail and news faces for facemenu.
867 The cdr of ech entry is a function for applying the face to a region.")
869 (defcustom message-send-hook nil
870 "Hook run before sending messages."
871 :group 'message-various
872 :options '(ispell-message)
875 (defcustom message-send-mail-hook nil
876 "Hook run before sending mail messages."
877 :group 'message-various
880 (defcustom message-send-news-hook nil
881 "Hook run before sending news messages."
882 :group 'message-various
885 (defcustom message-sent-hook nil
886 "Hook run after sending messages."
887 :group 'message-various
890 (defvar message-send-coding-system 'binary
891 "Coding system to encode outgoing mail.")
893 (defvar message-draft-coding-system
894 mm-auto-save-coding-system
895 "Coding system to compose mail.")
897 (defcustom message-send-mail-partially-limit 1000000
898 "The limitation of messages sent as message/partial.
899 The lower bound of message size in characters, beyond which the message
900 should be sent in several parts. If it is nil, the size is unlimited."
901 :group 'message-buffers
902 :type '(choice (const :tag "unlimited" nil)
905 ;;; Internal variables.
907 (defvar message-buffer-list nil)
908 (defvar message-this-is-news nil)
909 (defvar message-this-is-mail nil)
910 (defvar message-draft-article nil)
911 (defvar message-mime-part nil)
912 (defvar message-posting-charset nil)
914 ;; Byte-compiler warning
915 (defvar gnus-active-hashtb)
916 (defvar gnus-read-active-file)
918 ;;; Regexp matching the delimiter of messages in UNIX mail format
919 ;;; (UNIX From lines), minus the initial ^. It should be a copy
920 ;;; of rmail.el's rmail-unix-mail-delimiter.
921 (defvar message-unix-mail-delimiter
922 (let ((time-zone-regexp
923 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?"
924 "\\|[-+]?[0-9][0-9][0-9][0-9]"
930 ;; Many things can happen to an RFC 822 mailbox before it is put into
931 ;; a `From' line. The leading phrase can be stripped, e.g.
932 ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g.
933 ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF
934 ;; can be removed, e.g.
935 ;; From: joe@y.z (Joe K
937 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and
940 ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'.
941 ;; The mailbox can be removed or be replaced by white space, e.g.
942 ;; From: "Joe User"{space}{tab}
944 ;; can yield `From {space}{tab} Fri Mar 22 08:11:15 1996',
945 ;; where {space} and {tab} represent the Ascii space and tab characters.
946 ;; We want to match the results of any of these manglings.
947 ;; The following regexp rejects names whose first characters are
948 ;; obviously bogus, but after that anything goes.
949 "\\([^\0-\b\n-\r\^?].*\\)? "
951 ;; The time the message was sent.
952 "\\([^\0-\r \^?]+\\) +" ; day of the week
953 "\\([^\0-\r \^?]+\\) +" ; month
954 "\\([0-3]?[0-9]\\) +" ; day of month
955 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day
957 ;; Perhaps a time zone, specified by an abbreviation, or by a
962 " \\([0-9][0-9]+\\) *"
964 ;; On some systems the time zone can appear after the year, too.
968 "\\(remote from .*\\)?"
971 "Regexp matching the delimiter of messages in UNIX mail format.")
973 (defvar message-unsent-separator
974 (concat "^ *---+ +Unsent message follows +---+ *$\\|"
975 "^ *---+ +Returned message +---+ *$\\|"
976 "^Start of returned message$\\|"
977 "^ *---+ +Original message +---+ *$\\|"
978 "^ *--+ +begin message +--+ *$\\|"
979 "^ *---+ +Original message follows +---+ *$\\|"
980 "^ *---+ +Undelivered message follows +---+ *$\\|"
981 "^|? *---+ +Message text follows: +---+ *|?$")
982 "A regexp that matches the separator before the text of a failed message.")
984 (defvar message-header-format-alist
986 (To . message-fill-address)
987 (Cc . message-fill-address)
998 (References . message-shorten-references)
1000 "Alist used for formatting headers.")
1003 (autoload 'message-setup-toolbar "messagexmas")
1004 (autoload 'mh-new-draft-name "mh-comp")
1005 (autoload 'mh-send-letter "mh-comp")
1006 (autoload 'gnus-point-at-eol "gnus-util")
1007 (autoload 'gnus-point-at-bol "gnus-util")
1008 (autoload 'gnus-output-to-rmail "gnus-util")
1009 (autoload 'gnus-output-to-mail "gnus-util")
1010 (autoload 'mail-abbrev-in-expansion-header-p "mailabbrev")
1011 (autoload 'nndraft-request-associate-buffer "nndraft")
1012 (autoload 'nndraft-request-expire-articles "nndraft")
1013 (autoload 'gnus-open-server "gnus-int")
1014 (autoload 'gnus-request-post "gnus-int")
1015 (autoload 'gnus-alive-p "gnus-util")
1016 (autoload 'gnus-list-identifiers "gnus-sum")
1017 (autoload 'rmail-output "rmail"))
1022 ;;; Utility functions.
1025 (defmacro message-y-or-n-p (question show &rest text)
1026 "Ask QUESTION, displaying the rest of the arguments in a temp. buffer if SHOW"
1027 `(message-talkative-question 'y-or-n-p ,question ,show ,@text))
1029 ;; Delete the current line (and the next N lines.);
1030 (defmacro message-delete-line (&optional n)
1031 `(delete-region (progn (beginning-of-line) (point))
1032 (progn (forward-line ,(or n 1)) (point))))
1034 (defun message-tokenize-header (header &optional separator)
1035 "Split HEADER into a list of header elements.
1036 \",\" is used as the separator."
1039 (let ((regexp (format "[%s]+" (or separator ",")))
1044 (message-set-work-buffer)
1046 (goto-char (point-min))
1051 (cond ((and (> (point) beg)
1053 (and (looking-at regexp)
1056 (push (buffer-substring beg (point)) elems)
1057 (setq beg (match-end 0)))
1058 ((eq (char-after) ?\")
1059 (setq quoted (not quoted)))
1060 ((and (eq (char-after) ?\()
1063 ((and (eq (char-after) ?\))
1066 (nreverse elems)))))
1068 (defun message-mail-file-mbox-p (file)
1069 "Say whether FILE looks like a Unix mbox file."
1070 (when (and (file-exists-p file)
1071 (file-readable-p file)
1072 (file-regular-p file))
1074 (nnheader-insert-file-contents file)
1075 (goto-char (point-min))
1076 (looking-at message-unix-mail-delimiter))))
1078 (defun message-fetch-field (header &optional not-all)
1079 "The same as `mail-fetch-field', only remove all newlines."
1080 (let* ((inhibit-point-motion-hooks t)
1081 (case-fold-search t)
1082 (value (mail-fetch-field header nil (not not-all))))
1084 (while (string-match "\n[\t ]+" value)
1085 (setq value (replace-match " " t t value)))
1086 ;; We remove all text props.
1087 (format "%s" value))))
1089 (defun message-narrow-to-field ()
1090 "Narrow the buffer to the header on the current line."
1096 (if (re-search-forward "^[^ \n\t]" nil t)
1101 (goto-char (point-min)))
1103 (defun message-add-header (&rest headers)
1104 "Add the HEADERS to the message header, skipping those already present."
1107 (unless (string-match "^\\([^:]+\\):[ \t]*[^ \t]" (car headers))
1108 (error "Invalid header `%s'" (car headers)))
1109 (setq hclean (match-string 1 (car headers)))
1111 (message-narrow-to-headers)
1112 (unless (re-search-forward (concat "^" (regexp-quote hclean) ":") nil t)
1113 (insert (car headers) ?\n))))
1114 (setq headers (cdr headers))))
1117 (defun message-fetch-reply-field (header)
1118 "Fetch FIELD from the message we're replying to."
1119 (when (and message-reply-buffer
1120 (buffer-name message-reply-buffer))
1122 (set-buffer message-reply-buffer)
1123 (message-fetch-field header))))
1125 (defun message-set-work-buffer ()
1126 (if (get-buffer " *message work*")
1128 (set-buffer " *message work*")
1130 (set-buffer (get-buffer-create " *message work*"))
1131 (kill-all-local-variables)
1132 (mm-enable-multibyte)))
1134 (defun message-functionp (form)
1135 "Return non-nil if FORM is funcallable."
1136 (or (and (symbolp form) (fboundp form))
1137 (and (listp form) (eq (car form) 'lambda))
1138 (byte-code-function-p form)))
1140 (defun message-strip-list-identifiers (subject)
1141 "Remove list identifiers in `gnus-list-identifiers'."
1142 (let ((regexp (if (stringp gnus-list-identifiers)
1143 gnus-list-identifiers
1144 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
1145 (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
1146 " *\\)\\)+\\(Re: +\\)?\\)") subject)
1147 (concat (substring subject 0 (match-beginning 1))
1148 (or (match-string 3 subject)
1149 (match-string 5 subject))
1154 (defun message-strip-subject-re (subject)
1155 "Remove \"Re:\" from subject lines."
1156 (if (string-match message-subject-re-regexp subject)
1157 (substring subject (match-end 0))
1160 (defun message-remove-header (header &optional is-regexp first reverse)
1161 "Remove HEADER in the narrowed buffer.
1162 If REGEXP, HEADER is a regular expression.
1163 If FIRST, only remove the first instance of the header.
1164 Return the number of headers removed."
1165 (goto-char (point-min))
1166 (let ((regexp (if is-regexp header (concat "^" (regexp-quote header) ":")))
1168 (case-fold-search t)
1170 (while (and (not (eobp))
1173 (not (looking-at regexp))
1174 (looking-at regexp))
1181 ;; There might be a continuation header, so we have to search
1182 ;; until we find a new non-continuation line.
1185 (if (re-search-forward "^[^ \t]" nil t)
1186 (goto-char (match-beginning 0))
1189 (if (re-search-forward "^[^ \t]" nil t)
1190 (goto-char (match-beginning 0))
1191 (goto-char (point-max)))))
1194 (defun message-remove-first-header (header)
1195 "Remove the first instance of HEADER if there is more than one."
1197 (regexp (concat "^" (regexp-quote header) ":")))
1199 (goto-char (point-min))
1200 (while (re-search-forward regexp nil t)
1203 (message-remove-header header nil t)
1206 (defun message-narrow-to-headers ()
1207 "Narrow the buffer to the head of the message."
1210 (goto-char (point-min))
1211 (if (re-search-forward
1212 (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
1215 (goto-char (point-min)))
1217 (defun message-narrow-to-head ()
1218 "Narrow the buffer to the head of the message.
1219 Point is left at the beginning of the narrowed-to region."
1222 (goto-char (point-min))
1223 (if (search-forward "\n\n" nil 1)
1226 (goto-char (point-min)))
1228 (defun message-narrow-to-headers-or-head ()
1229 "Narrow the buffer to the head of the message."
1232 (goto-char (point-min))
1235 (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
1236 (match-beginning 0))
1237 ((search-forward "\n\n" nil t)
1241 (goto-char (point-min)))
1243 (defun message-news-p ()
1244 "Say whether the current buffer contains a news message."
1245 (and (not message-this-is-mail)
1246 (or message-this-is-news
1249 (message-narrow-to-headers)
1250 (and (message-fetch-field "newsgroups")
1251 (not (message-fetch-field "posted-to"))))))))
1253 (defun message-mail-p ()
1254 "Say whether the current buffer contains a mail message."
1255 (and (not message-this-is-news)
1256 (or message-this-is-mail
1259 (message-narrow-to-headers)
1260 (or (message-fetch-field "to")
1261 (message-fetch-field "cc")
1262 (message-fetch-field "bcc")))))))
1264 (defun message-next-header ()
1265 "Go to the beginning of the next header."
1267 (or (eobp) (forward-char 1))
1268 (not (if (re-search-forward "^[^ \t]" nil t)
1270 (goto-char (point-max)))))
1272 (defun message-sort-headers-1 ()
1273 "Sort the buffer as headers using `message-rank' text props."
1274 (goto-char (point-min))
1277 nil 'message-next-header
1279 (message-next-header)
1283 (or (get-text-property (point) 'message-rank)
1286 (defun message-sort-headers ()
1287 "Sort the headers of the current message according to `message-header-format-alist'."
1291 (let ((max (1+ (length message-header-format-alist)))
1293 (message-narrow-to-headers)
1294 (while (re-search-forward "^[^ \n]+:" nil t)
1296 (match-beginning 0) (1+ (match-beginning 0))
1298 (if (setq rank (length (memq (assq (intern (buffer-substring
1300 (1- (match-end 0))))
1301 message-header-format-alist)
1302 message-header-format-alist)))
1305 (message-sort-headers-1))))
1315 (defvar message-mode-map nil)
1317 (unless message-mode-map
1318 (setq message-mode-map (make-keymap))
1319 (set-keymap-parent message-mode-map text-mode-map)
1320 (define-key message-mode-map "\C-c?" 'describe-mode)
1322 (define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to)
1323 (define-key message-mode-map "\C-c\C-f\C-b" 'message-goto-bcc)
1324 (define-key message-mode-map "\C-c\C-f\C-w" 'message-goto-fcc)
1325 (define-key message-mode-map "\C-c\C-f\C-c" 'message-goto-cc)
1326 (define-key message-mode-map "\C-c\C-f\C-s" 'message-goto-subject)
1327 (define-key message-mode-map "\C-c\C-f\C-r" 'message-goto-reply-to)
1328 (define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups)
1329 (define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution)
1330 (define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to)
1331 (define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords)
1332 (define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary)
1333 (define-key message-mode-map "\C-c\C-b" 'message-goto-body)
1334 (define-key message-mode-map "\C-c\C-i" 'message-goto-signature)
1336 (define-key message-mode-map "\C-c\C-t" 'message-insert-to)
1337 (define-key message-mode-map "\C-c\C-n" 'message-insert-newsgroups)
1339 (define-key message-mode-map "\C-c\C-y" 'message-yank-original)
1340 (define-key message-mode-map "\C-c\M-\C-y" 'message-yank-buffer)
1341 (define-key message-mode-map "\C-c\C-q" 'message-fill-yanked-message)
1342 (define-key message-mode-map "\C-c\C-w" 'message-insert-signature)
1343 (define-key message-mode-map "\C-c\M-h" 'message-insert-headers)
1344 (define-key message-mode-map "\C-c\C-r" 'message-caesar-buffer-body)
1345 (define-key message-mode-map "\C-c\C-o" 'message-sort-headers)
1346 (define-key message-mode-map "\C-c\M-r" 'message-rename-buffer)
1348 (define-key message-mode-map "\C-c\C-c" 'message-send-and-exit)
1349 (define-key message-mode-map "\C-c\C-s" 'message-send)
1350 (define-key message-mode-map "\C-c\C-k" 'message-kill-buffer)
1351 (define-key message-mode-map "\C-c\C-d" 'message-dont-send)
1353 (define-key message-mode-map "\C-c\C-e" 'message-elide-region)
1354 (define-key message-mode-map "\C-c\C-v" 'message-delete-not-region)
1355 (define-key message-mode-map "\C-c\C-z" 'message-kill-to-signature)
1356 (define-key message-mode-map "\M-\r" 'message-newline-and-reformat)
1358 (define-key message-mode-map "\C-c\C-a" 'mml-attach-file)
1360 (define-key message-mode-map "\t" 'message-tab))
1363 message-mode-menu message-mode-map "Message Menu."
1365 ["Sort Headers" message-sort-headers t]
1366 ["Yank Original" message-yank-original t]
1367 ["Fill Yanked Message" message-fill-yanked-message t]
1368 ["Insert Signature" message-insert-signature t]
1369 ["Caesar (rot13) Message" message-caesar-buffer-body t]
1370 ["Caesar (rot13) Region" message-caesar-region (mark t)]
1371 ["Elide Region" message-elide-region (mark t)]
1372 ["Delete Outside Region" message-delete-not-region (mark t)]
1373 ["Kill To Signature" message-kill-to-signature t]
1374 ["Newline and Reformat" message-newline-and-reformat t]
1375 ["Rename buffer" message-rename-buffer t]
1376 ["Spellcheck" ispell-message t]
1377 ["Attach file as MIME" mml-attach-file t]
1379 ["Send Message" message-send-and-exit t]
1380 ["Abort Message" message-dont-send t]
1381 ["Kill Message" message-kill-buffer t]))
1384 message-mode-field-menu message-mode-map ""
1386 ["Fetch To" message-insert-to t]
1387 ["Fetch Newsgroups" message-insert-newsgroups t]
1389 ["To" message-goto-to t]
1390 ["Subject" message-goto-subject t]
1391 ["Cc" message-goto-cc t]
1392 ["Reply-To" message-goto-reply-to t]
1393 ["Summary" message-goto-summary t]
1394 ["Keywords" message-goto-keywords t]
1395 ["Newsgroups" message-goto-newsgroups t]
1396 ["Followup-To" message-goto-followup-to t]
1397 ["Distribution" message-goto-distribution t]
1398 ["Body" message-goto-body t]
1399 ["Signature" message-goto-signature t]))
1401 (defvar facemenu-add-face-function)
1402 (defvar facemenu-remove-face-function)
1405 (defun message-mode ()
1406 "Major mode for editing mail and news to be sent.
1407 Like Text Mode but with these additional commands:
1408 C-c C-s message-send (send the message) C-c C-c message-send-and-exit
1409 C-c C-d Pospone sending the message C-c C-k Kill the message
1410 C-c C-f move to a header field (and create it if there isn't):
1411 C-c C-f C-t move to To C-c C-f C-s move to Subject
1412 C-c C-f C-c move to Cc C-c C-f C-b move to Bcc
1413 C-c C-f C-w move to Fcc C-c C-f C-r move to Reply-To
1414 C-c C-f C-u move to Summary C-c C-f C-n move to Newsgroups
1415 C-c C-f C-k move to Keywords C-c C-f C-d move to Distribution
1416 C-c C-f C-f move to Followup-To
1417 C-c C-t message-insert-to (add a To header to a news followup)
1418 C-c C-n message-insert-newsgroups (add a Newsgroup header to a news reply)
1419 C-c C-b message-goto-body (move to beginning of message text).
1420 C-c C-i message-goto-signature (move to the beginning of the signature).
1421 C-c C-w message-insert-signature (insert `message-signature-file' file).
1422 C-c C-y message-yank-original (insert current message, if any).
1423 C-c C-q message-fill-yanked-message (fill what was yanked).
1424 C-c C-e message-elide-region (elide the text between point and mark).
1425 C-c C-v message-delete-not-region (remove the text outside the region).
1426 C-c C-z message-kill-to-signature (kill the text up to the signature).
1427 C-c C-r message-caesar-buffer-body (rot13 the message body).
1428 C-c C-a mml-attach-file (attach a file as MIME).
1429 M-RET message-newline-and-reformat (break the line and reformat)."
1431 (if (local-variable-p 'mml-buffer-list (current-buffer))
1432 (mml-destroy-buffers))
1433 (kill-all-local-variables)
1434 (set (make-local-variable 'message-reply-buffer) nil)
1435 (make-local-variable 'message-send-actions)
1436 (make-local-variable 'message-exit-actions)
1437 (make-local-variable 'message-kill-actions)
1438 (make-local-variable 'message-postpone-actions)
1439 (make-local-variable 'message-draft-article)
1440 (make-local-hook 'kill-buffer-hook)
1441 (set-syntax-table message-mode-syntax-table)
1442 (use-local-map message-mode-map)
1443 (setq local-abbrev-table message-mode-abbrev-table)
1444 (setq major-mode 'message-mode)
1445 (setq mode-name "Message")
1446 (setq buffer-offer-save t)
1447 (make-local-variable 'facemenu-add-face-function)
1448 (make-local-variable 'facemenu-remove-face-function)
1449 (setq facemenu-add-face-function
1451 (let ((face-fun (cdr (assq face message-face-alist))))
1453 (funcall face-fun (point) end)
1454 (error "Face %s not configured for %s mode" face mode-name)))
1456 facemenu-remove-face-function t)
1457 (make-local-variable 'paragraph-separate)
1458 (make-local-variable 'paragraph-start)
1459 ;; `-- ' precedes the signature. `-----' appears at the start of the
1460 ;; lines that delimit forwarded messages.
1461 ;; Lines containing just >= 3 dashes, perhaps after whitespace,
1462 ;; are also sometimes used and should be separators.
1463 (setq paragraph-start
1464 (concat (regexp-quote mail-header-separator)
1465 "$\\|[ \t]*[a-z0-9A-Z]*>+[ \t]*$\\|[ \t]*$\\|"
1468 ;;!!! Uhm... shurely this can't be right?
1469 "[> " (regexp-quote message-yank-prefix) "]+$"))
1470 (setq paragraph-separate paragraph-start)
1471 (make-local-variable 'message-reply-headers)
1472 (setq message-reply-headers nil)
1473 (make-local-variable 'message-newsreader)
1474 (make-local-variable 'message-mailer)
1475 (make-local-variable 'message-post-method)
1476 (set (make-local-variable 'message-sent-message-via) nil)
1477 (set (make-local-variable 'message-checksum) nil)
1478 (set (make-local-variable 'message-mime-part) 0)
1479 ;;(when (fboundp 'mail-hist-define-keys)
1480 ;; (mail-hist-define-keys))
1481 (when (string-match "XEmacs\\|Lucid" emacs-version)
1482 (message-setup-toolbar))
1483 (easy-menu-add message-mode-menu message-mode-map)
1484 (easy-menu-add message-mode-field-menu message-mode-map)
1485 ;; Allow mail alias things.
1486 (when (eq message-mail-alias-type 'abbrev)
1487 (if (fboundp 'mail-abbrevs-setup)
1488 (mail-abbrevs-setup)
1489 (mail-aliases-setup)))
1490 (message-set-auto-save-file-name)
1491 (unless (string-match "XEmacs" emacs-version)
1492 (set (make-local-variable 'font-lock-defaults)
1493 '(message-font-lock-keywords t)))
1494 (make-local-variable 'adaptive-fill-regexp)
1495 (setq adaptive-fill-regexp
1496 (concat "[ \t]*[-a-z0-9A-Z]*\\(>[ \t]*\\)+[ \t]*\\|" adaptive-fill-regexp))
1497 (unless (boundp 'adaptive-fill-first-line-regexp)
1498 (setq adaptive-fill-first-line-regexp nil))
1499 (make-local-variable 'adaptive-fill-first-line-regexp)
1500 (setq adaptive-fill-first-line-regexp
1501 (concat "[ \t]*[-a-z0-9A-Z]*\\(>[ \t]*\\)+[ \t]*\\|"
1502 adaptive-fill-first-line-regexp))
1503 (make-local-variable 'auto-fill-inhibit-regexp)
1504 (setq auto-fill-inhibit-regexp "^[A-Z][^: \n\t]+:")
1505 (mm-enable-multibyte)
1506 (make-local-variable 'indent-tabs-mode) ;Turn off tabs for indentation.
1507 (setq indent-tabs-mode nil)
1509 (run-hooks 'text-mode-hook 'message-mode-hook))
1514 ;;; Message mode commands
1517 ;;; Movement commands
1519 (defun message-goto-to ()
1520 "Move point to the To header."
1522 (message-position-on-field "To"))
1524 (defun message-goto-subject ()
1525 "Move point to the Subject header."
1527 (message-position-on-field "Subject"))
1529 (defun message-goto-cc ()
1530 "Move point to the Cc header."
1532 (message-position-on-field "Cc" "To"))
1534 (defun message-goto-bcc ()
1535 "Move point to the Bcc header."
1537 (message-position-on-field "Bcc" "Cc" "To"))
1539 (defun message-goto-fcc ()
1540 "Move point to the Fcc header."
1542 (message-position-on-field "Fcc" "To" "Newsgroups"))
1544 (defun message-goto-reply-to ()
1545 "Move point to the Reply-To header."
1547 (message-position-on-field "Reply-To" "Subject"))
1549 (defun message-goto-newsgroups ()
1550 "Move point to the Newsgroups header."
1552 (message-position-on-field "Newsgroups"))
1554 (defun message-goto-distribution ()
1555 "Move point to the Distribution header."
1557 (message-position-on-field "Distribution"))
1559 (defun message-goto-followup-to ()
1560 "Move point to the Followup-To header."
1562 (message-position-on-field "Followup-To" "Newsgroups"))
1564 (defun message-goto-keywords ()
1565 "Move point to the Keywords header."
1567 (message-position-on-field "Keywords" "Subject"))
1569 (defun message-goto-summary ()
1570 "Move point to the Summary header."
1572 (message-position-on-field "Summary" "Subject"))
1574 (defun message-goto-body ()
1575 "Move point to the beginning of the message body."
1577 (if (looking-at "[ \t]*\n") (expand-abbrev))
1578 (goto-char (point-min))
1579 (or (search-forward (concat "\n" mail-header-separator "\n") nil