message.el 269 KB
Newer Older
1
;;; message.el --- composing mail and news messages
2 3

;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
Glenn Morris's avatar
Glenn Morris committed
4
;;   2005, 2006, 2007 Free Software Foundation, Inc.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
5

6
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
7 8 9 10 11 12
;; Keywords: mail, news

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
13
;; the Free Software Foundation; either version 3, or (at your option)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
14 15 16 17 18 19 20 21 22
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
Lute Kamstra's avatar
Lute Kamstra committed
23 24
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
25 26 27 28 29 30 31 32 33

;;; Commentary:

;; This mode provides mail-sending facilities from within Emacs.  It
;; consists mainly of large chunks of code from the sendmail.el,
;; gnus-msg.el and rnewspost.el files.

;;; Code:

34
(eval-when-compile
Dan Nicolaescu's avatar
Dan Nicolaescu committed
35 36
  (require 'cl))
  
37
(require 'hashcash)
38
(require 'canlock)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
39
(require 'mailheader)
40
(require 'gmm-utils)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
41
(require 'nnheader)
42 43 44
;; This is apparently necessary even though things are autoloaded.
;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better
;; require mailabbrev here.
45
(if (featurep 'xemacs)
46 47
    (require 'mail-abbrevs)
  (require 'mailabbrev))
48 49
(require 'mail-parse)
(require 'mml)
50
(require 'rfc822)
51 52
(require 'ecomplete)

53 54
(autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/

Dan Nicolaescu's avatar
Dan Nicolaescu committed
55 56 57
(defvar gnus-message-group-art)
(defvar gnus-list-identifiers) ; gnus-sum is required where necessary
(defvar rmail-enable-mime-composing)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
58 59 60 61 62 63 64 65 66 67 68 69

(defgroup message '((user-mail-address custom-variable)
		    (user-full-name custom-variable))
  "Mail and news message composing."
  :link '(custom-manual "(message)Top")
  :group 'mail
  :group 'news)

(put 'user-mail-address 'custom-type 'string)
(put 'user-full-name 'custom-type 'string)

(defgroup message-various nil
70
  "Various Message Variables."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
71 72 73 74
  :link '(custom-manual "(message)Various Message Variables")
  :group 'message)

(defgroup message-buffers nil
75
  "Message Buffers."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
76 77 78 79
  :link '(custom-manual "(message)Message Buffers")
  :group 'message)

(defgroup message-sending nil
80
  "Message Sending."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
81 82 83 84
  :link '(custom-manual "(message)Sending Variables")
  :group 'message)

(defgroup message-interface nil
85
  "Message Interface."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
86 87 88 89
  :link '(custom-manual "(message)Interface")
  :group 'message)

(defgroup message-forwarding nil
90
  "Message Forwarding."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
91 92 93 94
  :link '(custom-manual "(message)Forwarding")
  :group 'message-interface)

(defgroup message-insertion nil
95
  "Message Insertion."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
96 97 98 99
  :link '(custom-manual "(message)Insertion")
  :group 'message)

(defgroup message-headers nil
100
  "Message Headers."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
101 102 103 104
  :link '(custom-manual "(message)Message Headers")
  :group 'message)

(defgroup message-news nil
105
  "Composing News Messages."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
106 107 108
  :group 'message)

(defgroup message-mail nil
109
  "Composing Mail Messages."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
  :group 'message)

(defgroup message-faces nil
  "Faces used for message composing."
  :group 'message
  :group 'faces)

(defcustom message-directory "~/Mail/"
  "*Directory from which all other mail file variables are derived."
  :group 'message-various
  :type 'directory)

(defcustom message-max-buffers 10
  "*How many buffers to keep before starting to kill them off."
  :group 'message-buffers
  :type 'integer)

(defcustom message-send-rename-function nil
  "Function called to rename the buffer after sending it."
  :group 'message-buffers
Dave Love's avatar
Dave Love committed
130
  :type '(choice function (const nil)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
131 132 133 134 135 136 137 138 139 140

(defcustom message-fcc-handler-function 'message-output
  "*A function called to save outgoing articles.
This function will be called with the name of the file to store the
article in.  The default function is `message-output' which saves in Unix
mailbox format."
  :type '(radio (function-item message-output)
		(function :tag "Other"))
  :group 'message-sending)

141 142
(defcustom message-fcc-externalize-attachments nil
  "If non-nil, attachments are included as external parts in Fcc copies."
143
  :version "22.1"
144 145 146
  :type 'boolean
  :group 'message-sending)

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
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"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
149 150 151 152 153
  "*This is inserted at the start of a mailed copy of a posted message.
If the string contains the format spec \"%s\", the Newsgroups
the article has been posted to will be inserted there.
If this variable is nil, no such courtesy message will be added."
  :group 'message-sending
154
  :type '(radio string (const nil)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
155

156 157
(defcustom message-ignored-bounced-headers
  "^\\(Received\\|Return-Path\\|Delivered-To\\):"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
158 159 160 161 162 163 164
  "*Regexp that matches headers to be removed in resent bounced mail."
  :group 'message-interface
  :type 'regexp)

(defcustom message-from-style 'default
  "*Specifies how \"From\" headers look.

Dave Love's avatar
Dave Love committed
165
If nil, they contain just the return address like:
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
166 167 168 169 170 171 172 173 174 175 176 177 178 179
	king@grassland.com
If `parens', they look like:
	king@grassland.com (Elvis Parsley)
If `angles', they look like:
	Elvis Parsley <king@grassland.com>

Otherwise, most addresses look like `angles', but they look like
`parens' if `angles' would need quoting and `parens' would not."
  :type '(choice (const :tag "simple" nil)
		 (const parens)
		 (const angles)
		 (const default))
  :group 'message-headers)

180 181
(defcustom message-insert-canlock t
  "Whether to insert a Cancel-Lock header in news postings."
182
  :version "22.1"
183 184 185 186 187
  :group 'message-headers
  :type 'boolean)

(defcustom message-syntax-checks
  (if message-insert-canlock '((sender . disabled)) nil)
188
  ;; Guess this one shouldn't be easy to customize...
189
  "*Controls what syntax checks should not be performed on outgoing posts.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
190 191 192 193 194
To disable checking of long signatures, for instance, add
 `(signature . disabled)' to this list.

Don't touch this variable unless you really know what you're doing.

Miles Bader's avatar
Miles Bader committed
195 196
Checks include `approved', `bogus-recipient', `continuation-headers',
`control-chars', `empty', `existing-newsgroups', `from', `illegible-text',
Miles Bader's avatar
Miles Bader committed
197 198
`invisible-text', `long-header-lines', `long-lines', `message-id',
`multiple-headers', `new-text', `newsgroups', `quoting-style',
Miles Bader's avatar
Miles Bader committed
199
`repeated-newsgroups', `reply-to', `sender', `sendsys', `shoot',
Miles Bader's avatar
Miles Bader committed
200 201
`shorten-followup-to', `signature', `size', `subject', `subject-cmsg'
and `valid-newsgroups'."
202
  :group 'message-news
Dave Love's avatar
Dave Love committed
203
  :type '(repeat sexp))			; Fixme: improve this
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
204

205 206 207 208 209
(defcustom message-required-headers '((optional . References)
				      From)
  "*Headers to be generated or prompted for when sending a message.
Also see `message-required-news-headers' and
`message-required-mail-headers'."
210
  :version "22.1"
211 212 213 214 215
  :group 'message-news
  :group 'message-headers
  :link '(custom-manual "(message)Message Headers")
  :type '(repeat sexp))

216
(defcustom message-draft-headers '(References From Date)
217
  "*Headers to be generated when saving a draft message."
218
  :version "22.1"
219 220 221 222 223
  :group 'message-news
  :group 'message-headers
  :link '(custom-manual "(message)Message Headers")
  :type '(repeat sexp))

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
224 225
(defcustom message-required-news-headers
  '(From Newsgroups Subject Date Message-ID
226
	 (optional . Organization)
227
	 (optional . User-Agent))
228
  "*Headers to be generated or prompted for when posting an article.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
229 230
RFC977 and RFC1036 require From, Date, Newsgroups, Subject,
Message-ID.  Organization, Lines, In-Reply-To, Expires, and
Miles Bader's avatar
Miles Bader committed
231
User-Agent are optional.  If you don't want message to insert some
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
232 233 234
header, remove it from this list."
  :group 'message-news
  :group 'message-headers
235
  :link '(custom-manual "(message)Message Headers")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
236 237 238
  :type '(repeat sexp))

(defcustom message-required-mail-headers
239
  '(From Subject Date (optional . In-Reply-To) Message-ID
240
	 (optional . User-Agent))
241
  "*Headers to be generated or prompted for when mailing a message.
242 243
It is recommended that From, Date, To, Subject and Message-ID be
included.  Organization and User-Agent are optional."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
244 245
  :group 'message-mail
  :group 'message-headers
246
  :link '(custom-manual "(message)Message Headers")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
247 248 249 250 251
  :type '(repeat sexp))

(defcustom message-deletable-headers '(Message-ID Date Lines)
  "Headers to be deleted if they already exist and were generated by message previously."
  :group 'message-headers
252
  :link '(custom-manual "(message)Message Headers")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
253 254 255
  :type 'sexp)

(defcustom message-ignored-news-headers
256
  "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
257 258 259
  "*Regexp of headers to be removed unconditionally before posting."
  :group 'message-news
  :group 'message-headers
260
  :link '(custom-manual "(message)Message Headers")
261 262 263 264 265 266
  :type '(repeat :value-to-internal (lambda (widget value)
				      (custom-split-regexp-maybe value))
		 :match (lambda (widget value)
			  (or (stringp value)
			      (widget-editable-list-match widget value)))
		 regexp))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
267

268 269
(defcustom message-ignored-mail-headers
  "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
270 271 272
  "*Regexp of headers to be removed unconditionally before mailing."
  :group 'message-mail
  :group 'message-headers
273
  :link '(custom-manual "(message)Mail Headers")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
274 275
  :type 'regexp)

276
(defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|^X-Complaints-To:\\|^Cancel-Lock:\\|^Cancel-Key:\\|^X-Hashcash:\\|^X-Payment:\\|^Approved:"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
277 278 279 280
  "*Header lines matching this regexp will be deleted before posting.
It's best to delete old Path and Date headers before posting to avoid
any confusion."
  :group 'message-interface
281
  :link '(custom-manual "(message)Superseding")
282 283 284 285 286 287
  :type '(repeat :value-to-internal (lambda (widget value)
				      (custom-split-regexp-maybe value))
		 :match (lambda (widget value)
			  (or (stringp value)
			      (widget-editable-list-match widget value)))
		 regexp))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
288

289 290
(defcustom message-subject-re-regexp
  "^[ \t]*\\([Rr][Ee]\\(\\[[0-9]*\\]\\)*:[ \t]*\\)*[ \t]*"
291 292
  "*Regexp matching \"Re: \" in the subject line."
  :group 'message-various
293
  :link '(custom-manual "(message)Message Headers")
294 295
  :type 'regexp)

296 297 298 299 300 301 302 303 304 305
;;; Start of variables adopted from `message-utils.el'.

(defcustom message-subject-trailing-was-query 'ask
  "*What to do with trailing \"(was: <old subject>)\" in subject lines.
If nil, leave the subject unchanged.  If it is the symbol `ask', query
the user what do do.  In this case, the subject is matched against
`message-subject-trailing-was-ask-regexp'.  If
`message-subject-trailing-was-query' is t, always strip the trailing
old subject.  In this case, `message-subject-trailing-was-regexp' is
used."
306
  :version "22.1"
307 308
  :type '(choice (const :tag "never" nil)
		 (const :tag "always strip" t)
309
		 (const ask))
310 311 312 313 314 315 316 317 318 319 320 321 322
  :link '(custom-manual "(message)Message Headers")
  :group 'message-various)

(defcustom message-subject-trailing-was-ask-regexp
  "[ \t]*\\([[(]+[Ww][Aa][Ss][ \t]*.*[\])]+\\)"
  "*Regexp matching \"(was: <old subject>)\" in the subject line.

The function `message-strip-subject-trailing-was' uses this regexp if
`message-subject-trailing-was-query' is set to the symbol `ask'.  If
the variable is t instead of `ask', use
`message-subject-trailing-was-regexp' instead.

It is okay to create some false positives here, as the user is asked."
323
  :version "22.1"
324 325 326 327 328 329 330 331 332 333 334 335
  :group 'message-various
  :link '(custom-manual "(message)Message Headers")
  :type 'regexp)

(defcustom message-subject-trailing-was-regexp
  "[ \t]*\\((*[Ww][Aa][Ss]:[ \t]*.*)\\)"
  "*Regexp matching \"(was: <old subject>)\" in the subject line.

If `message-subject-trailing-was-query' is set to t, the subject is
matched against `message-subject-trailing-was-regexp' in
`message-strip-subject-trailing-was'.  You should use a regexp creating very
few false positives here."
336
  :version "22.1"
337 338 339 340 341 342 343
  :group 'message-various
  :link '(custom-manual "(message)Message Headers")
  :type 'regexp)

;;; marking inserted text

(defcustom message-mark-insert-begin
344
  "--8<---------------cut here---------------start------------->8---\n"
345
  "How to mark the beginning of some inserted text."
346
  :version "22.1"
347 348 349 350 351
  :type 'string
  :link '(custom-manual "(message)Insertion Variables")
  :group 'message-various)

(defcustom message-mark-insert-end
352
  "--8<---------------cut here---------------end--------------->8---\n"
353
  "How to mark the end of some inserted text."
354
  :version "22.1"
355 356 357 358
  :type 'string
  :link '(custom-manual "(message)Insertion Variables")
  :group 'message-various)

359
(defcustom message-archive-header "X-No-Archive: Yes\n"
360 361
  "Header to insert when you don't want your article to be archived.
Archives \(such as groups.google.com\) respect this header."
362
  :version "22.1"
363 364 365 366 367 368 369 370
  :type 'string
  :link '(custom-manual "(message)Header Commands")
  :group 'message-various)

(defcustom message-archive-note
  "X-No-Archive: Yes - save http://groups.google.com/"
  "Note to insert why you wouldn't want this posting archived.
If nil, don't insert any text in the body."
371
  :version "22.1"
372
  :type '(radio string (const nil))
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
  :link '(custom-manual "(message)Header Commands")
  :group 'message-various)

;;; Crossposts and Followups
;; inspired by JoH-followup-to by Jochem Huhman <joh  at gmx.de>
;; new suggestions by R. Weikusat <rw at another.de>

(defvar message-cross-post-old-target nil
  "Old target for cross-posts or follow-ups.")
(make-variable-buffer-local 'message-cross-post-old-target)

(defcustom message-cross-post-default t
  "When non-nil `message-cross-post-followup-to' will perform a crosspost.
If nil, `message-cross-post-followup-to' will only do a followup.  Note that
you can explicitly override this setting by calling
`message-cross-post-followup-to' with a prefix."
389
  :version "22.1"
390 391 392
  :type 'boolean
  :group 'message-various)

393
(defcustom message-cross-post-note "Crosspost & Followup-To: "
394
  "Note to insert before signature to notify of cross-post and follow-up."
395
  :version "22.1"
396 397 398
  :type 'string
  :group 'message-various)

399
(defcustom message-followup-to-note "Followup-To: "
400
  "Note to insert before signature to notify of follow-up only."
401
  :version "22.1"
402 403 404
  :type 'string
  :group 'message-various)

405
(defcustom message-cross-post-note-function 'message-cross-post-insert-note
406 407 408 409
  "Function to use to insert note about Crosspost or Followup-To.
The function will be called with four arguments.  The function should not only
insert a note, but also ensure old notes are deleted.  See the documentation
for `message-cross-post-insert-note'."
410
  :version "22.1"
411 412 413 414 415
  :type 'function
  :group 'message-various)

;;; End of variables adopted from `message-utils.el'.

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
416 417 418
(defcustom message-signature-separator "^-- *$"
  "Regexp matching the signature separator."
  :type 'regexp
419
  :link '(custom-manual "(message)Various Message Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
420 421
  :group 'message-various)

422
(defcustom message-elide-ellipsis "\n[...]\n\n"
423 424
  "*The string which is inserted for elided text."
  :type 'string
425
  :link '(custom-manual "(message)Various Commands")
426
  :group 'message-various)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
427

428
(defcustom message-interactive t
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
429 430 431 432
  "Non-nil means when sending a message wait for and display errors.
nil means let mailer mail back a message to report errors."
  :group 'message-sending
  :group 'message-mail
433
  :link '(custom-manual "(message)Sending Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
434 435
  :type 'boolean)

436
(defcustom message-generate-new-buffers 'unique
Miles Bader's avatar
Miles Bader committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
  "*Say whether to create a new message buffer to compose a message.
Valid values include:

nil
  Generate the buffer name in the Message way (e.g., *mail*, *news*,
  *mail to whom*, *news on group*, etc.) and continue editing in the
  existing buffer of that name.  If there is no such buffer, it will
  be newly created.

`unique' or t
  Create the new buffer with the name generated in the Message way.

`unsent'
  Similar to `unique' but the buffer name begins with \"*unsent \".

`standard'
  Similar to nil but the buffer name is simpler like *mail message*.

function
  If this is a function, call that function with three parameters:
  The type, the To address and the group name (any of these may be nil).
  The function should return the new buffer name."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
459
  :group 'message-buffers
460
  :link '(custom-manual "(message)Message Buffers")
Miles Bader's avatar
Miles Bader committed
461 462 463 464 465 466
  :type '(choice (const nil)
		 (sexp :tag "unique" :format "unique\n" :value unique
		       :match (lambda (widget value) (memq value '(unique t))))
		 (const unsent)
		 (const standard)
		 (function :format "\n    %{%t%}: %v")))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
467 468 469 470

(defcustom message-kill-buffer-on-exit nil
  "*Non-nil means that the message buffer will be killed after sending a message."
  :group 'message-buffers
471
  :link '(custom-manual "(message)Message Buffers")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
472 473
  :type 'boolean)

474 475 476 477 478 479 480
(defcustom message-kill-buffer-query t
  "*Non-nil means that killing a modified message buffer has to be confirmed.
This is used by `message-kill-buffer'."
  :version "23.0" ;; No Gnus
  :group 'message-buffers
  :type 'boolean)

Dan Nicolaescu's avatar
Dan Nicolaescu committed
481
(defvar gnus-local-organization)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
482 483 484 485 486 487 488 489 490 491 492 493
(defcustom message-user-organization
  (or (and (boundp 'gnus-local-organization)
	   (stringp gnus-local-organization)
	   gnus-local-organization)
      (getenv "ORGANIZATION")
      t)
  "*String to be used as an Organization header.
If t, use `message-user-organization-file'."
  :group 'message-headers
  :type '(choice string
		 (const :tag "consult file" t)))

494 495 496 497 498 499 500 501
(defcustom message-user-organization-file
  (let (orgfile)
    (dolist (f (list "/etc/organization"
		     "/etc/news/organization"
		     "/usr/lib/news/organization"))
      (when (file-readable-p f)
	(setq orgfile f)))
    orgfile)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
502 503
  "*Local news organization file."
  :type 'file
504
  :link '(custom-manual "(message)News Headers")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
505 506
  :group 'message-headers)

507
(defcustom message-make-forward-subject-function
508
  #'message-forward-subject-name-subject
Dave Love's avatar
Dave Love committed
509
  "*List of functions called to generate subject headers for forwarded messages.
510 511 512 513 514
The subject generated by the previous function is passed into each
successive function.

The provided functions are:

515 516 517 518 519
* `message-forward-subject-author-subject' Source of article (author or
      newsgroup), in brackets followed by the subject
* `message-forward-subject-name-subject' Source of article (name of author
      or newsgroup), in brackets followed by the subject
* `message-forward-subject-fwd' Subject of article with 'Fwd:' prepended
520
      to it."
521
  :group 'message-forwarding
522
  :link '(custom-manual "(message)Forwarding")
523
  :type '(radio (function-item message-forward-subject-author-subject)
Dave Love's avatar
Dave Love committed
524
		(function-item message-forward-subject-fwd)
525
		(function-item message-forward-subject-name-subject)
Dave Love's avatar
Dave Love committed
526
		(repeat :tag "List of functions" function)))
527 528

(defcustom message-forward-as-mime t
529 530
  "*Non-nil means forward messages as an inline/rfc822 MIME section.
Otherwise, directly inline the old message in the forwarded message."
531
  :version "21.1"
532
  :group 'message-forwarding
533
  :link '(custom-manual "(message)Forwarding")
534 535
  :type 'boolean)

536 537 538 539 540 541 542 543
(defcustom message-forward-show-mml 'best
  "*Non-nil means show forwarded messages as MML (decoded from MIME).
Otherwise, forwarded messages are unchanged.
Can also be the symbol `best' to indicate that MML should be
used, except when it is a bad idea to use MML.  One example where
it is a bad idea is when forwarding a signed or encrypted
message, because converting MIME to MML would invalidate the
digital signature."
544
  :version "21.1"
545
  :group 'message-forwarding
546 547 548
  :type '(choice (const :tag "use MML" t)
		 (const :tag "don't use MML " nil)
		 (const :tag "use MML when appropriate" best)))
549 550

(defcustom message-forward-before-signature t
551
  "*Non-nil means put forwarded message before signature, else after."
552 553
  :group 'message-forwarding
  :type 'boolean)
554 555

(defcustom message-wash-forwarded-subjects nil
556 557
  "*Non-nil means try to remove as much cruft as possible from the subject.
Done before generating the new subject of a forward."
558
  :group 'message-forwarding
559
  :link '(custom-manual "(message)Forwarding")
560 561
  :type 'boolean)

562
(defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From "
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
563 564
  "*All headers that match this regexp will be deleted when resending a message."
  :group 'message-interface
565
  :link '(custom-manual "(message)Resending")
566 567 568 569 570 571
  :type '(repeat :value-to-internal (lambda (widget value)
				      (custom-split-regexp-maybe value))
		 :match (lambda (widget value)
			  (or (stringp value)
			      (widget-editable-list-match widget value)))
		 regexp))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
572

573 574
(defcustom message-forward-ignored-headers "^Content-Transfer-Encoding:\\|^X-Gnus"
  "*All headers that match this regexp will be deleted when forwarding a message."
575
  :version "21.1"
576
  :group 'message-forwarding
577 578 579 580 581
  :type '(repeat :value-to-internal (lambda (widget value)
				      (custom-split-regexp-maybe value))
		 :match (lambda (widget value)
			  (or (stringp value)
			      (widget-editable-list-match widget value)))
582 583
		 regexp))

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
584 585 586
(defcustom message-ignored-cited-headers "."
  "*Delete these headers from the messages you yank."
  :group 'message-insertion
587 588 589 590 591 592 593
  :link '(custom-manual "(message)Insertion Variables")
  :type 'regexp)

(defcustom message-cite-prefix-regexp
  (if (string-match "[[:digit:]]" "1") ;; support POSIX?
      "\\([ \t]*[-_.[:word:]]+>+\\|[ \t]*[]>|}+]\\)+"
    ;; ?-, ?_ or ?. MUST NOT be in syntax entry w.
594 595 596 597 598 599 600
    (let (non-word-constituents)
      (with-syntax-table text-mode-syntax-table
	(setq non-word-constituents
	      (concat
	       (if (string-match "\\w" "-")  "" "-")
	       (if (string-match "\\w" "_")  "" "_")
	       (if (string-match "\\w" ".")  "" "."))))
601 602 603 604 605 606
      (if (equal non-word-constituents "")
	  "\\([ \t]*\\(\\w\\)+>+\\|[ \t]*[]>|}+]\\)+"
	(concat "\\([ \t]*\\(\\w\\|["
		non-word-constituents
		"]\\)+>+\\|[ \t]*[]>|}+]\\)+"))))
  "*Regexp matching the longest possible citation prefix on a line."
607
  :version "22.1"
608 609
  :group 'message-insertion
  :link '(custom-manual "(message)Insertion Variables")
610 611 612 613 614 615 616
  :type 'regexp
  :set (lambda (symbol value)
	 (prog1
	     (custom-set-default symbol value)
	   (if (boundp 'gnus-message-cite-prefix-regexp)
	       (setq gnus-message-cite-prefix-regexp
		     (concat "^\\(?:" value "\\)"))))))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
617

618
(defcustom message-cancel-message "I am canceling my own article.\n"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
619 620
  "Message to be inserted in the cancel message."
  :group 'message-interface
621
  :link '(custom-manual "(message)Canceling News")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
622 623
  :type 'string)

624 625
(defvar smtpmail-default-smtp-server)

626 627
(defun message-send-mail-function ()
  "Return suitable value for the variable `message-send-mail-function'."
628 629 630
  (cond ((and (require 'sendmail)
	      (boundp 'sendmail-program)
	      sendmail-program
631
	      (executable-find sendmail-program))
632
	 'message-send-mail-with-sendmail)
633 634 635 636 637
	((and (locate-library "smtpmail")
	      (require 'smtpmail)
	      smtpmail-default-smtp-server)
	 'message-smtpmail-send-it)
	((locate-library "mailclient")
638 639
	 'message-send-mail-with-mailclient)
	(t
640
	 (lambda ()
641
	   (error "Don't know how to send mail.  Please customize `message-send-mail-function'")))))
642

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
643
;; Useful to set in site-init.el
644
(defcustom message-send-mail-function (message-send-mail-function)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
645 646 647 648
  "Function to call to send the current buffer as mail.
The headers should be delimited by a line whose contents match the
variable `mail-header-separator'.

649
Valid values include `message-send-mail-with-sendmail'
Dave Love's avatar
Dave Love committed
650
`message-send-mail-with-mh', `message-send-mail-with-qmail',
651 652 653
`message-smtpmail-send-it', `smtpmail-send-it',
`feedmail-send-it' and `message-send-mail-with-mailclient'.  The
default is system dependent.
Dave Love's avatar
Dave Love committed
654 655

See also `send-mail-function'."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
656 657 658
  :type '(radio (function-item message-send-mail-with-sendmail)
		(function-item message-send-mail-with-mh)
		(function-item message-send-mail-with-qmail)
659
		(function-item message-smtpmail-send-it)
660
		(function-item smtpmail-send-it)
Dave Love's avatar
Dave Love committed
661
		(function-item feedmail-send-it)
662 663 664 665
		(function :tag "Other")
		(function-item message-send-mail-with-mailclient
			       :tag "Use Mailclient package")
 		(function :tag "Other"))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
666
  :group 'message-sending
667
  :initialize 'custom-initialize-default
668
  :link '(custom-manual "(message)Mail Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
669 670 671 672 673 674 675 676
  :group 'message-mail)

(defcustom message-send-news-function 'message-send-news
  "Function to call to send the current buffer as news.
The headers should be delimited by a line whose contents match the
variable `mail-header-separator'."
  :group 'message-sending
  :group 'message-news
677
  :link '(custom-manual "(message)News Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
678 679 680
  :type 'function)

(defcustom message-reply-to-function nil
Dave Love's avatar
Dave Love committed
681
  "If non-nil, function that should return a list of headers.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
682 683 684
This function should pick out addresses from the To, Cc, and From headers
and respond with new To and Cc headers."
  :group 'message-interface
685
  :link '(custom-manual "(message)Reply")
Dave Love's avatar
Dave Love committed
686
  :type '(choice function (const nil)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
687 688

(defcustom message-wide-reply-to-function nil
Dave Love's avatar
Dave Love committed
689
  "If non-nil, function that should return a list of headers.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
690 691 692
This function should pick out addresses from the To, Cc, and From headers
and respond with new To and Cc headers."
  :group 'message-interface
693
  :link '(custom-manual "(message)Wide Reply")
Dave Love's avatar
Dave Love committed
694
  :type '(choice function (const nil)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
695 696

(defcustom message-followup-to-function nil
Dave Love's avatar
Dave Love committed
697
  "If non-nil, function that should return a list of headers.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
698 699 700
This function should pick out addresses from the To, Cc, and From headers
and respond with new To and Cc headers."
  :group 'message-interface
701
  :link '(custom-manual "(message)Followup")
Dave Love's avatar
Dave Love committed
702
  :type '(choice function (const nil)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
703

704 705 706 707 708 709
(defcustom message-extra-wide-headers nil
  "If non-nil, a list of additional address headers.
These are used when composing a wide reply."
  :group 'message-sending
  :type '(repeat string))

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
710 711 712 713 714 715 716
(defcustom message-use-followup-to 'ask
  "*Specifies what to do with Followup-To header.
If nil, always ignore the header.  If it is t, use its value, but
query before using the \"poster\" value.  If it is the symbol `ask',
always query the user whether to use the value.  If it is the symbol
`use', always use the value."
  :group 'message-interface
717
  :link '(custom-manual "(message)Followup")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
718
  :type '(choice (const :tag "ignore" nil)
719
		 (const :tag "use & query" t)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
720 721 722
		 (const use)
		 (const ask)))

723 724 725 726 727
(defcustom message-use-mail-followup-to 'use
  "*Specifies what to do with Mail-Followup-To header.
If nil, always ignore the header.  If it is the symbol `ask', always
query the user whether to use the value.  If it is the symbol `use',
always use the value."
728
  :version "22.1"
729 730 731 732 733 734 735 736 737 738 739 740 741
  :group 'message-interface
  :link '(custom-manual "(message)Mailing Lists")
  :type '(choice (const :tag "ignore" nil)
		 (const use)
		 (const ask)))

(defcustom message-subscribed-address-functions nil
  "*Specifies functions for determining list subscription.
If nil, do not attempt to determine list subscription with functions.
If non-nil, this variable contains a list of functions which return
regular expressions to match lists.  These functions can be used in
conjunction with `message-subscribed-regexps' and
`message-subscribed-addresses'."
742
  :version "22.1"
743 744 745 746 747 748 749 750
  :group 'message-interface
  :link '(custom-manual "(message)Mailing Lists")
  :type '(repeat sexp))

(defcustom message-subscribed-address-file nil
  "*A file containing addresses the user is subscribed to.
If nil, do not look at any files to determine list subscriptions.  If
non-nil, each line of this file should be a mailing list address."
751
  :version "22.1"
752 753
  :group 'message-interface
  :link '(custom-manual "(message)Mailing Lists")
754
  :type '(radio file (const nil)))
755 756 757 758 759 760

(defcustom message-subscribed-addresses nil
  "*Specifies a list of addresses the user is subscribed to.
If nil, do not use any predefined list subscriptions.  This list of
addresses can be used in conjunction with
`message-subscribed-address-functions' and `message-subscribed-regexps'."
761
  :version "22.1"
762 763 764 765 766 767 768 769 770
  :group 'message-interface
  :link '(custom-manual "(message)Mailing Lists")
  :type '(repeat string))

(defcustom message-subscribed-regexps nil
  "*Specifies a list of addresses the user is subscribed to.
If nil, do not use any predefined list subscriptions.  This list of
regular expressions can be used in conjunction with
`message-subscribed-address-functions' and `message-subscribed-addresses'."
771
  :version "22.1"
772 773 774 775 776 777 778 779 780
  :group 'message-interface
  :link '(custom-manual "(message)Mailing Lists")
  :type '(repeat regexp))

(defcustom message-allow-no-recipients 'ask
  "Specifies what to do when there are no recipients other than Gcc/Fcc.
If it is the symbol `always', the posting is allowed.  If it is the
symbol `never', the posting is not allowed.  If it is the symbol
`ask', you are prompted."
781
  :version "22.1"
782 783 784 785 786 787
  :group 'message-interface
  :link '(custom-manual "(message)Message Headers")
  :type '(choice (const always)
		 (const never)
		 (const ask)))

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
788
(defcustom message-sendmail-f-is-evil nil
Dave Love's avatar
Dave Love committed
789
  "*Non-nil means don't add \"-f username\" to the sendmail command line.
790
Doing so would be even more evil than leaving it out."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
791
  :group 'message-sending
792
  :link '(custom-manual "(message)Mail Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
793 794
  :type 'boolean)

795 796 797 798
(defcustom message-sendmail-envelope-from nil
  "*Envelope-from when sending mail with sendmail.
If this is nil, use `user-mail-address'.  If it is the symbol
`header', use the From: header of the message."
799
  :version "22.1"
800 801 802 803 804 805
  :type '(choice (string :tag "From name")
		 (const :tag "Use From: header from message" header)
		 (const :tag "Use `user-mail-address'" nil))
  :link '(custom-manual "(message)Mail Variables")
  :group 'message-sending)

806 807 808 809 810 811 812 813
(defcustom message-sendmail-extra-arguments nil
  "Additional arguments to `sendmail-program'."
  ;; E.g. '("-a" "account") for msmtp
  :version "23.0" ;; No Gnus
  :type '(repeat string)
  ;; :link '(custom-manual "(message)Mail Variables")
  :group 'message-sending)

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
814 815 816 817
;; qmail-related stuff
(defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
  "Location of the qmail-inject program."
  :group 'message-sending
818
  :link '(custom-manual "(message)Mail Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
819 820 821 822
  :type 'file)

(defcustom message-qmail-inject-args nil
  "Arguments passed to qmail-inject programs.
823 824
This should be a list of strings, one string for each argument.  It
may also be a function.
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
825 826 827 828 829

For e.g., if you wish to set the envelope sender address so that bounces
go to the right place or to deal with listserv's usage of that address, you
might set this variable to '(\"-f\" \"you@some.where\")."
  :group 'message-sending
830 831 832
  :link '(custom-manual "(message)Mail Variables")
  :type '(choice (function)
		 (repeat string)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
833

Dan Nicolaescu's avatar
Dan Nicolaescu committed
834 835
(defvar gnus-post-method)
(defvar gnus-select-method)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
836 837
(defcustom message-post-method
  (cond ((and (boundp 'gnus-post-method)
838
	      (listp gnus-post-method)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
839 840 841 842 843
	      gnus-post-method)
	 gnus-post-method)
	((boundp 'gnus-select-method)
	 gnus-select-method)
	(t '(nnspool "")))
844 845 846
  "*Method used to post news.
Note that when posting from inside Gnus, for instance, this
variable isn't used."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
847 848 849 850 851 852
  :group 'message-news
  :group 'message-sending
  ;; This should be the `gnus-select-method' widget, but that might
  ;; create a dependence to `gnus.el'.
  :type 'sexp)

853 854 855 856 857 858
;; FIXME: This should be a temporary workaround until someone implements a
;; proper solution.  If a crash happens while replying, the auto-save file
;; will *not* have a `References:' header if `message-generate-headers-first'
;; is nil.  See: http://article.gmane.org/gmane.emacs.gnus.general/51138
(defcustom message-generate-headers-first '(references)
  "Which headers should be generated before starting to compose a message.
859
If t, generate all required headers.  This can also be a list of headers to
860 861 862 863 864 865
generate.  The variables `message-required-news-headers' and
`message-required-mail-headers' specify which headers to generate.

Note that the variable `message-deletable-headers' specifies headers which
are to be deleted and then re-generated before sending, so this variable
will not have a visible effect for those headers."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
866
  :group 'message-headers
867 868
  :link '(custom-manual "(message)Message Headers")
  :type '(choice (const :tag "None" nil)
869 870 871 872 873 874 875 876 877 878 879 880
		 (const :tag "References" '(references))
		 (const :tag "All" t)
		 (repeat (sexp :tag "Header"))))

(defcustom message-fill-column 72
  "Column beyond which automatic line-wrapping should happen.
Local value for message buffers.  If non-nil, also turn on
auto-fill in message buffers."
  :group 'message-various
  ;; :link '(custom-manual "(message)Message Headers")
  :type '(choice (const :tag "Don't turn on auto fill" nil)
		 (integer)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
881 882 883 884 885

(defcustom message-setup-hook nil
  "Normal hook, run each time a new outgoing message is initialized.
The function `message-setup' runs this hook."
  :group 'message-various
886
  :link '(custom-manual "(message)Various Message Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
887 888
  :type 'hook)

889 890 891
(defcustom message-cancel-hook nil
  "Hook run when cancelling articles."
  :group 'message-various
892
  :link '(custom-manual "(message)Various Message Variables")
893 894
  :type 'hook)

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
895 896 897 898 899
(defcustom message-signature-setup-hook nil
  "Normal hook, run each time a new outgoing message is initialized.
It is run after the headers have been inserted and before
the signature is inserted."
  :group 'message-various
900
  :link '(custom-manual "(message)Various Message Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
901 902 903 904 905 906 907 908 909 910 911 912 913
  :type 'hook)

(defcustom message-mode-hook nil
  "Hook run in message mode buffers."
  :group 'message-various
  :type 'hook)

(defcustom message-header-hook nil
  "Hook run in a message mode buffer narrowed to the headers."
  :group 'message-various
  :type 'hook)

(defcustom message-header-setup-hook nil
914
  "Hook called narrowed to the headers when setting up a message buffer."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
915
  :group 'message-various
916
  :link '(custom-manual "(message)Various Message Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
917 918
  :type 'hook)

919 920 921 922
(defcustom message-minibuffer-local-map
  (let ((map (make-sparse-keymap 'message-minibuffer-local-map)))
    (set-keymap-parent map minibuffer-local-map)
    map)
923
  "Keymap for `message-read-from-minibuffer'."
924 925
  :version "22.1"
  :group 'message-various)
926

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
927
(defcustom message-citation-line-function 'message-insert-citation-line
928 929
  "*Function called to insert the \"Whomever writes:\" line.

930
Predefined functions include `message-insert-citation-line' and
Miles Bader's avatar
Miles Bader committed
931
`message-insert-formatted-citation-line' (see the variable
932 933
`message-citation-line-format').

934 935 936 937
Note that Gnus provides a feature where the reader can click on
`writes:' to hide the cited text.  If you change this line too much,
people who read your message will have to change their Gnus
configuration.  See the variable `gnus-cite-attribution-suffix'."
938 939
  :type '(choice
	  (function-item :tag "plain" message-insert-citation-line)
Miles Bader's avatar
Miles Bader committed
940
	  (function-item :tag "formatted" message-insert-formatted-citation-line)
941
	  (function :tag "Other"))
942
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
943 944
  :group 'message-insertion)

945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
(defcustom message-citation-line-format "On %a, %b %d %Y, %N wrote:\n"
  "Format of the \"Whomever writes:\" line.

The string is formatted using `format-spec'.  The following
constructs are replaced:

  %f   The full From, e.g. \"John Doe <john.doe@example.invalid>\".
  %n   The mail address, e.g. \"john.doe@example.invalid\".
  %N   The real name if present, e.g.: \"John Doe\", else fall
       back to the mail address.
  %F   The first name if present, e.g.: \"John\".
  %L   The last name if present, e.g.: \"Doe\".

All other format specifiers are passed to `format-time-string'
which is called using the date from the article your replying to.
Extracting the first (%F) and last name (%L) is done
heuristically, so you should always check it yourself.

Please also read the note in the documentation of
`message-citation-line-function'."
  :type '(choice (const :tag "Plain" "%f writes:")
		 (const :tag "Include date" "On %a, %b %d %Y, %n wrote:")
		 string)
  :link '(custom-manual "(message)Insertion Variables")
  :version "23.0" ;; No Gnus
  :group 'message-insertion)

Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
972
(defcustom message-yank-prefix "> "
973 974
  "*Prefix inserted on the lines of yanked messages.
Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
975
See also `message-yank-cited-prefix' and `message-yank-empty-prefix'."
976 977 978 979 980
  :type 'string
  :link '(custom-manual "(message)Insertion Variables")
  :group 'message-insertion)

(defcustom message-yank-cited-prefix ">"
981
  "*Prefix inserted on cited lines of yanked messages.
982
Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
983 984 985 986 987 988 989 990 991
See also `message-yank-prefix' and `message-yank-empty-prefix'."
  :version "22.1"
  :type 'string
  :link '(custom-manual "(message)Insertion Variables")
  :group 'message-insertion)

(defcustom message-yank-empty-prefix ">"
  "*Prefix inserted on empty lines of yanked messages.
See also `message-yank-prefix' and `message-yank-cited-prefix'."
992
  :version "22.1"
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
993
  :type 'string
994
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
995 996 997 998 999 1000
  :group 'message-insertion)

(defcustom message-indentation-spaces 3
  "*Number of spaces to insert at the beginning of each cited line.
Used by `message-yank-original' via `message-yank-cite'."
  :group 'message-insertion
1001
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1002 1003
  :type 'integer)

1004
(defcustom message-cite-function 'message-cite-original
1005 1006 1007
  "*Function for citing an original message.
Predefined functions include `message-cite-original' and
`message-cite-original-without-signature'.
1008
Note that these functions use `mail-citation-hook' if that is non-nil."
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1009
  :type '(radio (function-item message-cite-original)
1010
		(function-item message-cite-original-without-signature)
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1011 1012
		(function-item sc-cite-original)
		(function :tag "Other"))
1013
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1014 1015 1016 1017 1018 1019 1020 1021
  :group 'message-insertion)

(defcustom message-indent-citation-function 'message-indent-citation
  "*Function for modifying a citation just inserted in the mail buffer.
This can also be a list of functions.  Each function can find the
citation between (point) and (mark t).  And each function should leave
point and mark around the citation text as modified."
  :type 'function
1022
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1023 1024 1025 1026 1027 1028 1029 1030
  :group 'message-insertion)

(defcustom message-signature t
  "*String to be inserted at the end of the message buffer.
If t, the `message-signature-file' file will be inserted instead.
If a function, the result from the function will be used instead.
If a form, the result from the form will be used instead."
  :type 'sexp
1031
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1032 1033 1034
  :group 'message-insertion)

(defcustom message-signature-file "~/.signature"
1035 1036
  "*Name of file containing the text inserted at end of message buffer.
Ignored if the named file doesn't exist.
1037 1038 1039
If nil, don't insert a signature.
If a path is specified, the value of `message-signature-directory' is ignored,
even if set."
1040
  :type '(choice file (const :tags "None" nil))
1041 1042 1043
  :link '(custom-manual "(message)Insertion Variables")
  :group 'message-insertion)

1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
(defcustom message-signature-directory nil
  "*Name of directory containing signature files.
Comes in handy if you have many such files, handled via posting styles for
instance.
If nil, `message-signature-file' is expected to specify the directory if
needed."
  :type '(choice string (const :tags "None" nil))
  :link '(custom-manual "(message)Insertion Variables")
  :group 'message-insertion)

1054 1055
(defcustom message-signature-insert-empty-line t
  "*If non-nil, insert an empty line before the signature separator."
1056
  :version "22.1"
1057 1058
  :type 'boolean
  :link '(custom-manual "(message)Insertion Variables")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1059 1060 1061 1062 1063 1064
  :group 'message-insertion)

(defcustom message-distribution-function nil
  "*Function called to return a Distribution header."
  :group 'message-news
  :group 'message-headers
1065
  :link '(custom-manual "(message)News Headers")
Dave Love's avatar
Dave Love committed
1066
  :type '(choice function (const nil)))
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085

(defcustom message-expires 14
  "Number of days before your article expires."
  :group 'message-news
  :group 'message-headers
  :link '(custom-manual "(message)News Headers")
  :type 'integer)

(defcustom message-user-path nil
  "If nil, use the NNTP server name in the Path header.
If stringp, use this; if non-nil, use no host name (user name only)."
  :group 'message-news
  :group 'message-headers
  :link '(custom-manual "(message)News Headers")
  :type '(choice (const :tag "nntp" nil)
		 (string :tag "name")
		 (sexp :tag "none" :format "%t" t)))

(defvar message-reply-buffer nil)
1086 1087 1088 1089
(defvar message-reply-headers nil
  "The headers of the current replied article.
It is a vector of the following headers:
\[number subject from date id references chars lines xref extra].")
Lars Magne Ingebrigtsen's avatar
Lars Magne Ingebrigtsen committed
1090 1091 1092 1093 1094 1095