* mh-alias.el (mh-alias-gecos-name): Use replace-regexp-in-string
[bpt/emacs.git] / lisp / mh-e / mh-customize.el
CommitLineData
c3d9274a
BW
1;;; mh-customize.el --- MH-E customization
2
af435184 3;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
c3d9274a
BW
4
5;; Author: Bill Wohler <wohler@newt.com>
6;; Maintainer: Bill Wohler <wohler@newt.com>
7;; Keywords: mail
8;; See: mh-e.el
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
3a35cf56
LK
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
c3d9274a
BW
26
27;;; Commentary:
28
924df208
BW
29;; All of the defgroups, defcustoms, and deffaces in MH-E are found
30;; here. This makes it possible to customize modules that aren't loaded
31;; yet. It also makes it easier to organize the customization groups.
c3d9274a
BW
32
33;; This file contains the following sections:
34;;
35;; 1. MH-E Customization Groups
36;;
f0d73c14
BW
37;; These are the customization group definitions. Every group has a
38;; associated manual node. The ordering is alphabetical, except for the
39;; groups mh-faces and mh-hooks which are last .
c3d9274a
BW
40;;
41;; 2. MH-E Customization
42;;
f0d73c14
BW
43;; These are the actual customization variables. There is a sub-section for
44;; each group in the MH-E Customization Groups section, in the same order,
45;; separated by page breaks. Within each section, variables are sorted
46;; alphabetically.
c3d9274a 47;;
f0d73c14
BW
48;; 3. Hooks
49;;
50;; All hooks must be placed in the mh-hook group; in addition, add the
51;; group associated with the manual node in which the hook is described.
52;; Since the mh-hook group appears near the end of this file, the hooks
53;; will appear at the end of these other groups.
54;;
55;; 4. Faces
56;;
3af622d5
BW
57;; All faces must be placed in the mh-faces group; in addition, add the
58;; group associated with the manual node in which the face is described.
59;; Since the mh-faces group appears near the end of this file, the faces
60;; will appear at the end of these other groups.
c3d9274a 61;;
c3d9274a
BW
62;;; Change Log:
63
c3d9274a 64;;; Code:
f0d73c14 65
3d7ca223 66(provide 'mh-customize)
f0d73c14
BW
67
68(eval-when-compile (require 'mh-acros))
69(mh-require-cl)
f0d73c14 70
f0d73c14
BW
71(eval-and-compile
72 (defvar mh-xemacs-flag (featurep 'xemacs)
7094eefe
BW
73 "Non-nil means the current Emacs is XEmacs.")
74 (when mh-xemacs-flag
75 (require 'mh-xemacs)))
a66894d8 76
7094eefe
BW
77(eval-and-compile
78 (require 'mh-identity)
eccf9613 79 (require 'mh-init)
7094eefe 80 (require 'mh-loaddefs))
eccf9613 81
cee9f5c6
BW
82;; For compiler warnings...
83(eval-when-compile
84 (defvar mh-show-buffer)
85 (defvar mh-show-folder-buffer))
86
3d7ca223
BW
87(defun mh-customize (&optional delete-other-windows-flag)
88 "Customize MH-E variables.
2dcf34f9
BW
89If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other
90windows in the frame are removed."
3d7ca223 91 (interactive "P")
a05fcb7d 92 (customize-group 'mh-e)
3d7ca223
BW
93 (when delete-other-windows-flag
94 (delete-other-windows)))
c3d9274a 95
f0d73c14
BW
96\f
97
c3d9274a
BW
98;;; MH-E Customization Groups
99
e495eaec 100(defgroup mh-e nil
f0d73c14 101 "Emacs interface to the MH mail system.
2dcf34f9
BW
102MH is the Rand Mail Handler. Other implementations include nmh
103and GNU mailutils."
c3d9274a
BW
104 :link '(custom-manual "(mh-e)Top")
105 :group 'mail)
106
f0d73c14
BW
107(defgroup mh-alias nil
108 "Aliases."
109 :link '(custom-manual "(mh-e)Aliases")
110 :prefix "mh-alias-"
e495eaec 111 :group 'mh-e)
c3d9274a 112
f0d73c14
BW
113(defgroup mh-folder nil
114 "Organizing your mail with folders."
c3d9274a 115 :prefix "mh-"
553fb735 116 :link '(custom-manual "(mh-e)Folders")
e495eaec 117 :group 'mh-e)
c3d9274a 118
f0d73c14
BW
119(defgroup mh-folder-selection nil
120 "Folder selection."
c3d9274a 121 :prefix "mh-"
f0d73c14 122 :link '(custom-manual "(mh-e)Folder Selection")
e495eaec 123 :group 'mh-e)
f0d73c14
BW
124
125(defgroup mh-identity nil
126 "Identities."
127 :link '(custom-manual "(mh-e)Identities")
128 :prefix "mh-identity-"
e495eaec 129 :group 'mh-e)
f0d73c14
BW
130
131(defgroup mh-inc nil
132 "Incorporating your mail."
133 :prefix "mh-inc-"
134 :link '(custom-manual "(mh-e)Incorporating Mail")
e495eaec 135 :group 'mh-e)
c3d9274a 136
924df208 137(defgroup mh-index nil
f0d73c14
BW
138 "Searching."
139 :link '(custom-manual "(mh-e)Searching")
140 :prefix "mh-index-"
e495eaec 141 :group 'mh-e)
924df208
BW
142
143(defgroup mh-junk nil
f0d73c14
BW
144 "Dealing with junk mail."
145 :link '(custom-manual "(mh-e)Junk")
924df208 146 :prefix "mh-junk-"
e495eaec 147 :group 'mh-e)
924df208 148
f0d73c14
BW
149(defgroup mh-letter nil
150 "Editing a draft."
c3d9274a 151 :prefix "mh-"
f0d73c14 152 :link '(custom-manual "(mh-e)Editing Drafts")
e495eaec 153 :group 'mh-e)
c3d9274a 154
f0d73c14
BW
155(defgroup mh-ranges nil
156 "Ranges."
924df208 157 :prefix "mh-"
f0d73c14 158 :link '(custom-manual "(mh-e)Ranges")
e495eaec 159 :group 'mh-e)
924df208 160
f0d73c14
BW
161(defgroup mh-scan-line-formats nil
162 "Scan line formats."
163 :link '(custom-manual "(mh-e)Scan Line Formats")
c3d9274a 164 :prefix "mh-"
e495eaec 165 :group 'mh-e)
c3d9274a 166
f0d73c14
BW
167(defgroup mh-sending-mail nil
168 "Sending mail."
169 :prefix "mh-"
170 :link '(custom-manual "(mh-e)Sending Mail")
e495eaec 171 :group 'mh-e)
c3d9274a 172
f0d73c14
BW
173(defgroup mh-sequences nil
174 "Sequences."
175 :prefix "mh-"
176 :link '(custom-manual "(mh-e)Sequences")
e495eaec 177 :group 'mh-e)
f0d73c14
BW
178
179(defgroup mh-show nil
180 "Reading your mail."
181 :prefix "mh-"
182 :link '(custom-manual "(mh-e)Reading Mail")
e495eaec 183 :group 'mh-e)
f0d73c14 184
553fb735 185(defgroup mh-speedbar nil
f0d73c14
BW
186 "The speedbar."
187 :prefix "mh-speed-"
188 :link '(custom-manual "(mh-e)Speedbar")
e495eaec 189 :group 'mh-e)
f0d73c14 190
553fb735
BW
191(defgroup mh-thread nil
192 "Threading."
193 :prefix "mh-thread-"
194 :link '(custom-manual "(mh-e)Threading")
195 :group 'mh-e)
196
fa4075e3
BW
197(defgroup mh-tool-bar nil
198 "The tool bar"
199 :link '(custom-manual "(mh-e)Tool Bar")
f0d73c14 200 :prefix "mh-"
e495eaec 201 :group 'mh-e)
f0d73c14 202
c3d9274a
BW
203(defgroup mh-hooks nil
204 "MH-E hooks."
f0d73c14 205 :link '(custom-manual "(mh-e)Top")
c3d9274a 206 :prefix "mh-"
e495eaec 207 :group 'mh-e)
c3d9274a 208
d49ed7d4
BW
209(defgroup mh-faces nil
210 "Faces used in MH-E."
211 :link '(custom-manual "(mh-e)Top")
c3d9274a 212 :prefix "mh-"
d49ed7d4
BW
213 :group 'faces
214 :group 'mh-e)
c3d9274a
BW
215
216\f
217
553fb735 218;;; Emacs interface to the MH mail system (:group mh-e)
f0d73c14
BW
219(eval-when (compile)
220 (setq mh-variant 'none))
221
97c688ed
BW
222(defcustom mh-path nil
223 "*Additional list of directories to search for MH.
224See `mh-variant'."
225 :group 'mh-e
226 :type '(repeat (directory)))
227
f0d73c14
BW
228(defcustom mh-variant 'autodetect
229 "*Specifies the variant used by MH-E.
230
5a4aad03 231The default setting of this option is \"Auto-detect\" which means
2dcf34f9
BW
232that MH-E will automatically choose the first of nmh, MH, or GNU
233mailutils that it finds in the directories listed in
234`mh-path' (which you can customize), `mh-sys-path', and
235`exec-path'. If, for example, you have both nmh and mailutils
236installed and `mh-variant-in-use' was initialized to nmh but you
237want to use mailutils, then you can set this option to
5a4aad03 238\"mailutils\".
f0d73c14
BW
239
240When this variable is changed, MH-E resets `mh-progs', `mh-lib',
241`mh-lib-progs', `mh-flists-present-flag', and `mh-variant-in-use'
242accordingly."
243 :type `(radio
244 (const :tag "Auto-detect" autodetect)
245 ,@(mapcar (lambda (x) `(const ,(car x))) (mh-variants)))
246 :set (lambda (symbol value)
247 (set-default symbol value) ;Done in mh-variant-set-variant!
248 (mh-variant-set value))
e495eaec 249 :group 'mh-e)
c3d9274a 250
f0d73c14 251\f
c3d9274a 252
f0d73c14 253;;; Aliases (:group 'mh-alias)
c3d9274a 254
f0d73c14
BW
255(defcustom mh-alias-completion-ignore-case-flag t
256 "*Non-nil means don't consider case significant in MH alias completion.
2dcf34f9
BW
257
258As MH ignores case in the aliases, so too does MH-E. However, you
af435184 259may turn off this option to make case significant which can be
2dcf34f9
BW
260used to segregate completion of your aliases. You might use
261lowercase for mailing lists and uppercase for people."
f0d73c14
BW
262 :type 'boolean
263 :group 'mh-alias)
924df208 264
f0d73c14
BW
265(defcustom mh-alias-expand-aliases-flag nil
266 "*Non-nil means to expand aliases entered in the minibuffer.
2dcf34f9
BW
267
268In other words, aliases entered in the minibuffer will be
269expanded to the full address in the message draft. By default,
270this expansion is not performed."
f0d73c14
BW
271 :type 'boolean
272 :group 'mh-alias)
924df208 273
f0d73c14
BW
274(defcustom mh-alias-flash-on-comma t
275 "*Specify whether to flash address or warn on translation.
2dcf34f9
BW
276
277This option controls the behavior when a [comma] is pressed while
278entering aliases or addresses. The default setting flashes the
279address associated with an address in the minibuffer briefly, but
280does not display a warning if the alias is not found."
f0d73c14 281 :type '(choice (const :tag "Flash but Don't Warn If No Alias" t)
a05fcb7d
BW
282 (const :tag "Flash and Warn If No Alias" 1)
283 (const :tag "Don't Flash Nor Warn If No Alias" nil))
f0d73c14 284 :group 'mh-alias)
924df208 285
f0d73c14
BW
286(defcustom mh-alias-insert-file nil
287 "*Filename used to store a new MH-E alias.
2dcf34f9 288
5a4aad03
BW
289The default setting of this option is \"Use Aliasfile Profile
290Component\". This option can also hold the name of a file or a
2dcf34f9 291list a file names. If this option is set to a list of file names,
5a4aad03 292or the \"Aliasfile:\" profile component contains more than one file
2dcf34f9 293name, MH-E will prompt for one of them when MH-E adds an alias."
f0d73c14
BW
294 :type '(choice (const :tag "Use Aliasfile Profile Component" nil)
295 (file :tag "Alias File")
296 (repeat :tag "List of Alias Files" file))
297 :group 'mh-alias)
924df208 298
f0d73c14
BW
299(defcustom mh-alias-insertion-location 'sorted
300 "Specifies where new aliases are entered in alias files.
2dcf34f9 301
5a4aad03
BW
302This option is set to \"Alphabetical\" by default. If you organize
303your alias file in other ways, then adding aliases to the \"Top\"
304or \"Bottom\" of your alias file might be more appropriate."
f0d73c14
BW
305 :type '(choice (const :tag "Alphabetical" sorted)
306 (const :tag "Top" top)
307 (const :tag "Bottom" bottom))
308 :group 'mh-alias)
924df208 309
f0d73c14
BW
310(defcustom mh-alias-local-users t
311 "*If on, local users are added to alias completion.
924df208 312
5a4aad03 313Aliases are created from \"/etc/passwd\" entries with a user ID
2dcf34f9
BW
314larger than a magical number, typically 200. This can be a handy
315tool on a machine where you and co-workers exchange messages.
5a4aad03 316These aliases have the form \"local.first.last\" if a real name is
2dcf34f9 317present in the password file. Otherwise, the alias will have the
5a4aad03 318form \"local.login\".
924df208 319
2dcf34f9
BW
320If you're on a system with thousands of users you don't know, and
321the loading of local aliases slows MH-E down noticeably, then
322turn this option off.
924df208 323
2dcf34f9
BW
324This option also takes a string which is executed to generate the
325password file. For example, use \"ypcat passwd\" to obtain the
326NIS password file."
f0d73c14
BW
327 :type '(choice (boolean) (string))
328 :group 'mh-alias)
924df208 329
f0d73c14 330(defcustom mh-alias-local-users-prefix "local."
553fb735 331 "*String prefixed to the real names of users from the password file.
5a4aad03 332This option can also be set to \"Use Login\".
924df208 333
f0d73c14 334For example, consider the following password file entry:
924df208 335
f0d73c14 336 psg:x:1000:1000:Peter S Galbraith,,,:/home/psg:/bin/tcsh
924df208 337
2dcf34f9
BW
338The following settings of this option will produce the associated
339aliases:
924df208 340
f0d73c14
BW
341 \"local.\" local.peter.galbraith
342 \"\" peter.galbraith
343 Use Login psg
924df208 344
2dcf34f9
BW
345This option has no effect if variable `mh-alias-local-users' is
346turned off."
f0d73c14
BW
347 :type '(choice (const :tag "Use Login" nil)
348 (string))
349 :group 'mh-alias)
924df208 350
f0d73c14
BW
351(defcustom mh-alias-passwd-gecos-comma-separator-flag t
352 "*Non-nil means the gecos field in the password file uses a comma separator.
2dcf34f9
BW
353
354In the example in `mh-alias-local-users-prefix', commas are used
355to separate different values within the so-called gecos field.
356This is a fairly common usage. However, in the rare case that the
357gecos field in your password file is not separated by commas and
358whose contents may contain commas, you can turn this option off."
f0d73c14
BW
359 :type 'boolean
360 :group 'mh-alias)
924df208 361
f0d73c14 362\f
924df208 363
f0d73c14 364;;; Organizing Your Mail with Folders (:group 'mh-folder)
924df208 365
a8a47814 366(defcustom mh-new-messages-folders t
553fb735 367 "Folders searched for the \"unseen\" sequence.
a8a47814 368
2dcf34f9
BW
369Set this option to \"Inbox\" to search the \"+inbox\" folder or
370\"All\" to search all of the top level folders. Otherwise, list
371the folders that should be searched with the \"Choose Folders\"
372menu item.
553fb735
BW
373
374See also `mh-recursive-folders-flag'."
375 :type '(choice (const :tag "Inbox" t)
376 (const :tag "All" nil)
377 (repeat :tag "Choose Folders" (string :tag "Folder")))
378 :group 'mh-folder)
379
a8a47814 380(defcustom mh-ticked-messages-folders t
553fb735 381 "Folders searched for `mh-tick-seq'.
a8a47814 382
2dcf34f9
BW
383Set this option to \"Inbox\" to search the \"+inbox\" folder or
384\"All\" to search all of the top level folders. Otherwise, list
385the folders that should be searched with the \"Choose Folders\"
386menu item.
553fb735
BW
387
388See also `mh-recursive-folders-flag'."
389 :type '(choice (const :tag "Inbox" t)
390 (const :tag "All" nil)
391 (repeat :tag "Choose Folders" (string :tag "Folder")))
392 :group 'mh-folder)
393
394(defcustom mh-large-folder 200
395 "The number of messages that indicates a large folder.
2dcf34f9
BW
396
397If a folder is deemed to be large, that is the number of messages
398in it exceed this value, then confirmation is needed when it is
399visited. Even when `mh-show-threads-flag' is non-nil, the folder
400is not automatically threaded, if it is large. If set to nil all
401folders are treated as if they are small."
553fb735
BW
402 :type '(choice (const :tag "No Limit") integer)
403 :group 'mh-folder)
404
f0d73c14
BW
405(defcustom mh-recenter-summary-flag nil
406 "*Non-nil means to recenter the summary window.
2dcf34f9
BW
407
408If this option is turned on, recenter the summary window when the
409show window is toggled off."
f0d73c14
BW
410 :type 'boolean
411 :group 'mh-folder)
924df208 412
553fb735
BW
413(defcustom mh-recursive-folders-flag nil
414 "*Non-nil means that commands which operate on folders do so recursively."
415 :type 'boolean
416 :group 'mh-folder)
417
418(defcustom mh-sortm-args nil
b3867b6c
BW
419 "*Additional arguments for \"sortm\"\\<mh-folder-mode-map>.
420
421This option is consulted when a prefix argument is used with
2dcf34f9
BW
422\\[mh-sort-folder]. Normally default arguments to \"sortm\" are
423specified in the MH profile. This option may be used to provide
424an alternate view. For example, \"'(\"-nolimit\" \"-textfield\"
425\"subject\")\" is a useful setting."
553fb735
BW
426 :type 'string
427 :group 'mh-folder)
428
f0d73c14 429\f
924df208 430
f0d73c14 431;;; Folder Selection (:group 'mh-folder-selection)
924df208 432
f0d73c14 433(defcustom mh-default-folder-for-message-function nil
af435184 434 "Function to select a default folder for refiling or \"Fcc:\".
2dcf34f9
BW
435
436The current buffer is set to the message being refiled with point
437at the start of the message. This function should return the
5a4aad03 438default folder as a string with a leading \"+\" sign. It can also
2dcf34f9
BW
439return nil so that the last folder name is used as the default,
440or an empty string to suppress the default entirely."
f0d73c14
BW
441 :type 'function
442 :group 'mh-folder-selection)
c3d9274a 443
3d7ca223 444(defcustom mh-default-folder-list nil
f0d73c14 445 "*List of addresses and folders.
2dcf34f9
BW
446
447The folder name associated with the first address found in this
448list is used as the default for `mh-refile-msg' and similar
5a4aad03 449functions. Each element in this list contains a \"Check Recipient\"
2dcf34f9
BW
450item. If this item is turned on, then the address is checked
451against the recipient instead of the sender. This is useful for
452mailing lists.
453
454See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
455for more information."
924df208
BW
456 :type '(repeat (list (regexp :tag "Address")
457 (string :tag "Folder")
458 (boolean :tag "Check Recipient")))
f0d73c14 459 :group 'mh-folder-selection)
3d7ca223
BW
460
461(defcustom mh-default-folder-must-exist-flag t
462 "*Non-nil means guessed folder name must exist to be used.
f0d73c14 463
2dcf34f9
BW
464If the derived folder does not exist, and this option is on, then
465the last folder name used is suggested. This is useful if you get
466mail from various people for whom you have an alias, but file
467them all in the same project folder.
468
469See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
470for more information."
c3d9274a 471 :type 'boolean
f0d73c14 472 :group 'mh-folder-selection)
c3d9274a 473
3d7ca223 474(defcustom mh-default-folder-prefix ""
f0d73c14
BW
475 "*Prefix used for folder names generated from aliases.
476The prefix is used to prevent clutter in your mail directory.
477
2dcf34f9
BW
478See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
479for more information."
3d7ca223 480 :type 'string
f0d73c14 481 :group 'mh-folder-selection)
3d7ca223 482
f0d73c14 483\f
c3d9274a 484
f0d73c14 485;;; Identities (:group 'mh-identity)
924df208 486
f0d73c14
BW
487(defcustom mh-identity-list nil
488 "*List of identities.
489
5a4aad03
BW
490To customize this option, click on the \"INS\" button and enter a label
491such as \"Home\" or \"Work\". Then click on the \"INS\" button with the
492label \"Add at least one item below\". Then choose one of the items in
493the \"Value Menu\".
2dcf34f9 494
5a4aad03
BW
495You can specify an alternate \"From:\" header field using the \"From
496Field\" menu item. You must include a valid email address. A standard
497format is \"First Last <login@@host.domain>\". If you use an initial
498with a period, then you must quote your name as in '\"First I. Last\"
2dcf34f9 499<login@@host.domain>'. People usually list the name of the company
5a4aad03
BW
500where they work using the \"Organization Field\" menu item. Set any
501arbitrary header field and value in the \"Other Field\" menu item.
2dcf34f9 502Unless the header field is a standard one, precede the name of your
5a4aad03
BW
503field's label with \"X-\", as in \"X-Fruit-of-the-Day:\". The value of
504\"Attribution Verb\" overrides the setting of
2dcf34f9 505`mh-extract-from-attribution-verb'. Set your signature with the
5a4aad03 506\"Signature\" menu item. You can specify the contents of
2dcf34f9 507`mh-signature-file-name', a file, or a function. Specify a different
5a4aad03 508key to sign or encrypt messages with the \"GPG Key ID\" menu item.
2dcf34f9
BW
509
510You can select the identities you have added via the menu called
5a4aad03 511\"Identity\" in the MH-Letter buffer. You can also use
2dcf34f9 512\\[mh-insert-identity]. To clear the fields and signature added by the
5a4aad03 513identity, select the \"None\" identity.
2dcf34f9 514
5a4aad03
BW
515The \"Identity\" menu contains two other items to save you from having
516to set the identity on every message. The menu item \"Set Default for
517Session\" can be used to set the default identity to the current
518identity until you exit Emacs. The menu item \"Save as Default\" sets
2dcf34f9
BW
519the option `mh-identity-default' to the current identity setting. You
520can also customize the `mh-identity-default' option in the usual
521fashion."
f0d73c14
BW
522 :type '(repeat (list :tag ""
523 (string :tag "Label")
524 (repeat :tag "Add at least one item below"
525 (choice
526 (cons :tag "From Field"
527 (const "From")
528 (string :tag "Value"))
529 (cons :tag "Organization Field"
530 (const "Organization")
531 (string :tag "Value"))
532 (cons :tag "Other Field"
533 (string :tag "Field")
534 (string :tag "Value"))
535 (cons :tag "Attribution Verb"
536 (const ":attribution-verb")
537 (string :tag "Value"))
538 (cons :tag "Signature"
539 (const :tag "Signature"
540 ":signature")
541 (choice
542 (const :tag "mh-signature-file-name"
543 nil)
544 (file)
545 (function)))
546 (cons :tag "GPG Key ID"
547 (const :tag "GPG Key ID"
548 ":pgg-default-user-id")
549 (string :tag "Value"))))))
550 :set 'mh-identity-list-set
551 :group 'mh-identity)
c3d9274a 552
f0d73c14
BW
553(defcustom mh-auto-fields-list nil
554 "List of recipients for which header lines are automatically inserted.
e495eaec 555
2dcf34f9 556This option can be used to set the identity depending on the
5a4aad03 557recipient. To customize this option, click on the \"INS\" button and
2dcf34f9 558enter a regular expression for the recipient's address. Click on the
5a4aad03
BW
559\"INS\" button with the \"Add at least one item below\" label. Then choose
560one of the items in the \"Value Menu\".
2dcf34f9 561
5a4aad03 562The \"Identity\" menu item is used to select an identity from those
2dcf34f9 563configured in `mh-identity-list'. All of the information for that
5a4aad03
BW
564identity will be added if the recipient matches. The \"Fcc Field\" menu
565item is used to select a folder that is used in the \"Fcc:\" header.
2dcf34f9 566When you send the message, MH will put a copy of your message in this
5a4aad03
BW
567folder. The \"Mail-Followup-To Field\" menu item is used to insert an
568\"Mail-Followup-To:\" header field with the recipients you provide. If
2dcf34f9
BW
569the recipient's mail user agent supports this header field (as nmh
570does), then their replies will go to the addresses listed. This is
571useful if their replies go both to the list and to you and you don't
572have a mechanism to suppress duplicates. If you reply to someone not
5a4aad03 573on the list, you must either remove the \"Mail-Followup-To:\" field, or
2dcf34f9 574ensure the recipient is also listed there so that he receives replies
5a4aad03
BW
575to your reply. Other header fields may be added using the \"Other
576Field\" menu item.
2dcf34f9
BW
577
578These fields can only be added after the recipient is known. Once the
579header contains one or more recipients, run the
5a4aad03
BW
580\\[mh-insert-auto-fields] command or choose the \"Identity -> Insert
581Auto Fields\" menu item to insert these fields manually. However, you
2dcf34f9
BW
582can just send the message and the fields will be added automatically.
583You are given a chance to see these fields and to confirm them before
584the message is actually sent. You can do away with this confirmation
585by turning off the option `mh-auto-fields-prompt-flag'.
586
587You should avoid using the same header field in `mh-auto-fields-list'
588and `mh-identity-list' definitions that may apply to the same message
589as the result is undefined."
f0d73c14
BW
590 :type `(repeat
591 (list :tag ""
592 (string :tag "Recipient")
593 (repeat :tag "Add at least one item below"
594 (choice
595 (cons :tag "Identity"
596 (const ":identity")
597 ,(append
598 '(radio)
599 (mapcar
600 (function (lambda (arg) `(const ,arg)))
601 (mapcar 'car mh-identity-list))))
602 (cons :tag "Fcc Field"
603 (const "fcc")
604 (string :tag "Value"))
605 (cons :tag "Mail-Followup-To Field"
606 (const "Mail-Followup-To")
607 (string :tag "Value"))
608 (cons :tag "Other Field"
609 (string :tag "Field")
610 (string :tag "Value"))))))
611 :group 'mh-identity)
a66894d8 612
f0d73c14
BW
613(defcustom mh-auto-fields-prompt-flag t
614 "*Non-nil means to prompt before sending if fields inserted.
615See `mh-auto-fields-list'."
a66894d8 616 :type 'boolean
f0d73c14 617 :group 'mh-identity)
c3d9274a 618
f0d73c14 619(defcustom mh-identity-default nil
e495eaec
BW
620 "Default identity to use when `mh-letter-mode' is called.
621See `mh-identity-list'."
f0d73c14
BW
622 :type (append
623 '(radio)
624 (cons '(const :tag "None" nil)
625 (mapcar (function (lambda (arg) `(const ,arg)))
626 (mapcar 'car mh-identity-list))))
627 :group 'mh-identity)
c3d9274a 628
f0d73c14 629(defcustom mh-identity-handlers
e495eaec
BW
630 '(("From" . mh-identity-handler-top)
631 (":default" . mh-identity-handler-bottom)
f0d73c14
BW
632 (":attribution-verb" . mh-identity-handler-attribution-verb)
633 (":signature" . mh-identity-handler-signature)
634 (":pgg-default-user-id" . mh-identity-handler-gpg-identity))
635 "Handler functions for fields in `mh-identity-list'.
e495eaec 636
2dcf34f9
BW
637This option is used to change the way that fields, signatures,
638and attributions in `mh-identity-list' are added. To customize
639`mh-identity-handlers', replace the name of an existing handler
640function associated with the field you want to change with the
641name of a function you have written. You can also click on an
5a4aad03 642\"INS\" button and insert a field of your choice and the name of
2dcf34f9 643the function you have written to handle it.
e495eaec 644
5a4aad03
BW
645The \"Field\" field can be any field that you've used in your
646`mh-identity-list'. The special fields \":attribution-verb\",
647\":signature\", or \":pgg-default-user-id\" are used for the
648`mh-identity-list' choices \"Attribution Verb\", \"Signature\", and
649\"GPG Key ID\" respectively.
2dcf34f9 650
5a4aad03 651The handler associated with the \":default\" field is used when no
2dcf34f9
BW
652other field matches.
653
654The handler functions are passed two or three arguments: the
5a4aad03
BW
655FIELD itself (for example, \"From\"), or one of the special
656fields (for example, \":signature\"), and the ACTION 'remove or
657'add. If the action is 'add, an additional argument
2dcf34f9 658containing the VALUE for the field is given."
f0d73c14
BW
659 :type '(repeat (cons (string :tag "Field") function))
660 :group 'mh-identity)
c3d9274a 661
f0d73c14 662\f
c3d9274a 663
f0d73c14 664;;; Incorporating Your Mail (:group 'mh-inc)
c3d9274a 665
f0d73c14 666(defcustom mh-inc-prog "inc"
e495eaec
BW
667 "*Program to incorporate new mail into a folder.
668
2dcf34f9
BW
669This program generates a one-line summary for each of the new
670messages. Unless it is an absolute pathname, the file is assumed
671to be in the `mh-progs' directory. You may also link a file to
5a4aad03 672\"inc\" that uses a different format. You'll then need to modify
2dcf34f9 673several scan line format variables appropriately."
f0d73c14
BW
674 :type 'string
675 :group 'mh-inc)
924df208 676
f0d73c14 677(defcustom mh-inc-spool-list nil
e495eaec
BW
678 "*Alternate spool files.
679
2dcf34f9
BW
680You can use the `mh-inc-spool-list' variable to direct MH-E to
681retrieve mail from arbitrary spool files other than your system
5a4aad03 682mailbox, file it in folders other than your \"+inbox\", and assign
2dcf34f9 683key bindings to incorporate this mail.
f0d73c14 684
5a4aad03
BW
685Suppose you are subscribed to the \"mh-e-devel\" mailing list and
686you use \"procmail\" to filter this mail into \"~/mail/mh-e\" with
687the following recipe in \".procmailrc\":
f0d73c14
BW
688
689 MAILDIR=$HOME/mail
690 :0:
e495eaec 691 * ^From mh-e-devel-admin@stop.mail-abuse.org
f0d73c14
BW
692 mh-e
693
5a4aad03
BW
694In order to incorporate \"~/mail/mh-e\" into \"+mh-e\" with an
695\"I m\" (mh-inc-spool-mh-e) command, customize this option, and click
696on the \"INS\" button. Enter a \"Spool File\" of \"~/mail/mh-e\", a
697\"Folder\" of \"mh-e\", and a \"Key Binding\" of \"m\".
f0d73c14 698
5a4aad03
BW
699You can use \"xbuffy\" to automate the incorporation of this mail
700using the \"gnudoit\" command in the \"gnuserv\" package as follows:
f0d73c14
BW
701
702 box ~/mail/mh-e
703 title mh-e
704 origMode
705 polltime 10
706 headertime 0
e495eaec 707 command gnudoit -q '(mh-inc-spool-mh-e)'"
f0d73c14
BW
708 :type '(repeat (list (file :tag "Spool File")
709 (string :tag "Folder")
710 (character :tag "Key Binding")))
711 :set 'mh-inc-spool-list-set
712 :group 'mh-inc)
c3d9274a 713
3d7ca223
BW
714\f
715
f0d73c14 716;;; Searching (:group 'mh-index)
924df208 717
924df208
BW
718(defcustom mh-index-program nil
719 "Indexing program that MH-E shall use.
924df208 720
5a4aad03 721The default setting of this option is \"Auto-detect\" which means
2dcf34f9
BW
722that MH-E will automatically choose one of swish++, swish-e,
723mairix, namazu, pick and grep in that order. If, for example, you
724have both swish++ and mairix installed and you want to use
5a4aad03 725mairix, then you can set this option to \"mairix\".
2dcf34f9
BW
726
727More information about setting up an indexing program to use with
728MH-E can be found in the documentation of `mh-index-search'."
924df208
BW
729 :type '(choice (const :tag "Auto-detect" nil)
730 (const :tag "swish++" swish++)
731 (const :tag "swish-e" swish)
732 (const :tag "mairix" mairix)
733 (const :tag "namazu" namazu)
924df208
BW
734 (const :tag "pick" pick)
735 (const :tag "grep" grep))
736 :group 'mh-index)
737
738\f
739
f0d73c14 740;;; Dealing with Junk Mail (:group 'mh-junk)
924df208
BW
741
742;; Spam fighting program chosen
743(defvar mh-junk-choice nil)
744
745;; Available spam filter interfaces
746(defvar mh-junk-function-alist
f0d73c14
BW
747 '((spamassassin mh-spamassassin-blacklist mh-spamassassin-whitelist)
748 (bogofilter mh-bogofilter-blacklist mh-bogofilter-whitelist)
749 (spamprobe mh-spamprobe-blacklist mh-spamprobe-whitelist))
924df208 750 "Available choices of spam programs to use.
2dcf34f9
BW
751
752This is an alist. For each element there are functions that
753blacklist a message as spam and whitelist a message incorrectly
754classified as spam.")
924df208
BW
755
756(defun mh-junk-choose (symbol value)
757 "Choose spam program to use.
2dcf34f9
BW
758
759The function is always called with SYMBOL bound to
760`mh-junk-program' and VALUE bound to the new value of
761`mh-junk-program'. The function sets the variable
924df208
BW
762`mh-junk-choice' in addition to `mh-junk-program'."
763 (set symbol value)
764 (setq mh-junk-choice
765 (or value
766 (loop for element in mh-junk-function-alist
767 until (executable-find (symbol-name (car element)))
768 finally return (car element)))))
769
770;; User customizable variables
e495eaec
BW
771(defcustom mh-junk-background nil
772 "If on, spam programs are run in background.
2dcf34f9
BW
773
774By default, the programs are run in the foreground, but this can
775be slow when junking large numbers of messages. If you have
776enough memory or don't junk that many messages at the same time,
777you might try turning on this option."
e495eaec
BW
778 :type '(choice (const :tag "Off" nil)
779 (const :tag "On" 0))
780 :group 'mh-junk)
781
f0d73c14
BW
782(defcustom mh-junk-disposition nil
783 "Disposition of junk mail."
784 :type '(choice (const :tag "Delete Spam" nil)
785 (string :tag "Spam Folder"))
786 :group 'mh-junk)
787
788(defcustom mh-junk-program nil
789 "Spam program that MH-E should use.
e495eaec 790
2dcf34f9
BW
791The default setting of this option is \"Auto-detect\" which means
792that MH-E will automatically choose one of SpamAssassin,
793bogofilter, or SpamProbe in that order. If, for example, you have
794both SpamAssassin and bogofilter installed and you want to use
795bogofilter, then you can set this option to \"Bogofilter\"."
f0d73c14
BW
796 :type '(choice (const :tag "Auto-detect" nil)
797 (const :tag "SpamAssassin" spamassassin)
798 (const :tag "Bogofilter" bogofilter)
799 (const :tag "SpamProbe" spamprobe))
800 :set 'mh-junk-choose
924df208
BW
801 :group 'mh-junk)
802
f0d73c14
BW
803\f
804
805;;; Editing a Draft (:group 'mh-letter)
806
0c47b17c 807(defcustom mh-compose-insertion (if (locate-library "mml") 'mml 'mh)
169a3241 808 "Type of tags used when composing MIME messages.
2dcf34f9
BW
809
810In addition to MH-style directives, MH-E also supports MML (MIME
811Meta Language) tags. (see Info node `(emacs-mime)Composing').
812This option can be used to choose between them. By default, this
813option is set to \"MML\" if it is supported since it provides a
814lot more functionality. This option can also be set to \"MH\" if
815MH-style directives are preferred."
0c47b17c
BW
816 :type '(choice (const :tag "MML" mml)
817 (const :tag "MH" mh))
f0d73c14
BW
818 :group 'mh-letter)
819
820(defcustom mh-compose-skipped-header-fields
821 '("From" "Organization" "References" "In-Reply-To"
822 "X-Face" "Face" "X-Image-URL" "X-Mailer")
823 "List of header fields to skip over when navigating in draft."
824 :type '(repeat (string :tag "Field"))
825 :group 'mh-letter)
826
827(defcustom mh-compose-space-does-completion-flag nil
fefc5079 828 "*Non-nil means \\<mh-letter-mode-map>\\[mh-letter-complete-or-space] does completion in message header."
f0d73c14
BW
829 :type 'boolean
830 :group 'mh-letter)
831
832(defcustom mh-delete-yanked-msg-window-flag nil
fefc5079 833 "*Non-nil means delete any window displaying the message.
2dcf34f9
BW
834
835This deletes the window containing the original message after
836yanking it with \\<mh-letter-mode-map>\\[mh-yank-cur-msg] to make
837more room on your screen for your reply."
f0d73c14
BW
838 :type 'boolean
839 :group 'mh-letter)
840
841(defcustom mh-extract-from-attribution-verb "wrote:"
0c47b17c 842 "*Verb to use for attribution when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
2dcf34f9
BW
843
844The attribution consists of the sender's name and email address
845followed by the content of this option. This option can be set to
846