* cus-edit.el (customize-package-emacs-version-alist): Update
[bpt/emacs.git] / lisp / mh-e / mh-e.el
CommitLineData
c26cf6c8
RS
1;;; mh-e.el --- GNU Emacs interface to the MH mail system
2
e495eaec
BW
3;; Copyright (C) 1985, 1986, 1987, 1988,
4;; 1990, 1992, 1993, 1994, 1995, 1997, 1999,
af435184 5;; 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
c26cf6c8 6
a1b4049d 7;; Author: Bill Wohler <wohler@newt.com>
6e65a812 8;; Maintainer: Bill Wohler <wohler@newt.com>
971a25ab 9;; Version: 7.93+cvs
c26cf6c8
RS
10;; Keywords: mail
11
60370d40 12;; This file is part of GNU Emacs.
9b7bc076
KH
13
14;; GNU Emacs is free software; you can redistribute it and/or modify
c26cf6c8
RS
15;; it under the terms of the GNU General Public License as published by
16;; the Free Software Foundation; either version 2, or (at your option)
17;; any later version.
18
9b7bc076 19;; GNU Emacs is distributed in the hope that it will be useful,
c26cf6c8
RS
20;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;; GNU General Public License for more details.
23
24;; You should have received a copy of the GNU General Public License
b578f267 25;; along with GNU Emacs; see the file COPYING. If not, write to the
3a35cf56
LK
26;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27;; Boston, MA 02110-1301, USA.
c26cf6c8
RS
28
29;;; Commentary:
30
dda00b2c 31;; How to use:
a1b4049d
BW
32;; M-x mh-rmail to read mail. Type C-h m there for a list of commands.
33;; C-u M-x mh-rmail to visit any folder.
dda00b2c 34;; M-x mh-smail to send mail. From within the mail reader, "s" works, too.
b578f267 35
a1b4049d
BW
36;; Your .emacs might benefit from these bindings:
37;; (global-set-key "\C-cr" 'mh-rmail)
38;; (global-set-key "\C-xm" 'mh-smail)
39;; (global-set-key "\C-x4m" 'mh-smail-other-window)
b578f267 40
dda00b2c
BW
41;; If Emacs can't find mh-rmail or mh-smail, add the following to ~/.emacs:
42;; (require 'mh-autoloads)
43
44;; If you want to customize MH-E before explicitly loading it, add this:
45;; (require 'mh-cus-load)
46
a1b4049d 47;; MH (Message Handler) is a powerful mail reader.
b578f267 48
a1b4049d
BW
49;; The MH newsgroup is comp.mail.mh; the mailing list is mh-users@ics.uci.edu
50;; (send to mh-users-request to be added). See the monthly Frequently Asked
bdcfe844 51;; Questions posting there for information on getting MH and MH-E:
a1b4049d 52;; http://www.faqs.org/faqs/mail/mh-faq/part1/preamble.html
b578f267 53
a1b4049d 54;; N.B. MH must have been compiled with the MHE compiler flag or several
bdcfe844 55;; features necessary for MH-E will be missing from MH commands, specifically
b578f267
EN
56;; the -build switch to repl and forw.
57
bdcfe844 58;; MH-E is an Emacs interface to the MH mail system.
a1b4049d 59
7094eefe
BW
60;; MH-E is supported in GNU Emacs 21 and 22 as well as XEmacs 21
61;; (except for versions 21.5.9-21.5.16), with MH 6.8.4 on, nmh 1.0.4
62;; on, and GNU mailutils 0.4 on.
a1b4049d
BW
63
64;; Mailing Lists:
65;; mh-e-users@lists.sourceforge.net
66;; mh-e-announce@lists.sourceforge.net
67;; mh-e-devel@lists.sourceforge.net
dda00b2c 68
a1b4049d
BW
69;; Subscribe by sending a "subscribe" message to
70;; <list>-request@lists.sourceforge.net, or by using the web interface at
71;; https://sourceforge.net/mail/?group_id=13357
72
73;; Bug Reports:
74;; https://sourceforge.net/tracker/?group_id=13357&atid=113357
dda00b2c
BW
75;; Include the output of M-x mh-version in the bug report unless
76;; you're 110% sure we won't ask for it.
a1b4049d
BW
77
78;; Feature Requests:
dda00b2c 79;; https://sourceforge.net/tracker/?group_id=13357&atid=363357
a1b4049d
BW
80
81;; Support:
82;; https://sourceforge.net/tracker/?group_id=13357&atid=213357
b578f267 83
717e06e5 84;;; Change Log:
b578f267
EN
85
86;; Original version for Gosling emacs by Brian Reid, Stanford, 1982.
87;; Modified by James Larus, BBN, July 1984 and UCB, 1984 & 1985.
f0d73c14
BW
88;; Rewritten for GNU Emacs, James Larus, 1985.
89;; Modified by Stephen Gildea, 1988.
90;; Maintenance picked up by Bill Wohler and the
91;; SourceForge Crew <http://mh-e.sourceforge.net/>, 2001.
a1b4049d 92
c26cf6c8
RS
93;;; Code:
94
dda00b2c
BW
95;; Provide functions to the rest of MH-E. However, mh-e.el must not
96;; use any definitions in files that require mh-e from mh-loaddefs,
97;; for if it does it will introduce a require loop.
98(require 'mh-loaddefs)
c3d9274a 99
f0d73c14 100(mh-require-cl)
a1b4049d 101
dda00b2c
BW
102(eval-and-compile
103 (defvar mh-xemacs-flag (featurep 'xemacs)
a425dc3d 104 "Non-nil means the current Emacs is XEmacs."))
d5dc8c56 105
dda00b2c
BW
106(mh-do-in-xemacs
107 (require 'mh-xemacs))
108
9c2cf222 109(require 'mh-buffers)
dda00b2c 110(require 'mh-compat)
a1b4049d 111
dda00b2c 112\f
c26cf6c8 113
dda00b2c 114;;; Global Variables
a1b4049d 115
dda00b2c
BW
116;; Try to keep variables local to a single file. Provide accessors if
117;; variables are shared. Use this section as a last resort.
cee9f5c6 118
971a25ab 119(defconst mh-version "7.93+cvs" "Version number of MH-E.")
a1b4049d 120
dda00b2c 121;; Variants
c3d9274a 122
dda00b2c
BW
123(defvar mh-sys-path
124 '("/usr/local/nmh/bin" ; nmh default
125 "/usr/local/bin/mh/"
126 "/usr/local/mh/"
127 "/usr/bin/mh/" ; Ultrix 4.2, Linux
128 "/usr/new/mh/" ; Ultrix < 4.2
129 "/usr/contrib/mh/bin/" ; BSDI
130 "/usr/pkg/bin/" ; NetBSD
131 "/usr/local/bin/"
132 "/usr/local/bin/mu-mh/" ; GNU mailutils - default
133 "/usr/bin/mu-mh/") ; GNU mailutils - packaged
134 "List of directories to search for variants of the MH variant.
135The list `exec-path' is searched in addition to this list.
136There's no need for users to modify this list. Instead add extra
137directories to the customizable variable `mh-path'.")
a1b4049d 138
dda00b2c
BW
139(defvar mh-variants nil
140 "List describing known MH variants.
141Do not access this variable directly as it may not have yet been initialized.
142Use the function `mh-variants' instead.")
bdcfe844 143
dda00b2c
BW
144(defvar mh-variant-in-use nil
145 "The MH variant currently in use; a string with variant and version number.
146This differs from `mh-variant' when the latter is set to
147\"autodetect\".")
bdcfe844 148
dda00b2c
BW
149(defvar mh-progs nil
150 "Directory containing MH commands, such as inc, repl, and rmm.")
151
152;;;###autoload
153(put 'mh-progs 'risky-local-variable t)
154
155(defvar mh-lib nil
156 "Directory containing the MH library.
157This directory contains, among other things, the components file.")
158
159;;;###autoload
160(put 'mh-lib 'risky-local-variable t)
161
162(defvar mh-lib-progs nil
163 "Directory containing MH helper programs.
164This directory contains, among other things, the mhl program.")
165
166;;;###autoload
167(put 'mh-lib-progs 'risky-local-variable t)
c26cf6c8 168
dda00b2c 169;; Profile Components
c26cf6c8 170
dda00b2c
BW
171(defvar mh-draft-folder nil
172 "Cached value of the \"Draft-Folder:\" MH profile component.
173Name of folder containing draft messages.
174Nil means do not use a draft folder.")
d1699462 175
dda00b2c
BW
176(defvar mh-inbox nil
177 "Cached value of the \"Inbox:\" MH profile component.
178Set to \"+inbox\" if no such component.
179Name of the Inbox folder.")
d1699462 180
dda00b2c
BW
181(defvar mh-user-path nil
182 "Cached value of the \"Path:\" MH profile component.
183User's mail folder directory.")
184
185;; Maps declared here so that they can be used in docstrings.
c26cf6c8
RS
186
187(defvar mh-folder-mode-map (make-keymap)
dda00b2c
BW
188 "Keymap for MH-Folder mode.")
189
190(defvar mh-folder-seq-tool-bar-map nil
191 "Keymap for MH-Folder tool bar.")
192
193(defvar mh-folder-tool-bar-map nil
194 "Keymap for MH-Folder tool bar.")
195
196(defvar mh-inc-spool-map (make-sparse-keymap)
197 "Keymap for MH-E's mh-inc-spool commands.")
198
199(defvar mh-letter-mode-map (copy-keymap text-mode-map)
200 "Keymap for MH-Letter mode.")
201
202(defvar mh-letter-tool-bar-map nil
203 "Keymap for MH-Letter tool bar.")
204
205(defvar mh-search-mode-map (make-sparse-keymap)
206 "Keymap for MH-Search mode.")
207
208(defvar mh-show-mode-map (make-sparse-keymap)
209 "Keymap MH-Show mode.")
210
211(defvar mh-show-seq-tool-bar-map nil
212 "Keymap for MH-Show tool bar.")
213
214(defvar mh-show-tool-bar-map nil
215 "Keymap for MH-Show tool bar.")
216
217;; MH-Folder Locals (alphabetical)
c26cf6c8 218
d1699462
BW
219(defvar mh-arrow-marker nil
220 "Marker for arrow display in fringe.")
221
dda00b2c
BW
222(defvar mh-colors-available-flag nil
223 "Non-nil means colors are available.")
224
225(defvar mh-current-folder nil
226 "Name of current folder, a string.")
227
d1699462
BW
228(defvar mh-delete-list nil
229 "List of message numbers to delete.
2dcf34f9
BW
230This variable can be used by
231`mh-before-commands-processed-hook'.")
3d7ca223 232
dda00b2c
BW
233(defvar mh-folder-view-stack nil
234 "Stack of previous folder views.")
235
236(defvar mh-index-data nil
237 "Info about index search results.")
238
239(defvar mh-index-previous-search nil)
240
241(defvar mh-index-msg-checksum-map nil)
242
243(defvar mh-index-checksum-origin-map nil)
244
245(defvar mh-index-sequence-search-flag nil)
246
247(defvar mh-mode-line-annotation nil
248 "Message range displayed in buffer.")
249
250(defvar mh-next-direction 'forward
251 "Direction to move to next message.")
252
253(defvar mh-previous-window-config nil
254 "Window configuration before MH-E command.")
255
d1699462
BW
256(defvar mh-refile-list nil
257 "List of folder names in `mh-seq-list'.
2dcf34f9
BW
258This variable can be used by
259`mh-before-commands-processed-hook'.")
c26cf6c8 260
dda00b2c
BW
261(defvar mh-seen-list nil
262 "List of displayed messages to be removed from the \"Unseen\" sequence.")
c26cf6c8 263
dda00b2c
BW
264(defvar mh-seq-list nil
265 "Alist of this folder's sequences.
266Elements have the form (SEQUENCE . MESSAGES).")
267
268(defvar mh-sequence-notation-history nil
269 "Remember original notation that is overwritten by `mh-note-seq'.")
270
271(defvar mh-show-buffer nil
272 "Buffer that displays message for this folder.")
2953de8c 273
dda00b2c
BW
274(defvar mh-showing-mode nil
275 "If non-nil, show the message in a separate window.")
276
277(defvar mh-view-ops nil
d1699462
BW
278 "Stack of operations that change the folder view.
279These operations include narrowing or threading.")
c26cf6c8 280
dda00b2c 281;; MH-Show Locals (alphabetical)
d1699462 282
dda00b2c
BW
283(defvar mh-globals-hash (make-hash-table)
284 "Keeps track of MIME data on a per buffer basis.")
c26cf6c8 285
dda00b2c
BW
286(defvar mh-show-folder-buffer nil
287 "Keeps track of folder whose message is being displayed.")
c3d9274a 288
dda00b2c 289;; MH-Letter Locals
c26cf6c8 290
dda00b2c
BW
291(defvar mh-folders-changed nil
292 "Lists which folders were affected by deletes and refiles.
293This list will always include the current folder
294`mh-current-folder'. This variable can be used by
295`mh-after-commands-processed-hook'.")
c26cf6c8 296
dda00b2c
BW
297(defvar mh-mail-header-separator "--------"
298 "*Line used by MH to separate headers from text in messages being composed.
c26cf6c8 299
dda00b2c
BW
300This variable should not be used directly in programs. Programs
301should use `mail-header-separator' instead.
302`mail-header-separator' is initialized to
303`mh-mail-header-separator' in `mh-letter-mode'; in other
304contexts, you may have to perform this initialization yourself.
a66894d8 305
dda00b2c
BW
306Do not make this a regular expression as it may be the argument
307to `insert' and it is passed through `regexp-quote' before being
308used by functions like `re-search-forward'.")
f0d73c14 309
dda00b2c
BW
310(defvar mh-sent-from-folder nil
311 "Folder of msg assoc with this letter.")
cee9f5c6 312
dda00b2c
BW
313(defvar mh-sent-from-msg nil
314 "Number of msg assoc with this letter.")
a1b4049d 315
dda00b2c 316;; Sequences
c26cf6c8 317
dda00b2c
BW
318(defvar mh-unseen-seq nil
319 "Cached value of the \"Unseen-Sequence:\" MH profile component.
320Name of the Unseen sequence.")
c26cf6c8 321
dda00b2c
BW
322(defvar mh-previous-seq nil
323 "Cached value of the \"Previous-Sequence:\" MH profile component.
324Name of the Previous sequence.")
2dcf34f9 325
dda00b2c 326;; Etc. (alphabetical)
c26cf6c8 327
dda00b2c
BW
328(defvar mh-flists-present-flag nil
329 "Non-nil means that we have \"flists\".")
2dcf34f9 330
dda00b2c
BW
331(defvar mh-index-data-file ".mhe_index"
332 "MH-E specific file where index seach info is stored.")
c26cf6c8 333
dda00b2c 334(defvar mh-letter-header-field-regexp "^\\([A-Za-z][A-Za-z0-9-]*\\):")
c26cf6c8 335
dda00b2c
BW
336(defvar mh-page-to-next-msg-flag nil
337 "Non-nil means next SPC or whatever goes to next undeleted message.")
c26cf6c8 338
dda00b2c
BW
339(defvar mh-pgp-support-flag (not (not (locate-library "mml2015")))
340 "Non-nil means PGP support is available.")
553fb735 341
dda00b2c
BW
342(defvar mh-signature-separator "-- \n"
343 "Text of a signature separator.
bdcfe844 344
dda00b2c
BW
345A signature separator is used to separate the body of a message
346from the signature. This can be used by user agents such as MH-E
347to render the signature differently or to suppress the inclusion
348of the signature in a reply. Use `mh-signature-separator-regexp'
349when searching for a separator.")
553fb735 350
dda00b2c
BW
351(defvar mh-signature-separator-regexp "^-- $"
352 "This regular expression matches the signature separator.
353See `mh-signature-separator'.")
553fb735 354
dda00b2c
BW
355(defvar mh-thread-scan-line-map nil
356 "Map of message index to various parts of the scan line.")
357(make-variable-buffer-local 'mh-thread-scan-line-map)
bdcfe844 358
dda00b2c
BW
359(defvar mh-thread-scan-line-map-stack nil
360 "Old map of message index to various parts of the scan line.
361This is the original map that is stored when the folder is
362narrowed.")
363(make-variable-buffer-local 'mh-thread-scan-line-map-stack)
553fb735 364
dda00b2c
BW
365(defvar mh-x-mailer-string nil
366 "*String containing the contents of the X-Mailer header field.
367If nil, this variable is initialized to show the version of MH-E,
368Emacs, and MH the first time a message is composed.")
553fb735 369
dda00b2c 370\f
553fb735 371
dda00b2c 372;;; MH-E Entry Points
c3d9274a
BW
373
374(eval-when-compile (require 'gnus))
375
376(defmacro mh-macro-expansion-time-gnus-version ()
377 "Return Gnus version available at macro expansion time.
2dcf34f9
BW
378The macro evaluates the Gnus version at macro expansion time. If
379MH-E was compiled then macro expansion happens at compile time."
380gnus-version)
c3d9274a
BW
381
382(defun mh-run-time-gnus-version ()
383 "Return Gnus version available at run time."
384 (require 'gnus)
385 gnus-version)
386
847b8219 387;;;###autoload
c26cf6c8 388(defun mh-version ()
bdcfe844 389 "Display version information about MH-E and the MH mail handling system."
c26cf6c8 390 (interactive)
3d7ca223 391 (set-buffer (get-buffer-create mh-info-buffer))
c26cf6c8 392 (erase-buffer)
c3d9274a
BW
393 ;; MH-E version.
394 (insert "MH-E " mh-version "\n\n")
395 ;; MH-E compilation details.
396 (insert "MH-E compilation details:\n")
397 (let* ((compiled-mhe (byte-code-function-p (symbol-function 'mh-version)))
398 (gnus-compiled-version (if compiled-mhe
399 (mh-macro-expansion-time-gnus-version)
400 "N/A")))
401 (insert " Byte compiled:\t\t" (if compiled-mhe "yes" "no") "\n"
402 " Gnus (compile-time):\t" gnus-compiled-version "\n"
403 " Gnus (run-time):\t" (mh-run-time-gnus-version) "\n\n"))
404 ;; Emacs version.
405 (insert (emacs-version) "\n\n")
a1b4049d 406 ;; MH version.
f0d73c14
BW
407 (if mh-variant-in-use
408 (insert mh-variant-in-use "\n"
409 " mh-progs:\t" mh-progs "\n"
410 " mh-lib:\t" mh-lib "\n"
411 " mh-lib-progs:\t" mh-lib-progs "\n\n")
412 (insert "No MH variant detected\n"))
a1b4049d
BW
413 ;; Linux version.
414 (condition-case ()
415 (call-process "uname" nil t nil "-a")
416 (file-error))
417 (goto-char (point-min))
3d7ca223 418 (display-buffer mh-info-buffer))
c26cf6c8 419
dda00b2c
BW
420\f
421
422;;; Support Routines
423
424(defun mh-list-to-string (l)
425 "Flatten the list L and make every element of the new list into a string."
426 (nreverse (mh-list-to-string-1 l)))
427
428(defun mh-list-to-string-1 (l)
429 "Flatten the list L and make every element of the new list into a string."
8d1ada53
BW
430 (let (new-list)
431 (dolist (element l)
432 (cond ((null element))
433 ((symbolp element)
434 (push (symbol-name element) new-list))
435 ((numberp element)
436 (push (int-to-string element) new-list))
437 ((equal element ""))
438 ((stringp element)
439 (push element new-list))
440 ((listp element)
441 (setq new-list (nconc (mh-list-to-string-1 element) new-list)))
442 (t
443 (error "Bad element: %s" element))))
dda00b2c 444 new-list))
847b8219 445
c26cf6c8
RS
446\f
447
dda00b2c
BW
448;;; MH-E Process Support
449
450(defvar mh-index-max-cmdline-args 500
451 "Maximum number of command line args.")
c26cf6c8 452
dda00b2c
BW
453(defun mh-xargs (cmd &rest args)
454 "Partial imitation of xargs.
455The current buffer contains a list of strings, one on each line.
456The function will execute CMD with ARGS and pass the first
457`mh-index-max-cmdline-args' strings to it. This is repeated till
458all the strings have been used."
459 (goto-char (point-min))
460 (let ((current-buffer (current-buffer)))
461 (with-temp-buffer
462 (let ((out (current-buffer)))
463 (set-buffer current-buffer)
464 (while (not (eobp))
465 (let ((arg-list (reverse args))
466 (count 0))
467 (while (and (not (eobp)) (< count mh-index-max-cmdline-args))
d5dc8c56
BW
468 (push (buffer-substring-no-properties (point)
469 (mh-line-end-position))
dda00b2c
BW
470 arg-list)
471 (incf count)
472 (forward-line))
473 (apply #'call-process cmd nil (list out nil) nil
474 (nreverse arg-list))))
475 (erase-buffer)
476 (insert-buffer-substring out)))))
477
478;; XXX This should be applied anywhere MH-E calls out to /bin/sh.
479(defun mh-quote-for-shell (string)
480 "Quote STRING for /bin/sh.
481Adds double-quotes around entire string and quotes the characters
482\\, `, and $ with a backslash."
483 (concat "\""
484 (loop for x across string
485 concat (format (if (memq x '(?\\ ?` ?$)) "\\%c" "%c") x))
486 "\""))
487
488(defun mh-exec-cmd (command &rest args)
489 "Execute mh-command COMMAND with ARGS.
490The side effects are what is desired. Any output is assumed to be
491an error and is shown to the user. The output is not read or
492parsed by MH-E."
c26cf6c8 493 (save-excursion
dda00b2c
BW
494 (set-buffer (get-buffer-create mh-log-buffer))
495 (let* ((initial-size (mh-truncate-log-buffer))
496 (start (point))
497 (args (mh-list-to-string args)))
498 (apply 'call-process (expand-file-name command mh-progs) nil t nil args)
499 (when (> (buffer-size) initial-size)
500 (save-excursion
501 (goto-char start)
502 (insert "Errors when executing: " command)
503 (loop for arg in args do (insert " " arg))
504 (insert "\n"))
505 (save-window-excursion
506 (switch-to-buffer-other-window mh-log-buffer)
507 (sit-for 5))))))
508
509(defun mh-exec-cmd-error (env command &rest args)
510 "In environment ENV, execute mh-command COMMAND with ARGS.
511ENV is nil or a string of space-separated \"var=value\" elements.
512Signals an error if process does not complete successfully."
c26cf6c8 513 (save-excursion
dda00b2c
BW
514 (set-buffer (get-buffer-create mh-temp-buffer))
515 (erase-buffer)
516 (let ((process-environment process-environment))
517 ;; XXX: We should purge the list that split-string returns of empty
518 ;; strings. This can happen in XEmacs if leading or trailing spaces
519 ;; are present.
520 (dolist (elem (if (stringp env) (split-string env " ") ()))
521 (push elem process-environment))
522 (mh-handle-process-error
523 command (apply #'call-process (expand-file-name command mh-progs)
524 nil t nil (mh-list-to-string args))))))
525
526(defun mh-exec-cmd-daemon (command filter &rest args)
527 "Execute MH command COMMAND in the background.
528
529If FILTER is non-nil then it is used to process the output
530otherwise the default filter `mh-process-daemon' is used. See
531`set-process-filter' for more details of FILTER.
532
533ARGS are passed to COMMAND as command line arguments."
534 (save-excursion
535 (set-buffer (get-buffer-create mh-log-buffer))
536 (mh-truncate-log-buffer))
537 (let* ((process-connection-type nil)
538 (process (apply 'start-process
539 command nil
540 (expand-file-name command mh-progs)
541 (mh-list-to-string args))))
542 (set-process-filter process (or filter 'mh-process-daemon))
543 process))
544
545(defun mh-exec-cmd-env-daemon (env command filter &rest args)
546 "In ennvironment ENV, execute mh-command COMMAND in the background.
547
548ENV is nil or a string of space-separated \"var=value\" elements.
549Signals an error if process does not complete successfully.
550
551If FILTER is non-nil then it is used to process the output
552otherwise the default filter `mh-process-daemon' is used. See
553`set-process-filter' for more details of FILTER.
554
555ARGS are passed to COMMAND as command line arguments."
556 (let ((process-environment process-environment))
557 (dolist (elem (if (stringp env) (split-string env " ") ()))
558 (push elem process-environment))
559 (apply #'mh-exec-cmd-daemon command filter args)))
560
561(defun mh-process-daemon (process output)
562 "PROCESS daemon that puts OUTPUT into a temporary buffer.
563Any output from the process is displayed in an asynchronous
564pop-up window."
565 (with-current-buffer (get-buffer-create mh-log-buffer)
566 (insert-before-markers output)
567 (display-buffer mh-log-buffer)))
568
569(defun mh-exec-cmd-quiet (raise-error command &rest args)
570 "Signal RAISE-ERROR if COMMAND with ARGS fails.
571Execute MH command COMMAND with ARGS. ARGS is a list of strings.
572Return at start of mh-temp buffer, where output can be parsed and
573used.
574Returns value of `call-process', which is 0 for success, unless
575RAISE-ERROR is non-nil, in which case an error is signaled if
576`call-process' returns non-0."
577 (set-buffer (get-buffer-create mh-temp-buffer))
578 (erase-buffer)
579 (let ((value
580 (apply 'call-process
581 (expand-file-name command mh-progs) nil t nil
582 args)))
583 (goto-char (point-min))
584 (if raise-error
585 (mh-handle-process-error command value)
586 value)))
587
588(defun mh-exec-cmd-output (command display &rest args)
589 "Execute MH command COMMAND with DISPLAY flag and ARGS.
590Put the output into buffer after point.
591Set mark after inserted text.
592Output is expected to be shown to user, not parsed by MH-E."
593 (push-mark (point) t)
594 (apply 'call-process
595 (expand-file-name command mh-progs) nil t display
596 (mh-list-to-string args))
597
598 ;; The following is used instead of 'exchange-point-and-mark because the
599 ;; latter activates the current region (between point and mark), which
600 ;; turns on highlighting. So prior to this bug fix, doing "inc" would
601 ;; highlight a region containing the new messages, which is undesirable.
602 ;; The bug wasn't seen in emacs21 but still occurred in XEmacs21.4.
603 (mh-exchange-point-and-mark-preserving-active-mark))
604
605;; Shush compiler.
606(eval-when-compile (mh-do-in-xemacs (defvar mark-active)))
607
608(defun mh-exchange-point-and-mark-preserving-active-mark ()
609 "Put the mark where point is now, and point where the mark is now.
610This command works even when the mark is not active, and
611preserves whether the mark is active or not."
612 (interactive nil)
613 (let ((is-active (and (boundp 'mark-active) mark-active)))
614 (let ((omark (mark t)))
615 (if (null omark)
616 (error "No mark set in this buffer"))
617 (set-mark (point))
618 (goto-char omark)
619 (if (boundp 'mark-active)
620 (setq mark-active is-active))
621 nil)))
622
623(defun mh-exec-lib-cmd-output (command &rest args)
624 "Execute MH library command COMMAND with ARGS.
625Put the output into buffer after point.
626Set mark after inserted text."
627 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args))
628
629(defun mh-handle-process-error (command status)
630 "Raise error if COMMAND returned non-zero STATUS, otherwise return STATUS."
631 (if (equal status 0)
632 status
633 (goto-char (point-min))
634 (insert (if (integerp status)
635 (format "%s: exit code %d\n" command status)
636 (format "%s: %s\n" command status)))
637 (save-excursion
638 (let ((error-message (buffer-substring (point-min) (point-max))))
639 (set-buffer (get-buffer-create mh-log-buffer))
640 (mh-truncate-log-buffer)
641 (insert error-message)))
642 (error "%s failed, check buffer %s for error message"
643 command mh-log-buffer)))
644
645\f
646
fde155f4
BW
647;;; MH-E Customization Support Routines
648
649;; Shush compiler (Emacs 21 and XEmacs).
650(defvar customize-package-emacs-version-alist)
651
652;; Temporary function and data structure used customization.
653;; These will be unbound after the options are defined.
654(defmacro mh-strip-package-version (args)
655 "Strip :package-version keyword and its value from ARGS.
656In Emacs versions that support the :package-version keyword,
657ARGS is returned unchanged."
658 `(if (boundp 'customize-package-emacs-version-alist)
659 ,args
660 (let (seen)
661 (loop for keyword in ,args
662 if (cond ((eq keyword ':package-version) (setq seen t) nil)
663 (seen (setq seen nil) nil)
664 (t t))
665 collect keyword))))
666
667(defmacro mh-defgroup (symbol members doc &rest args)
668 "Declare SYMBOL as a customization group containing MEMBERS.
669See documentation for `defgroup' for a description of the arguments
670SYMBOL, MEMBERS, DOC and ARGS.
671This macro is used by Emacs versions that lack the :package-version
672keyword, introduced in Emacs 22."
673 (declare (doc-string 3))
674 `(defgroup ,symbol ,members ,doc ,@(mh-strip-package-version args)))
675(put 'mh-defgroup 'lisp-indent-function 'defun)
676
677(defmacro mh-defcustom (symbol value doc &rest args)
678 "Declare SYMBOL as a customizable variable that defaults to VALUE.
679See documentation for `defcustom' for a description of the arguments
680SYMBOL, VALUE, DOC and ARGS.
681This macro is used by Emacs versions that lack the :package-version
682keyword, introduced in Emacs 22."
683 (declare (doc-string 3))
684 `(defcustom ,symbol ,value ,doc ,@(mh-strip-package-version args)))
685(put 'mh-defcustom 'lisp-indent-function 'defun)
686
687(defmacro mh-defface (face spec doc &rest args)
688 "Declare FACE as a customizable face that defaults to SPEC.
689See documentation for `defface' for a description of the arguments
690FACE, SPEC, DOC and ARGS.
691This macro is used by Emacs versions that lack the :package-version
692keyword, introduced in Emacs 22."
693 (declare (doc-string 3))
694 `(defface ,face ,spec ,doc ,@(mh-strip-package-version args)))
695(put 'mh-defface 'lisp-indent-function 'defun)
696
697\f
698
dda00b2c
BW
699;;; Variant Support
700
fde155f4 701(mh-defcustom mh-path nil
dda00b2c
BW
702 "*Additional list of directories to search for MH.
703See `mh-variant'."
704 :group 'mh-e
fde155f4
BW
705 :type '(repeat (directory))
706 :package-version '(MH-E "8.0"))
dda00b2c
BW
707
708(defun mh-variants ()
709 "Return a list of installed variants of MH on the system.
710This function looks for MH in `mh-sys-path', `mh-path' and
711`exec-path'. The format of the list of variants that is returned
712is described by the variable `mh-variants'."
713 (if mh-variants
714 mh-variants
715 (let ((list-unique))
716 ;; Make a unique list of directories, keeping the given order.
717 ;; We don't want the same MH variant to be listed multiple times.
718 (loop for dir in (append mh-path mh-sys-path exec-path) do
719 (setq dir (file-chase-links (directory-file-name dir)))
720 (add-to-list 'list-unique dir))
721 (loop for dir in (nreverse list-unique) do
722 (when (and dir (file-directory-p dir) (file-readable-p dir))
723 (let ((variant (mh-variant-info dir)))
724 (if variant
725 (add-to-list 'mh-variants variant)))))
726 mh-variants)))
727
728(defun mh-variant-info (dir)
729 "Return MH variant found in DIR, or nil if none present."
3d7ca223 730 (save-excursion
dda00b2c
BW
731 (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
732 (set-buffer tmp-buffer)
733 (cond
734 ((mh-variant-mh-info dir))
735 ((mh-variant-nmh-info dir))
736 ((mh-variant-mu-mh-info dir))))))
737
738(defun mh-variant-mh-info (dir)
739 "Return info for MH variant in DIR assuming a temporary buffer is setup."
740 ;; MH does not have the -version option.
741 ;; Its version number is included in the output of "-help" as:
742 ;;
743 ;; version: MH 6.8.4 #2[UCI] (burrito) of Fri Jan 15 20:01:39 EST 1999
744 ;; options: [ATHENA] [BIND] [DUMB] [LIBLOCKFILE] [LOCALE] [MAILGROUP] [MHE]
745 ;; [MHRC] [MIME] [MORE='"/usr/bin/sensible-pager"'] [NLINK_HACK]
746 ;; [NORUSERPASS] [OVERHEAD] [POP] [POPSERVICE='"pop-3"'] [RENAME]
747 ;; [RFC1342] [RPATHS] [RPOP] [SENDMTS] [SMTP] [SOCKETS]
748 ;; [SPRINTFTYPE=int] [SVR4] [SYS5] [SYS5DIR] [TERMINFO]
749 ;; [TYPESIG=void] [UNISTD] [UTK] [VSPRINTF]
750 (let ((mhparam (expand-file-name "mhparam" dir)))
751 (when (mh-file-command-p mhparam)
752 (erase-buffer)
753 (call-process mhparam nil '(t nil) nil "-help")
754 (goto-char (point-min))
755 (when (search-forward-regexp "version: MH \\(\\S +\\)" nil t)
756 (let ((version (format "MH %s" (match-string 1))))
757 (erase-buffer)
758 (call-process mhparam nil '(t nil) nil "libdir")
759 (goto-char (point-min))
760 (when (search-forward-regexp "^.*$" nil t)
761 (let ((libdir (match-string 0)))
762 `(,version
763 (variant mh)
764 (mh-lib-progs ,libdir)
765 (mh-lib ,libdir)
766 (mh-progs ,dir)
767 (flists nil)))))))))
768
769(defun mh-variant-mu-mh-info (dir)
770 "Return info for GNU mailutils variant in DIR.
771This assumes that a temporary buffer is setup."
772 ;; 'mhparam -version' output:
773 ;; mhparam (GNU mailutils 0.3.2)
774 (let ((mhparam (expand-file-name "mhparam" dir)))
775 (when (mh-file-command-p mhparam)
776 (erase-buffer)
777 (call-process mhparam nil '(t nil) nil "-version")
778 (goto-char (point-min))
779 (when (search-forward-regexp "mhparam (\\(GNU [Mm]ailutils \\S +\\))"
780 nil t)
781 (let ((version (match-string 1))
782 (mh-progs dir))
783 `(,version
784 (variant mu-mh)
785 (mh-lib-progs ,(mh-profile-component "libdir"))
786 (mh-lib ,(mh-profile-component "etcdir"))
787 (mh-progs ,dir)
788 (flists ,(file-exists-p
789 (expand-file-name "flists" dir)))))))))
790
791(defun mh-variant-nmh-info (dir)
792 "Return info for nmh variant in DIR assuming a temporary buffer is setup."
793 ;; `mhparam -version' outputs:
794 ;; mhparam -- nmh-1.1-RC1 [compiled on chaak at Fri Jun 20 11:03:28 PDT 2003]
795 (let ((mhparam (expand-file-name "mhparam" dir)))
796 (when (mh-file-command-p mhparam)
797 (erase-buffer)
798 (call-process mhparam nil '(t nil) nil "-version")
799 (goto-char (point-min))
800 (when (search-forward-regexp "mhparam -- nmh-\\(\\S +\\)" nil t)
801 (let ((version (format "nmh %s" (match-string 1)))
802 (mh-progs dir))
803 `(,version
804 (variant nmh)
805 (mh-lib-progs ,(mh-profile-component "libdir"))
806 (mh-lib ,(mh-profile-component "etcdir"))
807 (mh-progs ,dir)
808 (flists ,(file-exists-p
809 (expand-file-name "flists" dir)))))))))
810
811(defun mh-file-command-p (file)
812 "Return t if file FILE is the name of a executable regular file."
813 (and (file-regular-p file) (file-executable-p file)))
814
815(defun mh-variant-set-variant (variant)
816 "Setup the system variables for the MH variant named VARIANT.
817If VARIANT is a string, use that key in the alist returned by the
818function `mh-variants'.
819If VARIANT is a symbol, select the first entry that matches that
820variant."
821 (cond
822 ((stringp variant) ;e.g. "nmh 1.1-RC1"
823 (when (assoc variant (mh-variants))
824 (let* ((alist (cdr (assoc variant (mh-variants))))
825 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
826 (lib (cadr (assoc 'mh-lib alist)))
827 (progs (cadr (assoc 'mh-progs alist)))
828 (flists (cadr (assoc 'flists alist))))
829 ;;(set-default mh-variant variant)
830 (setq mh-x-mailer-string nil
831 mh-flists-present-flag flists
832 mh-lib-progs lib-progs
833 mh-lib lib
834 mh-progs progs
835 mh-variant-in-use variant))))
836 ((symbolp variant) ;e.g. 'nmh (pick the first match)
837 (loop for variant-list in (mh-variants)
838 when (eq variant (cadr (assoc 'variant (cdr variant-list))))
839 return (let* ((version (car variant-list))
840 (alist (cdr variant-list))
841 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
842 (lib (cadr (assoc 'mh-lib alist)))
843 (progs (cadr (assoc 'mh-progs alist)))
844 (flists (cadr (assoc 'flists alist))))
845 ;;(set-default mh-variant flavor)
846 (setq mh-x-mailer-string nil
847 mh-flists-present-flag flists
848 mh-lib-progs lib-progs
849 mh-lib lib
850 mh-progs progs
851 mh-variant-in-use version)
852 t)))))
853
854(defun mh-variant-p (&rest variants)
855 "Return t if variant is any of VARIANTS.
856Currently known variants are 'MH, 'nmh, and 'mu-mh."
857 (let ((variant-in-use
858 (cadr (assoc 'variant (assoc mh-variant-in-use (mh-variants))))))
859 (not (null (member variant-in-use variants)))))
860
861(defun mh-profile-component (component)
862 "Return COMPONENT value from mhparam, or nil if unset."
863 (save-excursion
0c32f8c6
BW
864 ;; MH and nmh use -components, Mailutils uses -component. Since MH
865 ;; and nmh work with an unambiguous prefix, the `s' is dropped here.
866 (mh-exec-cmd-quiet nil "mhparam" "-component" component)
dda00b2c
BW
867 (mh-profile-component-value component)))
868
869(defun mh-profile-component-value (component)
870 "Find and return the value of COMPONENT in the current buffer.
871Returns nil if the component is not in the buffer."
872 (let ((case-fold-search t))
873 (goto-char (point-min))
874 (cond ((not (re-search-forward (format "^%s:" component) nil t)) nil)
875 ((looking-at "[\t ]*$") nil)
3d7ca223 876 (t
dda00b2c
BW
877 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t)
878 (let ((start (match-beginning 1)))
879 (end-of-line)
880 (buffer-substring start (point)))))))
881
882(defun mh-variant-set (variant)
883 "Set the MH variant to VARIANT.
884Sets `mh-progs', `mh-lib', `mh-lib-progs' and
885`mh-flists-present-flag'.
886If the VARIANT is \"autodetect\", then first try nmh, then MH and
887finally GNU mailutils."
888 (interactive
889 (list (completing-read
890 "MH variant: "
891 (mapcar (lambda (x) (list (car x))) (mh-variants))
892 nil t)))
893 (let ((valid-list (mapcar (lambda (x) (car x)) (mh-variants))))
894 (cond
895 ((eq variant 'none))
896 ((eq variant 'autodetect)
897 (cond
898 ((mh-variant-set-variant 'nmh)
899 (message "%s installed as MH variant" mh-variant-in-use))
900 ((mh-variant-set-variant 'mh)
901 (message "%s installed as MH variant" mh-variant-in-use))
902 ((mh-variant-set-variant 'mu-mh)
903 (message "%s installed as MH variant" mh-variant-in-use))
904 (t
905 (message "No MH variant found on the system"))))
906 ((member variant valid-list)
907 (when (not (mh-variant-set-variant variant))
908 (message "Warning: %s variant not found. Autodetecting..." variant)
909 (mh-variant-set 'autodetect)))
910 (t
911 (message "Unknown variant; use %s"
912 (mapconcat '(lambda (x) (format "%s" (car x)))
913 (mh-variants) " or "))))))
914
fde155f4 915(mh-defcustom mh-variant 'autodetect
dda00b2c
BW
916 "*Specifies the variant used by MH-E.
917
918The default setting of this option is \"Auto-detect\" which means
919that MH-E will automatically choose the first of nmh, MH, or GNU
920mailutils that it finds in the directories listed in
921`mh-path' (which you can customize), `mh-sys-path', and
bc4c8031
BW
922`exec-path'. If MH-E can't find MH at all, you may have to
923customize `mh-path' and add the directory in which the command
924\"mhparam\" is located. If, on the other hand, you have both nmh
925and mailutils installed (for example) and `mh-variant-in-use' was
926initialized to nmh but you want to use mailutils, then you can
927set this option to \"mailutils\".
dda00b2c
BW
928
929When this variable is changed, MH-E resets `mh-progs', `mh-lib',
930`mh-lib-progs', `mh-flists-present-flag', and `mh-variant-in-use'
bc4c8031
BW
931accordingly. Prior to version 8, it was often necessary to set
932some of these variables in \"~/.emacs\"; now it is no longer
933necessary and can actually cause problems."
dda00b2c
BW
934 :type `(radio
935 (const :tag "Auto-detect" autodetect)
936 ,@(mapcar (lambda (x) `(const ,(car x))) (mh-variants)))
937 :set (lambda (symbol value)
938 (set-default symbol value) ;Done in mh-variant-set-variant!
939 (mh-variant-set value))
fde155f4
BW
940 :group 'mh-e
941 :package-version '(MH-E "8.0"))
23347d76 942
23347d76
BW
943\f
944
dda00b2c 945;;; MH-E Customization
c26cf6c8 946
dda00b2c
BW
947;; All of the defgroups, defcustoms, and deffaces in MH-E are found
948;; here. This makes it possible to customize modules that aren't
949;; loaded yet. It also makes it easier to organize the customization
950;; groups.
a66894d8 951
dda00b2c
BW
952;; This section contains the following sub-sections:
953
954;; 1. MH-E Customization Groups
955
956;; These are the customization group definitions. Every group has a
957;; associated manual node. The ordering is alphabetical, except for
958;; the groups mh-faces and mh-hooks which are last .
959
960;; 2. MH-E Customization
961
962;; These are the actual customization variables. There is a
963;; sub-section for each group in the MH-E Customization Groups
964;; section, in the same order, separated by page breaks. Within
965;; each section, variables are sorted alphabetically.
966
967;; 3. Hooks
968
969;; All hooks must be placed in the mh-hook group; in addition, add
970;; the group associated with the manual node in which the hook is
971;; described. Since the mh-hook group appears near the end of this
972;; section, the hooks will appear at the end of these other groups.
973
974;; 4. Faces
975
976;; All faces must be placed in the mh-faces group; in addition, add
977;; the group associated with the manual node in which the face is
978;; described. Since the mh-faces group appears near the end of this
979;; section, the faces will appear at the end of these other groups.
980
981(defun mh-customize (&optional delete-other-windows-flag)
982 "Customize MH-E variables.
983If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other
984windows in the frame are removed."
985 (interactive "P")
986 (customize-group 'mh-e)
987 (when delete-other-windows-flag
988 (delete-other-windows)))
c26cf6c8 989
23347d76
BW
990(if (boundp 'customize-package-emacs-version-alist)
991 (add-to-list 'customize-package-emacs-version-alist
992 '(MH-E ("6.0" "22.1") ("6.1" "22.1") ("7.0" "22.1")
993 ("7.1" "22.1") ("7.2" "22.1") ("7.3" "22.1")
994 ("7.4" "22.1") ("8.0" "22.1"))))
995
bdcfe844
BW
996\f
997
dda00b2c
BW
998;;; MH-E Customization Groups
999
23347d76 1000(mh-defgroup mh-e nil
dda00b2c
BW
1001 "Emacs interface to the MH mail system.
1002MH is the Rand Mail Handler. Other implementations include nmh
1003and GNU mailutils."
1004 :link '(custom-manual "(mh-e)Top")
23347d76
BW
1005 :group 'mail
1006 :package-version '(MH-E "8.0"))
dda00b2c 1007
23347d76 1008(mh-defgroup mh-alias nil
dda00b2c
BW
1009 "Aliases."
1010 :link '(custom-manual "(mh-e)Aliases")
1011 :prefix "mh-alias-"
23347d76
BW
1012 :group 'mh-e
1013 :package-version '(MH-E "7.1"))
dda00b2c 1014
23347d76 1015(mh-defgroup mh-folder nil
dda00b2c
BW
1016 "Organizing your mail with folders."
1017 :prefix "mh-"
1018 :link '(custom-manual "(mh-e)Folders")
23347d76
BW
1019 :group 'mh-e
1020 :package-version '(MH-E "7.1"))
dda00b2c 1021
23347d76 1022(mh-defgroup mh-folder-selection nil
dda00b2c
BW
1023 "Folder selection."
1024 :prefix "mh-"
1025 :link '(custom-manual "(mh-e)Folder Selection")
23347d76
BW
1026 :group 'mh-e
1027 :package-version '(MH-E "8.0"))
dda00b2c 1028
23347d76 1029(mh-defgroup mh-identity nil
dda00b2c
BW
1030 "Identities."
1031 :link '(custom-manual "(mh-e)Identities")
1032 :prefix "mh-identity-"
23347d76
BW
1033 :group 'mh-e
1034 :package-version '(MH-E "7.1"))
dda00b2c 1035
23347d76 1036(mh-defgroup mh-inc nil
dda00b2c
BW
1037 "Incorporating your mail."
1038 :prefix "mh-inc-"
1039 :link '(custom-manual "(mh-e)Incorporating Mail")
23347d76
BW
1040 :group 'mh-e
1041 :package-version '(MH-E "8.0"))
dda00b2c 1042
23347d76 1043(mh-defgroup mh-junk nil
dda00b2c
BW
1044 "Dealing with junk mail."
1045 :link '(custom-manual "(mh-e)Junk")
1046 :prefix "mh-junk-"
23347d76
BW
1047 :group 'mh-e
1048 :package-version '(MH-E "7.3"))
dda00b2c 1049
23347d76 1050(mh-defgroup mh-letter nil
dda00b2c
BW
1051 "Editing a draft."
1052 :prefix "mh-"
1053 :link '(custom-manual "(mh-e)Editing Drafts")
23347d76
BW
1054 :group 'mh-e
1055 :package-version '(MH-E "7.1"))
dda00b2c 1056
23347d76 1057(mh-defgroup mh-ranges nil
dda00b2c
BW
1058 "Ranges."
1059 :prefix "mh-"
1060 :link '(custom-manual "(mh-e)Ranges")
23347d76
BW
1061 :group 'mh-e
1062 :package-version '(MH-E "8.0"))
dda00b2c 1063
23347d76 1064(mh-defgroup mh-scan-line-formats nil
dda00b2c
BW
1065 "Scan line formats."
1066 :link '(custom-manual "(mh-e)Scan Line Formats")
1067 :prefix "mh-"
23347d76
BW
1068 :group 'mh-e
1069 :package-version '(MH-E "8.0"))
dda00b2c 1070
23347d76 1071(mh-defgroup mh-search nil
dda00b2c
BW
1072 "Searching."
1073 :link '(custom-manual "(mh-e)Searching")
1074 :prefix "mh-search-"
23347d76
BW
1075 :group 'mh-e
1076 :package-version '(MH-E "8.0"))
dda00b2c 1077
23347d76 1078(mh-defgroup mh-sending-mail nil
dda00b2c
BW
1079 "Sending mail."
1080 :prefix "mh-"
1081 :link '(custom-manual "(mh-e)Sending Mail")
23347d76
BW
1082 :group 'mh-e
1083 :package-version '(MH-E "8.0"))
dda00b2c 1084
23347d76 1085(mh-defgroup mh-sequences nil
dda00b2c
BW
1086 "Sequences."
1087 :prefix "mh-"
1088 :link '(custom-manual "(mh-e)Sequences")
23347d76
BW
1089 :group 'mh-e
1090 :package-version '(MH-E "8.0"))
dda00b2c 1091
23347d76 1092(mh-defgroup mh-show nil
dda00b2c
BW
1093 "Reading your mail."
1094 :prefix "mh-"
1095 :link '(custom-manual "(mh-e)Reading Mail")
23347d76
BW
1096 :group 'mh-e
1097 :package-version '(MH-E "7.1"))
dda00b2c 1098
23347d76 1099(mh-defgroup mh-speedbar nil
dda00b2c
BW
1100 "The speedbar."
1101 :prefix "mh-speed-"
1102 :link '(custom-manual "(mh-e)Speedbar")
23347d76
BW
1103 :group 'mh-e
1104 :package-version '(MH-E "8.0"))
dda00b2c 1105
23347d76 1106(mh-defgroup mh-thread nil
dda00b2c
BW
1107 "Threading."
1108 :prefix "mh-thread-"
1109 :link '(custom-manual "(mh-e)Threading")
23347d76
BW
1110 :group 'mh-e
1111 :package-version '(MH-E "8.0"))
dda00b2c 1112
23347d76 1113(mh-defgroup mh-tool-bar nil
dda00b2c
BW
1114 "The tool bar"
1115 :link '(custom-manual "(mh-e)Tool Bar")
1116 :prefix "mh-"
23347d76
BW
1117 :group 'mh-e
1118 :package-version '(MH-E "8.0"))
dda00b2c 1119
23347d76 1120(mh-defgroup mh-hooks nil
dda00b2c
BW
1121 "MH-E hooks."
1122 :link '(custom-manual "(mh-e)Top")
1123 :prefix "mh-"
23347d76
BW
1124 :group 'mh-e
1125 :package-version '(MH-E "7.1"))
dda00b2c 1126
23347d76 1127(mh-defgroup mh-faces nil
dda00b2c
BW
1128 "Faces used in MH-E."
1129 :link '(custom-manual "(mh-e)Top")
1130 :prefix "mh-"
1131 :group 'faces
23347d76
BW
1132 :group 'mh-e
1133 :package-version '(MH-E "7.1"))
bdcfe844
BW
1134
1135\f
1136
23347d76 1137;;; MH-E Customization
dda00b2c 1138
23347d76 1139;; See Variant Support, above, for mh-e group.
dda00b2c
BW
1140
1141;;; Aliases (:group 'mh-alias)
1142
23347d76 1143(mh-defcustom mh-alias-completion-ignore-case-flag t
dda00b2c
BW
1144 "*Non-nil means don't consider case significant in MH alias completion.
1145
1146As MH ignores case in the aliases, so too does MH-E. However, you
1147may turn off this option to make case significant which can be
1148used to segregate completion of your aliases. You might use
1149lowercase for mailing lists and uppercase for people."
1150 :type 'boolean
23347d76
BW
1151 :group 'mh-alias
1152 :package-version '(MH-E "7.1"))
dda00b2c 1153
23347d76 1154(mh-defcustom mh-alias-expand-aliases-flag nil
dda00b2c
BW
1155 "*Non-nil means to expand aliases entered in the minibuffer.
1156
1157In other words, aliases entered in the minibuffer will be
1158expanded to the full address in the message draft. By default,
1159this expansion is not performed."
1160 :type 'boolean
23347d76
BW
1161 :group 'mh-alias
1162 :package-version '(MH-E "7.1"))
dda00b2c 1163
23347d76 1164(mh-defcustom mh-alias-flash-on-comma t
dda00b2c
BW
1165 "*Specify whether to flash address or warn on translation.
1166
1167This option controls the behavior when a [comma] is pressed while
1168entering aliases or addresses. The default setting flashes the
1169address associated with an address in the minibuffer briefly, but
1170does not display a warning if the alias is not found."
1171 :type '(choice (const :tag "Flash but Don't Warn If No Alias" t)
1172 (const :tag "Flash and Warn If No Alias" 1)
1173 (const :tag "Don't Flash Nor Warn If No Alias" nil))
23347d76
BW
1174 :group 'mh-alias
1175 :package-version '(MH-E "7.1"))
dda00b2c 1176
23347d76 1177(mh-defcustom mh-alias-insert-file nil
dda00b2c
BW
1178 "*Filename used to store a new MH-E alias.
1179
1180The default setting of this option is \"Use Aliasfile Profile
1181Component\". This option can also hold the name of a file or a
1182list a file names. If this option is set to a list of file names,
1183or the \"Aliasfile:\" profile component contains more than one file
1184name, MH-E will prompt for one of them when MH-E adds an alias."
1185 :type '(choice (const :tag "Use Aliasfile Profile Component" nil)
1186 (file :tag "Alias File")
1187 (repeat :tag "List of Alias Files" file))
23347d76
BW
1188 :group 'mh-alias
1189 :package-version '(MH-E "7.1"))
dda00b2c 1190
23347d76 1191(mh-defcustom mh-alias-insertion-location 'sorted
dda00b2c
BW
1192 "Specifies where new aliases are entered in alias files.
1193
1194This option is set to \"Alphabetical\" by default. If you organize
1195your alias file in other ways, then adding aliases to the \"Top\"
1196or \"Bottom\" of your alias file might be more appropriate."
1197 :type '(choice (const :tag "Alphabetical" sorted)
1198 (const :tag "Top" top)
1199 (const :tag "Bottom" bottom))
23347d76
BW
1200 :group 'mh-alias
1201 :package-version '(MH-E "7.1"))
dda00b2c 1202
23347d76 1203(mh-defcustom mh-alias-local-users t
dda00b2c
BW
1204 "*If on, local users are added to alias completion.
1205
1206Aliases are created from \"/etc/passwd\" entries with a user ID
1207larger than a magical number, typically 200. This can be a handy
1208tool on a machine where you and co-workers exchange messages.
1209These aliases have the form \"local.first.last\" if a real name is
1210present in the password file. Otherwise, the alias will have the
1211form \"local.login\".
1212
1213If you're on a system with thousands of users you don't know, and
1214the loading of local aliases slows MH-E down noticeably, then
1215turn this option off.
1216
1217This option also takes a string which is executed to generate the
1218password file. For example, use \"ypcat passwd\" to obtain the
1219NIS password file."
1220 :type '(choice (boolean) (string))
23347d76
BW
1221 :group 'mh-alias
1222 :package-version '(MH-E "7.1"))
dda00b2c 1223
23347d76 1224(mh-defcustom mh-alias-local-users-prefix "local."
dda00b2c
BW
1225 "*String prefixed to the real names of users from the password file.
1226This option can also be set to \"Use Login\".
1227
1228For example, consider the following password file entry:
1229
1230 psg:x:1000:1000:Peter S Galbraith,,,:/home/psg:/bin/tcsh
1231
1232The following settings of this option will produce the associated
1233aliases:
1234
1235 \"local.\" local.peter.galbraith
1236 \"\" peter.galbraith
1237 Use Login psg
1238
1239This option has no effect if variable `mh-alias-local-users' is
1240turned off."
1241 :type '(choice (const :tag "Use Login" nil)
1242 (string))
23347d76
BW
1243 :group 'mh-alias
1244 :package-version '(MH-E "7.4"))
dda00b2c 1245
23347d76 1246(mh-defcustom mh-alias-passwd-gecos-comma-separator-flag t
dda00b2c
BW
1247 "*Non-nil means the gecos field in the password file uses a comma separator.
1248
1249In the example in `mh-alias-local-users-prefix', commas are used
1250to separate different values within the so-called gecos field.
1251This is a fairly common usage. However, in the rare case that the
1252gecos field in your password file is not separated by commas and
1253whose contents may contain commas, you can turn this option off."
1254 :type 'boolean
23347d76
BW
1255 :group 'mh-alias
1256 :package-version '(MH-E "7.4"))
7094eefe 1257
dda00b2c
BW
1258;;; Organizing Your Mail with Folders (:group 'mh-folder)
1259
23347d76 1260(mh-defcustom mh-new-messages-folders t
dda00b2c
BW
1261 "Folders searched for the \"unseen\" sequence.
1262
1263Set this option to \"Inbox\" to search the \"+inbox\" folder or
1264\"All\" to search all of the top level folders. Otherwise, list
1265the folders that should be searched with the \"Choose Folders\"
1266menu item.
1267
1268See also `mh-recursive-folders-flag'."
1269 :type '(choice (const :tag "Inbox" t)
1270 (const :tag "All" nil)
1271 (repeat :tag "Choose Folders" (string :tag "Folder")))
23347d76
BW
1272 :group 'mh-folder
1273 :package-version '(MH-E "8.0"))
dda00b2c 1274
23347d76 1275(mh-defcustom mh-ticked-messages-folders t
dda00b2c
BW
1276 "Folders searched for `mh-tick-seq'.
1277
1278Set this option to \"Inbox\" to search the \"+inbox\" folder or
1279\"All\" to search all of the top level folders. Otherwise, list
1280the folders that should be searched with the \"Choose Folders\"
1281menu item.
1282
1283See also `mh-recursive-folders-flag'."
1284 :type '(choice (const :tag "Inbox" t)
1285 (const :tag "All" nil)
1286 (repeat :tag "Choose Folders" (string :tag "Folder")))
23347d76
BW
1287 :group 'mh-folder
1288 :package-version '(MH-E "8.0"))
dda00b2c 1289
23347d76 1290(mh-defcustom mh-large-folder 200
dda00b2c
BW
1291 "The number of messages that indicates a large folder.
1292
1293If a folder is deemed to be large, that is the number of messages
1294in it exceed this value, then confirmation is needed when it is
1295visited. Even when `mh-show-threads-flag' is non-nil, the folder
1296is not automatically threaded, if it is large. If set to nil all
1297folders are treated as if they are small."
1298 :type '(choice (const :tag "No Limit") integer)
23347d76
BW
1299 :group 'mh-folder
1300 :package-version '(MH-E "7.0"))
dda00b2c 1301
23347d76 1302(mh-defcustom mh-recenter-summary-flag nil
dda00b2c
BW
1303 "*Non-nil means to recenter the summary window.
1304
1305If this option is turned on, recenter the summary window when the
1306show window is toggled off."
1307 :type 'boolean
23347d76
BW
1308 :group 'mh-folder
1309 :package-version '(MH-E "7.0"))
dda00b2c 1310
23347d76 1311(mh-defcustom mh-recursive-folders-flag nil
dda00b2c
BW
1312 "*Non-nil means that commands which operate on folders do so recursively."
1313 :type 'boolean
23347d76
BW
1314 :group 'mh-folder
1315 :package-version '(MH-E "7.0"))
dda00b2c 1316
23347d76 1317(mh-defcustom mh-sortm-args nil
dda00b2c
BW
1318 "*Additional arguments for \"sortm\"\\<mh-folder-mode-map>.
1319
1320This option is consulted when a prefix argument is used with
1321\\[mh-sort-folder]. Normally default arguments to \"sortm\" are
1322specified in the MH profile. This option may be used to provide
1323an alternate view. For example, \"'(\"-nolimit\" \"-textfield\"
1324\"subject\")\" is a useful setting."
1325 :type 'string
23347d76
BW
1326 :group 'mh-folder
1327 :package-version '(MH-E "8.0"))
dda00b2c
BW
1328
1329;;; Folder Selection (:group 'mh-folder-selection)
1330
23347d76 1331(mh-defcustom mh-default-folder-for-message-function nil
dda00b2c
BW
1332 "Function to select a default folder for refiling or \"Fcc:\".
1333
bc4c8031
BW
1334When this function is called, the current buffer contains the message
1335being refiled and point is at the start of the message. This function
1336should return the default folder as a string with a leading \"+\"
1337sign. It can also return nil so that the last folder name is used as
1338the default, or an empty string to suppress the default entirely."
dda00b2c 1339 :type 'function
23347d76
BW
1340 :group 'mh-folder-selection
1341 :package-version '(MH-E "8.0"))
dda00b2c 1342
23347d76 1343(mh-defcustom mh-default-folder-list nil
dda00b2c
BW
1344 "*List of addresses and folders.
1345
1346The folder name associated with the first address found in this
1347list is used as the default for `mh-refile-msg' and similar
1348functions. Each element in this list contains a \"Check Recipient\"
1349item. If this item is turned on, then the address is checked
1350against the recipient instead of the sender. This is useful for
1351mailing lists.
1352
1353See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
1354for more information."
1355 :type '(repeat (list (regexp :tag "Address")
1356 (string :tag "Folder")
1357 (boolean :tag "Check Recipient")))
23347d76
BW
1358 :group 'mh-folder-selection
1359 :package-version '(MH-E "7.2"))
dda00b2c 1360
23347d76 1361(mh-defcustom mh-default-folder-must-exist-flag t
dda00b2c
BW
1362 "*Non-nil means guessed folder name must exist to be used.
1363
1364If the derived folder does not exist, and this option is on, then
1365the last folder name used is suggested. This is useful if you get
1366mail from various people for whom you have an alias, but file
1367them all in the same project folder.
1368
1369See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
1370for more information."
1371 :type 'boolean
23347d76
BW
1372 :group 'mh-folder-selection
1373 :package-version '(MH-E "7.2"))
dda00b2c 1374
23347d76 1375(mh-defcustom mh-default-folder-prefix ""
dda00b2c
BW
1376 "*Prefix used for folder names generated from aliases.
1377The prefix is used to prevent clutter in your mail directory.
1378
1379See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
1380for more information."
1381 :type 'string
23347d76
BW
1382 :group 'mh-folder-selection
1383 :package-version '(MH-E "7.2"))
c26cf6c8 1384
dda00b2c
BW
1385;;; Identities (:group 'mh-identity)
1386
1387(eval-and-compile
1388 (unless (fboundp 'mh-identity-make-menu-no-autoload)
1389 (defun mh-identity-make-menu-no-autoload ()
1390 "Temporary definition.
1391Real definition will take effect when mh-identity is loaded."
1392 nil)))
1393
23347d76 1394(mh-defcustom mh-identity-list nil
dda00b2c
BW
1395 "*List of identities.
1396
1397To customize this option, click on the \"INS\" button and enter a label
1398such as \"Home\" or \"Work\". Then click on the \"INS\" button with the
1399label \"Add at least one item below\". Then choose one of the items in
1400the \"Value Menu\".
1401
1402You can specify an alternate \"From:\" header field using the \"From
1403Field\" menu item. You must include a valid email address. A standard
1404format is \"First Last <login@@host.domain>\". If you use an initial
1405with a period, then you must quote your name as in '\"First I. Last\"
1406<login@@host.domain>'. People usually list the name of the company
1407where they work using the \"Organization Field\" menu item. Set any
1408arbitrary header field and value in the \"Other Field\" menu item.
1409Unless the header field is a standard one, precede the name of your
1410field's label with \"X-\", as in \"X-Fruit-of-the-Day:\". The value of
1411\"Attribution Verb\" overrides the setting of
1412`mh-extract-from-attribution-verb'. Set your signature with the
1413\"Signature\" menu item. You can specify the contents of
1414`mh-signature-file-name', a file, or a function. Specify a different
1415key to sign or encrypt messages with the \"GPG Key ID\" menu item.
1416
1417You can select the identities you have added via the menu called
1418\"Identity\" in the MH-Letter buffer. You can also use
1419\\[mh-insert-identity]. To clear the fields and signature added by the
1420identity, select the \"None\" identity.
1421
1422The \"Identity\" menu contains two other items to save you from having
1423to set the identity on every message. The menu item \"Set Default for
1424Session\" can be used to set the default identity to the current
1425identity until you exit Emacs. The menu item \"Save as Default\" sets
1426the option `mh-identity-default' to the current identity setting. You
1427can also customize the `mh-identity-default' option in the usual
1428fashion."
1429 :type '(repeat (list :tag ""
1430 (string :tag "Label")
1431 (repeat :tag "Add at least one item below"
1432 (choice
1433 (cons :tag "From Field"
1434 (const "From")
1435 (string :tag "Value"))
1436 (cons :tag "Organization Field"
1437 (const "Organization")
1438 (string :tag "Value"))
1439 (cons :tag "Other Field"
1440 (string :tag "Field")
1441 (string :tag "Value"))
1442 (cons :tag "Attribution Verb"
1443 (const ":attribution-verb")
1444 (string :tag "Value"))
1445 (cons :tag "Signature"
1446 (const :tag "Signature"
1447 ":signature")
1448 (choice
1449 (const :tag "mh-signature-file-name"
1450 nil)
1451 (file)
1452 (function)))
1453 (cons :tag "GPG Key ID"
1454 (const :tag "GPG Key ID"
1455 ":pgg-default-user-id")
1456 (string :tag "Value"))))))
1457 :set (lambda (symbol value)
1458 (set-default symbol value)
1459 (mh-identity-make-menu-no-autoload))
23347d76
BW
1460 :group 'mh-identity
1461 :package-version '(MH-E "7.1"))
dda00b2c 1462
23347d76 1463(mh-defcustom mh-auto-fields-list nil
dda00b2c
BW
1464 "List of recipients for which header lines are automatically inserted.
1465
1466This option can be used to set the identity depending on the
1467recipient. To customize this option, click on the \"INS\" button and
1468enter a regular expression for the recipient's address. Click on the
1469\"INS\" button with the \"Add at least one item below\" label. Then choose
1470one of the items in the \"Value Menu\".
1471
1472The \"Identity\" menu item is used to select an identity from those
1473configured in `mh-identity-list'. All of the information for that
1474identity will be added if the recipient matches. The \"Fcc Field\" menu
1475item is used to select a folder that is used in the \"Fcc:\" header.
1476When you send the message, MH will put a copy of your message in this
1477folder. The \"Mail-Followup-To Field\" menu item is used to insert an
1478\"Mail-Followup-To:\" header field with the recipients you provide. If
1479the recipient's mail user agent supports this header field (as nmh
1480does), then their replies will go to the addresses listed. This is
1481useful if their replies go both to the list and to you and you don't
1482have a mechanism to suppress duplicates. If you reply to someone not
1483on the list, you must either remove the \"Mail-Followup-To:\" field, or
1484ensure the recipient is also listed there so that he receives replies
1485to your reply. Other header fields may be added using the \"Other
1486Field\" menu item.
1487
1488These fields can only be added after the recipient is known. Once the
1489header contains one or more recipients, run the
1490\\[mh-insert-auto-fields] command or choose the \"Identity -> Insert
1491Auto Fields\" menu item to insert these fields manually. However, you
1492can just send the message and the fields will be added automatically.
1493You are given a chance to see these fields and to confirm them before
1494the message is actually sent. You can do away with this confirmation
1495by turning off the option `mh-auto-fields-prompt-flag'.
1496
1497You should avoid using the same header field in `mh-auto-fields-list'
1498and `mh-identity-list' definitions that may apply to the same message
1499as the result is undefined."
1500 :type `(repeat
1501 (list :tag ""
1502 (string :tag "Recipient")
1503 (repeat :tag "Add at least one item below"
1504 (choice
1505 (cons :tag "Identity"
1506 (const ":identity")
1507 ,(append
1508 '(radio)
1509 (mapcar
1510 (function (lambda (arg) `(const ,arg)))
1511 (mapcar 'car mh-identity-list))))
1512 (cons :tag "Fcc Field"
1513 (const "fcc")
1514 (string :tag "Value"))
1515 (cons :tag "Mail-Followup-To Field"
1516 (const "Mail-Followup-To")
1517 (string :tag "Value"))
1518 (cons :tag "Other Field"
1519 (string :tag "Field")
1520 (string :tag "Value"))))))
23347d76
BW
1521 :group 'mh-identity
1522 :package-version '(MH-E "7.3"))
dda00b2c 1523
23347d76 1524(mh-defcustom mh-auto-fields-prompt-flag t
dda00b2c
BW
1525 "*Non-nil means to prompt before sending if fields inserted.
1526See `mh-auto-fields-list'."
1527 :type 'boolean
23347d76
BW
1528 :group 'mh-identity
1529 :package-version '(MH-E "8.0"))
dda00b2c 1530
23347d76 1531(mh-defcustom mh-identity-default nil
dda00b2c
BW
1532 "Default identity to use when `mh-letter-mode' is called.
1533See `mh-identity-list'."
1534 :type (append
1535 '(radio)
1536 (cons '(const :tag "None" nil)
1537 (mapcar (function (lambda (arg) `(const ,arg)))
1538 (mapcar 'car mh-identity-list))))
23347d76
BW
1539 :group 'mh-identity
1540 :package-version '(MH-E "7.1"))
dda00b2c 1541
23347d76 1542(mh-defcustom mh-identity-handlers
dda00b2c
BW
1543 '(("From" . mh-identity-handler-top)
1544 (":default" . mh-identity-handler-bottom)
1545 (":attribution-verb" . mh-identity-handler-attribution-verb)
1546 (":signature" . mh-identity-handler-signature)
1547 (":pgg-default-user-id" . mh-identity-handler-gpg-identity))
1548 "Handler functions for fields in `mh-identity-list'.
1549
1550This option is used to change the way that fields, signatures,
1551and attributions in `mh-identity-list' are added. To customize
1552`mh-identity-handlers', replace the name of an existing handler
1553function associated with the field you want to change with the
1554name of a function you have written. You can also click on an
1555\"INS\" button and insert a field of your choice and the name of
1556the function you have written to handle it.
1557
1558The \"Field\" field can be any field that you've used in your
1559`mh-identity-list'. The special fields \":attribution-verb\",
1560\":signature\", or \":pgg-default-user-id\" are used for the
1561`mh-identity-list' choices \"Attribution Verb\", \"Signature\", and
1562\"GPG Key ID\" respectively.
1563
1564The handler associated with the \":default\" field is used when no
1565other field matches.
1566
1567The handler functions are passed two or three arguments: the
1568FIELD itself (for example, \"From\"), or one of the special
1569fields (for example, \":signature\"), and the ACTION 'remove or
1570'add. If the action is 'add, an additional argument
1571containing the VALUE for the field is given."
1572 :type '(repeat (cons (string :tag "Field") function))
23347d76
BW
1573 :group 'mh-identity
1574 :package-version '(MH-E "8.0"))
dda00b2c
BW
1575
1576;;; Incorporating Your Mail (:group 'mh-inc)
1577
23347d76 1578(mh-defcustom mh-inc-prog "inc"
dda00b2c
BW
1579 "*Program to incorporate new mail into a folder.
1580
1581This program generates a one-line summary for each of the new
1582messages. Unless it is an absolute pathname, the file is assumed
1583to be in the `mh-progs' directory. You may also link a file to
1584\"inc\" that uses a different format. You'll then need to modify
1585several scan line format variables appropriately."
1586 :type 'string
23347d76
BW
1587 :group 'mh-inc
1588 :package-version '(MH-E "6.0"))
dda00b2c
BW
1589
1590(eval-and-compile
1591 (unless (fboundp 'mh-inc-spool-make-no-autoload)
1592 (defun mh-inc-spool-make-no-autoload ()
1593 "Temporary definition.
1594Real definition will take effect when mh-inc is loaded."
1595 nil)))
1596
23347d76 1597(mh-defcustom mh-inc-spool-list nil
dda00b2c
BW
1598 "*Alternate spool files.
1599
1600You can use the `mh-inc-spool-list' variable to direct MH-E to
1601retrieve mail from arbitrary spool files other than your system
1602mailbox, file it in folders other than your \"+inbox\", and assign
1603key bindings to incorporate this mail.
1604
1605Suppose you are subscribed to the \"mh-e-devel\" mailing list and
1606you use \"procmail\" to filter this mail into \"~/mail/mh-e\" with
1607the following recipe in \".procmailrc\":
1608
1609 MAILDIR=$HOME/mail
1610 :0:
1611 * ^From mh-e-devel-admin@stop.mail-abuse.org
1612 mh-e
1613
1614In order to incorporate \"~/mail/mh-e\" into \"+mh-e\" with an
1615\"I m\" (mh-inc-spool-mh-e) command, customize this option, and click
1616on the \"INS\" button. Enter a \"Spool File\" of \"~/mail/mh-e\", a
1617\"Folder\" of \"mh-e\", and a \"Key Binding\" of \"m\".
1618
1619You can use \"xbuffy\" to automate the incorporation of this mail
dc4d94d5 1620using the Emacs 22 command \"emacsclient\" as follows:
dda00b2c
BW
1621
1622 box ~/mail/mh-e
1623 title mh-e
1624 origMode
1625 polltime 10
1626 headertime 0
dc4d94d5
BW
1627 command emacsclient --eval '(mh-inc-spool-mh-e)'
1628
1629In XEmacs, the command \"gnuclient\" is used in a similar
1630fashion."
dda00b2c
BW
1631 :type '(repeat (list (file :tag "Spool File")
1632 (string :tag "Folder")
1633 (character :tag "Key Binding")))
1634 :set (lambda (symbol value)
1635 (set-default symbol value)
1636 (mh-inc-spool-make-no-autoload))
23347d76
BW
1637 :group 'mh-inc
1638 :package-version '(MH-E "7.3"))
dda00b2c
BW
1639
1640;;; Dealing with Junk Mail (:group 'mh-junk)
1641
1642(defvar mh-junk-choice nil
1643 "Chosen spam fighting program.")
1644
1645;; Available spam filter interfaces
1646(defvar mh-junk-function-alist
1647 '((spamassassin mh-spamassassin-blacklist mh-spamassassin-whitelist)
1648 (bogofilter mh-bogofilter-blacklist mh-bogofilter-whitelist)
1649 (spamprobe mh-spamprobe-blacklist mh-spamprobe-whitelist))
1650 "Available choices of spam programs to use.
1651
1652This is an alist. For each element there are functions that
1653blacklist a message as spam and whitelist a message incorrectly
1654classified as spam.")
1655
1656(defun mh-junk-choose (symbol value)
1657 "Choose spam program to use.
1658
1659The function is always called with SYMBOL bound to
1660`mh-junk-program' and VALUE bound to the new value of
1661`mh-junk-program'. The function sets the variable
1662`mh-junk-choice' in addition to `mh-junk-program'."
1663 (set symbol value) ;XXX shouldn't this be set-default?
1664 (setq mh-junk-choice
1665 (or value
1666 (loop for element in mh-junk-function-alist
1667 until (executable-find (symbol-name (car element)))
1668 finally return (car element)))))
1669
23347d76 1670(mh-defcustom mh-junk-background nil
dda00b2c
BW
1671 "If on, spam programs are run in background.
1672
1673By default, the programs are run in the foreground, but this can
1674be slow when junking large numbers of messages. If you have
1675enough memory or don't junk that many messages at the same time,
1676you might try turning on this option."
1677 :type '(choice (const :tag "Off" nil)
1678 (const :tag "On" 0))
23347d76
BW
1679 :group 'mh-junk
1680 :package-version '(MH-E "8.0"))
dda00b2c 1681
23347d76 1682(mh-defcustom mh-junk-disposition nil
dda00b2c
BW
1683 "Disposition of junk mail."
1684 :type '(choice (const :tag "Delete Spam" nil)
1685 (string :tag "Spam Folder"))
23347d76
BW
1686 :group 'mh-junk
1687 :package-version '(MH-E "8.0"))
dda00b2c 1688
23347d76 1689(mh-defcustom mh-junk-program nil
dda00b2c
BW
1690 "Spam program that MH-E should use.
1691
1692The default setting of this option is \"Auto-detect\" which means
1693that MH-E will automatically choose one of SpamAssassin,
1694bogofilter, or SpamProbe in that order. If, for example, you have
1695both SpamAssassin and bogofilter installed and you want to use
1696bogofilter, then you can set this option to \"Bogofilter\"."
1697 :type '(choice (const :tag "Auto-detect" nil)
1698 (const :tag "SpamAssassin" spamassassin)
1699 (const :tag "Bogofilter" bogofilter)
1700 (const :tag "SpamProbe" spamprobe))
1701 :set 'mh-junk-choose
23347d76
BW
1702 :group 'mh-junk
1703 :package-version '(MH-E "7.3"))
dda00b2c
BW
1704
1705;;; Editing a Draft (:group 'mh-letter)
1706
23347d76 1707(mh-defcustom mh-compose-insertion (if (locate-library "mml") 'mml 'mh)
dda00b2c
BW
1708 "Type of tags used when composing MIME messages.
1709
1710In addition to MH-style directives, MH-E also supports MML (MIME
1711Meta Language) tags. (see Info node `(emacs-mime)Composing').
1712This option can be used to choose between them. By default, this
1713option is set to \"MML\" if it is supported since it provides a
1714lot more functionality. This option can also be set to \"MH\" if
1715MH-style directives are preferred."
1716 :type '(choice (const :tag "MML" mml)
1717 (const :tag "MH" mh))
23347d76
BW
1718 :group 'mh-letter
1719 :package-version '(MH-E "7.0"))
dda00b2c 1720
23347d76 1721(mh-defcustom mh-compose-skipped-header-fields
dda00b2c
BW
1722 '("From" "Organization" "References" "In-Reply-To"
1723 "X-Face" "Face" "X-Image-URL" "X-Mailer")
1724 "List of header fields to skip over when navigating in draft."
1725 :type '(repeat (string :tag "Field"))
23347d76
BW
1726 :group 'mh-letter
1727 :package-version '(MH-E "7.4"))
dda00b2c 1728
23347d76 1729(mh-defcustom mh-compose-space-does-completion-flag nil
dda00b2c
BW
1730 "*Non-nil means \\<mh-letter-mode-map>\\[mh-letter-complete-or-space] does completion in message header."
1731 :type 'boolean
23347d76
BW
1732 :group 'mh-letter
1733 :package-version '(MH-E "7.4"))
dda00b2c 1734
23347d76 1735(mh-defcustom mh-delete-yanked-msg-window-flag nil
dda00b2c
BW
1736 "*Non-nil means delete any window displaying the message.
1737
1738This deletes the window containing the original message after
1739yanking it with \\<mh-letter-mode-map>\\[mh-yank-cur-msg] to make
1740more room on your screen for your reply."
1741 :type 'boolean
23347d76
BW
1742 :group 'mh-letter
1743 :package-version '(MH-E "7.0"))
dda00b2c 1744
23347d76 1745(mh-defcustom mh-extract-from-attribution-verb "wrote:"
dda00b2c
BW
1746 "*Verb to use for attribution when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
1747
1748The attribution consists of the sender's name and email address
1749followed by the content of this option. This option can be set to
1750\"wrote:\", \"a écrit:\", and \"schrieb:\". You can also use the
1751\"Custom String\" menu item to enter your own verb."
1752 :type '(choice (const "wrote:")
1753 (const "a écrit:")
1754 (const "schrieb:")
1755 (string :tag "Custom String"))
23347d76
BW
1756 :group 'mh-letter
1757 :package-version '(MH-E "7.0"))
dda00b2c 1758
23347d76 1759(mh-defcustom mh-ins-buf-prefix "> "
dda00b2c
BW
1760 "*String to put before each line of a yanked or inserted message.
1761
1762The prefix \"> \" is the default setting of this option. I
1763suggest that you not modify this option since it is used by many
1764mailers and news readers: messages are far easier to read if
1765several included messages have all been indented by the same
1766string.
1767
1768This prefix is not inserted if you use one of the supercite
1769flavors of `mh-yank-behavior' or you have added a
1770`mail-citation-hook'."
1771 :type 'string
23347d76
BW
1772 :group 'mh-letter
1773 :package-version '(MH-E "6.0"))
dda00b2c 1774
23347d76 1775(mh-defcustom mh-letter-complete-function 'ispell-complete-word
dda00b2c
BW
1776 "*Function to call when completing outside of address or folder fields.
1777
1778In the body of the message,
1779\\<mh-letter-mode-map>\\[mh-letter-complete] runs this function,
1780which is set to \"ispell-complete-word\" by default."
1781 :type '(choice function (const nil))
23347d76
BW
1782 :group 'mh-letter
1783 :package-version '(MH-E "7.1"))
dda00b2c 1784
23347d76 1785(mh-defcustom mh-letter-fill-column 72
dda00b2c
BW
1786 "*Fill column to use in MH Letter mode.
1787
1788By default, this option is 72 to allow others to quote your
1789message without line wrapping."
1790 :type 'integer
23347d76
BW
1791 :group 'mh-letter
1792 :package-version '(MH-E "6.0"))
dda00b2c 1793
23347d76 1794(mh-defcustom mh-mml-method-default (if mh-pgp-support-flag "pgpmime" "none")
dda00b2c
BW
1795 "Default method to use in security tags.
1796
1797This option is used to select between a variety of mail security
1798mechanisms. The default is \"PGP (MIME)\" if it is supported\;
1799otherwise, the default is \"None\". Other mechanisms include
1800vanilla \"PGP\" and \"S/MIME\".
1801
1802The `pgg' customization group may have some settings which may
1803interest you (see Info node `(pgg)').
1804
1805In particular, I turn on the option `pgg-encrypt-for-me' so that
1806all messages I encrypt are encrypted with my public key as well.
1807If you keep a copy of all of your outgoing mail with a \"Fcc:\"
1808header field, this setting is vital so that you can read the mail
1809you write!"
1810 :type '(choice (const :tag "PGP (MIME)" "pgpmime")
1811 (const :tag "PGP" "pgp")
1812 (const :tag "S/MIME" "smime")
1813 (const :tag "None" "none"))
23347d76
BW
1814 :group 'mh-letter
1815 :package-version '(MH-E "8.0"))
dda00b2c 1816
23347d76 1817(mh-defcustom mh-signature-file-name "~/.signature"
dda00b2c
BW
1818 "*Source of user's signature.
1819
1820By default, the text of your signature is taken from the file
1821\"~/.signature\". You can read from other sources by changing this
1822option. This file may contain a vCard in which case an attachment is
1823added with the vCard.
1824
1825This option may also be a symbol, in which case that function is
1826called. You may not want a signature separator to be added for you;
1827instead you may want to insert one yourself. Options that you may find
1828useful to do this include `mh-signature-separator' (when inserting a
1829signature separator) and `mh-signature-separator-regexp' (for finding
1830said separator). The function `mh-signature-separator-p', which
1831reports t if the buffer contains a separator, may be useful as well.
1832
1833The signature is inserted into your message with the command
1834\\<mh-letter-mode-map>\\[mh-insert-signature] or with the option
1835`mh-identity-list'."
1836 :type 'file
23347d76
BW
1837 :group 'mh-letter
1838 :package-version '(MH-E "6.0"))
dda00b2c 1839
23347d76 1840(mh-defcustom mh-signature-separator-flag t
dda00b2c
BW
1841 "*Non-nil means a signature separator should be inserted.
1842
1843It is not recommended that you change this option since various
1844mail user agents, including MH-E, use the separator to present
1845the signature differently, and to suppress the signature when
1846replying or yanking a letter into a draft."
1847 :type 'boolean
23347d76
BW
1848 :group 'mh-letter
1849 :package-version '(MH-E "8.0"))
dda00b2c 1850
23347d76 1851(mh-defcustom mh-x-face-file "~/.face"
dda00b2c
BW
1852 "*File containing face header field to insert in outgoing mail.
1853
1854If the file starts with either of the strings \"X-Face:\", \"Face:\"
1855or \"X-Image-URL:\" then the contents are added to the message header
1856verbatim. Otherwise it is assumed that the file contains the value of
1857the \"X-Face:\" header field.
1858
1859The \"X-Face:\" header field, which is a low-resolution, black and
1860white image, can be generated using the \"compface\" command (see URL
1861`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.Z'). The
1862\"Online X-Face Converter\" is a useful resource for quick conversion
1863of images into \"X-Face:\" header fields (see URL
1864`http://www.dairiki.org/xface/').
1865
1866Use the \"make-face\" script to convert a JPEG image to the higher
1867resolution, color, \"Face:\" header field (see URL
1868`http://quimby.gnus.org/circus/face/make-face').
1869
1870The URL of any image can be used for the \"X-Image-URL:\" field and no
1871processing of the image is required.
1872
1873To prevent the setting of any of these header fields, either set
1874`mh-x-face-file' to nil, or simply ensure that the file defined by
1875this option doesn't exist."
1876 :type 'file
23347d76
BW
1877 :group 'mh-letter
1878 :package-version '(MH-E "7.0"))
dda00b2c 1879
23347d76 1880(mh-defcustom mh-yank-behavior 'attribution
dda00b2c
BW
1881 "*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
1882
1883To include the entire message, including the entire header, use
1884\"Body and Header\". Use \"Body\" to yank just the body without
1885the header. To yank only the portion of the message following the
1886point, set this option to \"Below Point\".
1887
1888Choose \"Invoke supercite\" to pass the entire message and header
1889through supercite.
1890
1891If the \"Body With Attribution\" setting is used, then the
1892message minus the header is yanked and a simple attribution line
1893is added at the top using the value of the option
1894`mh-extract-from-attribution-verb'. This is the default.
1895
1896If the \"Invoke supercite\" or \"Body With Attribution\" settings
1897are used, the \"-noformat\" argument is passed to the \"repl\"
1898program to override a \"-filter\" or \"-format\" argument. These
1899settings also have \"Automatically\" variants that perform the
1900action automatically when you reply so that you don't need to use
1901\\[mh-yank-cur-msg] at all. Note that this automatic action is
1902only performed if the show buffer matches the message being
1903replied to. People who use the automatic variants tend to turn on
1904the option `mh-delete-yanked-msg-window-flag' as well so that the
1905show window is never displayed.
1906
1907If the show buffer has a region, the option `mh-yank-behavior' is
1908ignored unless its value is one of Attribution variants in which
1909case the attribution is added to the yanked region.
1910
1911If this option is set to one of the supercite flavors, the hook
1912`mail-citation-hook' is ignored and `mh-ins-buf-prefix' is not
1913inserted."
1914 :type '(choice (const :tag "Body and Header" t)
1915 (const :tag "Body" body)
1916 (const :tag "Below Point" nil)
1917 (const :tag "Invoke supercite" supercite)
1918 (const :tag "Invoke supercite, Automatically" autosupercite)
1919 (const :tag "Body With Attribution" attribution)
1920 (const :tag "Body With Attribution, Automatically"
1921 autoattrib))
23347d76
BW
1922 :group 'mh-letter
1923 :package-version '(MH-E "8.0"))
dda00b2c
BW
1924
1925;;; Ranges (:group 'mh-ranges)
1926
23347d76 1927(mh-defcustom mh-interpret-number-as-range-flag t
dda00b2c
BW
1928 "*Non-nil means interpret a number as a range.
1929
1930Since one of the most frequent ranges used is \"last:N\", MH-E
1931will interpret input such as \"200\" as \"last:200\" if this
1932option is on (which is the default). If you need to scan just the
1933message 200, then use the range \"200:200\"."
1934 :type 'boolean
23347d76
BW
1935 :group 'mh-ranges
1936 :package-version '(MH-E "7.4"))
dda00b2c
BW
1937
1938;;; Scan Line Formats (:group 'mh-scan-line-formats)
1939
1940(eval-and-compile
1941 (unless (fboundp 'mh-adaptive-cmd-note-flag-check)
1942 (defun mh-adaptive-cmd-note-flag-check (symbol value)
1943 "Temporary definition.
1944Real definition, below, uses variables that aren't defined yet."
1945 (set-default symbol value))))
1946
23347d76 1947(mh-defcustom mh-adaptive-cmd-note-flag t
dda00b2c
BW
1948 "*Non-nil means that the message number width is determined dynamically.
1949
1950If you've created your own format to handle long message numbers,
1951you'll be pleased to know you no longer need it since MH-E adapts its
1952internal format based upon the largest message number if this option
1953is on (the default). This option may only be turned on when
1954`mh-scan-format-file' is set to \"Use MH-E scan Format\".
1955
1956If you prefer fixed-width message numbers, turn off this option and
1957call `mh-set-cmd-note' with the width specified by your format file
1958\(see `mh-scan-format-file'). For example, the default width is 4, so
1959you would use \"(mh-set-cmd-note 4)\"."
1960 :type 'boolean
1961 :group 'mh-scan-line-formats
23347d76
BW
1962 :set 'mh-adaptive-cmd-note-flag-check
1963 :package-version '(MH-E "7.0"))
dda00b2c
BW
1964
1965(defun mh-scan-format-file-check (symbol value)
1966 "Check if desired setting is legal.
1967Throw an error if user tries to set `mh-scan-format-file' to
1968anything but t when `mh-adaptive-cmd-note-flag' is on. Otherwise,
1969set SYMBOL to VALUE."
1970 (if (and (not (eq value t))
fd61b9ab 1971 mh-adaptive-cmd-note-flag)
dda00b2c
BW
1972 (error "%s %s" "You must turn off `mh-adaptive-cmd-note-flag'"
1973 "unless you use \"Use MH-E scan Format\"")
1974 (set-default symbol value)))
1975
23347d76 1976(mh-defcustom mh-scan-format-file t
dda00b2c
BW
1977 "Specifies the format file to pass to the scan program.
1978
1979The default setting for this option is \"Use MH-E scan Format\". This
1980means that the format string will be taken from the either
1981`mh-scan-format-mh' or `mh-scan-format-nmh' depending on whether MH or
1982nmh (or GNU mailutils) is in use. This setting also enables you to
1983turn on the `mh-adaptive-cmd-note-flag' option.
1984
1985You can also set this option to \"Use Default scan Format\" to get the
1986same output as you would get if you ran \"scan\" from the shell. If
1987you have a format file that you want MH-E to use but not MH, you can
1988set this option to \"Specify a scan Format File\" and enter the name
1989of your format file.
1990
1991If you change the format of the scan lines you'll need to tell MH-E
1992how to parse the new format. As you will see, quite a lot of variables
1993are involved to do that. Use \"\\[apropos] RET mh-scan.*regexp\" to
1994obtain a list of these variables. You will also have to call
1995`mh-set-cmd-note' if your notations are not in column 4 (columns in
1996Emacs start with 0)."
1997 :type '(choice (const :tag "Use MH-E scan Format" t)
1998 (const :tag "Use Default scan Format" nil)
1999 (file :tag "Specify a scan Format File"))
2000 :group 'mh-scan-line-formats
23347d76
BW
2001 :set 'mh-scan-format-file-check
2002 :package-version '(MH-E "6.0"))
dda00b2c
BW
2003
2004(defun mh-adaptive-cmd-note-flag-check (symbol value)
2005 "Check if desired setting is legal.
2006Throw an error if user tries to turn on
2007`mh-adaptive-cmd-note-flag' when `mh-scan-format-file' isn't t.
2008Otherwise, set SYMBOL to VALUE."
2009 (if (and value
2010 (not (eq mh-scan-format-file t)))
2011 (error "%s %s" "Can't turn on unless `mh-scan-format-file'"
2012 "is set to \"Use MH-E scan Format\"")
2013 (set-default symbol value)))
2014
23347d76 2015(mh-defcustom mh-scan-prog "scan"
dda00b2c
BW
2016 "*Program used to scan messages.
2017
2018The name of the program that generates a listing of one line per
2019message is held in this option. Unless this variable contains an
2020absolute pathname, it is assumed to be in the `mh-progs'
2021directory. You may link another program to `scan' (see
2022\"mh-profile(5)\") to produce a different type of listing."
2023 :type 'string
23347d76
BW
2024 :group 'mh-scan-line-formats
2025 :package-version '(MH-E "6.0"))
dda00b2c
BW
2026(make-variable-buffer-local 'mh-scan-prog)
2027
dda00b2c
BW
2028;;; Searching (:group 'mh-search)
2029
23347d76 2030(mh-defcustom mh-search-program nil
dda00b2c
BW
2031 "Search program that MH-E shall use.
2032
2033The default setting of this option is \"Auto-detect\" which means
2034that MH-E will automatically choose one of swish++, swish-e,
2035mairix, namazu, pick and grep in that order. If, for example, you
2036have both swish++ and mairix installed and you want to use
2037mairix, then you can set this option to \"mairix\".
2038
2039More information about setting up an indexing program to use with
2040MH-E can be found in the documentation of `mh-search'."
2041 :type '(choice (const :tag "Auto-detect" nil)
2042 (const :tag "swish++" swish++)
2043 (const :tag "swish-e" swish)
2044 (const :tag "mairix" mairix)
2045 (const :tag "namazu" namazu)
2046 (const :tag "pick" pick)
2047 (const :tag "grep" grep))
23347d76
BW
2048 :group 'mh-search
2049 :package-version '(MH-E "8.0"))
dda00b2c
BW
2050
2051;;; Sending Mail (:group 'mh-sending-mail)
2052
23347d76 2053(mh-defcustom mh-compose-forward-as-mime-flag t
dda00b2c
BW
2054 "*Non-nil means that messages are forwarded as attachments.
2055
2056By default, this option is on which means that the forwarded
2057messages are included as attachments. If you would prefer to
2058forward your messages verbatim (as text, inline), then turn off
2059this option. Forwarding messages verbatim works well for short,
2060textual messages, but your recipient won't be able to view any
2061non-textual attachments that were in the forwarded message. Be
2062aware that if you have \"forw: -mime\" in your MH profile, then
2063forwarded messages will always be included as attachments
2064regardless of the settings of this option."
2065 :type 'boolean
23347d76
BW
2066 :group 'mh-sending-mail
2067 :package-version '(MH-E "8.0"))
dda00b2c 2068
23347d76 2069(mh-defcustom mh-compose-letter-function nil
dda00b2c
BW
2070 "Invoked when starting a new draft.
2071
2072However, it is the last function called before you edit your
2073message. The consequence of this is that you can write a function
2074to write and send the message for you. This function is passed
2075three arguments: the contents of the TO, SUBJECT, and CC header
2076fields."
2077 :type '(choice (const nil) function)
23347d76
BW
2078 :group 'mh-sending-mail
2079 :package-version '(MH-E "6.0"))
dda00b2c 2080
23347d76 2081(mh-defcustom mh-compose-prompt-flag nil
dda00b2c
BW
2082 "*Non-nil means prompt for header fields when composing a new draft."
2083 :type 'boolean
23347d76
BW
2084 :group 'mh-sending-mail
2085 :package-version '(MH-E "7.4"))
dda00b2c 2086
23347d76 2087(mh-defcustom mh-forward-subject-format "%s: %s"
dda00b2c
BW
2088 "*Format string for forwarded message subject.
2089
2090This option is a string which includes two escapes (\"%s\"). The
2091first \"%s\" is replaced with the sender of the original message,
2092and the second one is replaced with the original \"Subject:\"."
2093 :type 'string
23347d76
BW
2094 :group 'mh-sending-mail
2095 :package-version '(MH-E "6.0"))
dda00b2c 2096
23347d76 2097(mh-defcustom mh-insert-x-mailer-flag t
dda00b2c
BW
2098 "*Non-nil means append an \"X-Mailer:\" header field to the header.
2099
2100This header field includes the version of MH-E and Emacs that you
2101are using. If you don't want to participate in our marketing, you
2102can turn this option off."
2103 :type 'boolean
23347d76
BW
2104 :group 'mh-sending-mail
2105 :package-version '(MH-E "7.0"))
dda00b2c 2106
23347d76 2107(mh-defcustom mh-redist-full-contents-flag nil
dda00b2c
BW
2108 "*Non-nil means the \"dist\" command needs entire letter for redistribution.
2109
2110This option must be turned on if \"dist\" requires the whole
2111letter for redistribution, which is the case if \"send\" is
2112compiled with the BERK option (which many people abhor). If you
2113find that MH will not allow you to redistribute a message that
2114has been redistributed before, turn off this option."
2115 :type 'boolean
23347d76
BW
2116 :group 'mh-sending-mail
2117 :package-version '(MH-E "8.0"))
dda00b2c 2118
23347d76 2119(mh-defcustom mh-reply-default-reply-to nil
dda00b2c
BW
2120 "*Sets the person or persons to whom a reply will be sent.
2121
2122This option is set to \"Prompt\" by default so that you are
2123prompted for the recipient of a reply. If you find that most of
2124the time that you specify \"cc\" when you reply to a message, set
2125this option to \"cc\". Other choices include \"from\", \"to\", or
2126\"all\". You can always edit the recipients in the draft."
2127 :type '(choice (const :tag "Prompt" nil)
2128 (const "from")
2129 (const "to")
2130 (const "cc")
2131 (const "all"))
23347d76
BW
2132 :group 'mh-sending-mail
2133 :package-version '(MH-E "6.0"))
dda00b2c 2134
23347d76 2135(mh-defcustom mh-reply-show-message-flag t
dda00b2c
BW
2136 "*Non-nil means the MH-Show buffer is displayed when replying.
2137
2138If you include the message automatically, you can hide the
2139MH-Show buffer by turning off this option.
2140
2141See also `mh-reply'."
2142 :type 'boolean
23347d76
BW
2143 :group 'mh-sending-mail
2144 :package-version '(MH-E "7.0"))
dda00b2c
BW
2145
2146;;; Sequences (:group 'mh-sequences)
2147
2148;; If `mh-unpropagated-sequences' becomes a defcustom, add the following to
2149;; the docstring: "Additional sequences that should not to be preserved can be
2150;; specified by setting `mh-unpropagated-sequences' appropriately." XXX
2151
23347d76 2152(mh-defcustom mh-refile-preserves-sequences-flag t
dda00b2c
BW
2153 "*Non-nil means that sequences are preserved when messages are refiled.
2154
2155If a message is in any sequence (except \"Previous-Sequence:\"
2156and \"cur\") when it is refiled, then it will still be in those
2157sequences in the destination folder. If this behavior is not
2158desired, then turn off this option."
2159 :type 'boolean
23347d76
BW
2160 :group 'mh-sequences
2161 :package-version '(MH-E "7.4"))
dda00b2c 2162
23347d76 2163(mh-defcustom mh-tick-seq 'tick
dda00b2c
BW
2164 "The name of the MH sequence for ticked messages.
2165
2166You can customize this option if you already use the \"tick\"
2167sequence for your own use. You can also disable all of the
2168ticking functions by choosing the \"Disable Ticking\" item but
2169there isn't much advantage to that."
2170 :type '(choice (const :tag "Disable Ticking" nil)
2171 symbol)
23347d76
BW
2172 :group 'mh-sequences
2173 :package-version '(MH-E "7.3"))
dda00b2c 2174
23347d76 2175(mh-defcustom mh-update-sequences-after-mh-show-flag t
dda00b2c
BW
2176 "*Non-nil means flush MH sequences to disk after message is shown\\<mh-folder-mode-map>.
2177
2178Three sequences are maintained internally by MH-E and pushed out
2179to MH when a message is shown. They include the sequence
2180specified by your \"Unseen-Sequence:\" profile entry, \"cur\",
2181and the sequence listed by the option `mh-tick-seq' which is
2182\"tick\" by default. If you do not like this behavior, turn off
2183this option. You can then update the state manually with the
2184\\[mh-execute-commands], \\[mh-quit], or \\[mh-update-sequences]
2185commands."
2186 :type 'boolean
23347d76
BW
2187 :group 'mh-sequences
2188 :package-version '(MH-E "7.0"))
dda00b2c
BW
2189
2190;;; Reading Your Mail (:group 'mh-show)
2191
23347d76 2192(mh-defcustom mh-bury-show-buffer-flag t
dda00b2c
BW
2193 "*Non-nil means show buffer is buried.
2194
2195One advantage of not burying the show buffer is that one can
2196delete the show buffer more easily in an electric buffer list
2197because of its proximity to its associated MH-Folder buffer. Try
2198running \\[electric-buffer-list] to see what I mean."
2199 :type 'boolean
23347d76
BW
2200 :group 'mh-show
2201 :package-version '(MH-E "7.0"))
dda00b2c 2202
23347d76 2203(mh-defcustom mh-clean-message-header-flag t
dda00b2c
BW
2204 "*Non-nil means remove extraneous header fields.
2205
2206See also `mh-invisible-header-fields-default' and
2207`mh-invisible-header-fields'."
2208 :type 'boolean
23347d76
BW
2209 :group 'mh-show
2210 :package-version '(MH-E "7.0"))
dda00b2c 2211
23347d76 2212(mh-defcustom mh-decode-mime-flag (not (not (locate-library "mm-decode")))
dda00b2c
BW
2213 "*Non-nil means attachments are handled\\<mh-folder-mode-map>.
2214
2215MH-E can handle attachments as well if the Gnus `mm-decode'
2216library is present. If so, this option will be on. Otherwise,
2217you'll see the MIME body parts rather than text or attachments.
2218There isn't much point in turning off this option; however, you
2219can inspect it if it appears that the body parts are not being
2220interpreted correctly or toggle it with the command
2221\\[mh-toggle-mh-decode-mime-flag] to view the raw message.
2222
2223This option also controls the display of quoted-printable
2224messages and other graphical widgets. See the options
2225`mh-graphical-smileys-flag' and `mh-graphical-emphasis-flag'."
2226 :type 'boolean
23347d76
BW
2227 :group 'mh-show
2228 :package-version '(MH-E "7.0"))
dda00b2c 2229
23347d76 2230(mh-defcustom mh-display-buttons-for-alternatives-flag nil
dda00b2c
BW
2231 "*Non-nil means display buttons for all alternative attachments.
2232
2233Sometimes, a mail program will produce multiple alternatives of
2234the attachment in increasing degree of faithfulness to the
2235original content. By default, only the preferred alternative is
2236displayed. If this option is on, then the preferred part is shown
2237inline and buttons are shown for each of the other alternatives."
2238 :type 'boolean
23347d76
BW
2239 :group 'mh-show
2240 :package-version '(MH-E "7.4"))
dda00b2c 2241
23347d76 2242(mh-defcustom mh-display-buttons-for-inline-parts-flag nil
dda00b2c
BW
2243 "*Non-nil means display buttons for all inline attachments\\<mh-folder-mode-map>.
2244
2245The sender can request that attachments should be viewed inline so
2246that they do not really appear like an attachment at all to the
2247reader. Most of the time, this is desirable, so by default MH-E
2248suppresses the buttons for inline attachments. On the other hand, you
2249may receive code or HTML which the sender has added to his message as
2250inline attachments so that you can read them in MH-E. In this case, it
2251is useful to see the buttons so that you know you don't have to cut
2252and paste the code into a file; you can simply save the attachment.
2253
2254If you want to make the buttons visible for inline attachments, you
2255can use the command \\[mh-toggle-mime-buttons] to toggle the
2256visibility of these buttons. You can turn on these buttons permanently
2257by turning on this option.
2258
2259MH-E cannot display all attachments inline however. It can display
2260text (including HTML) and images."
2261 :type 'boolean
23347d76
BW
2262 :group 'mh-show
2263 :package-version '(MH-E "7.0"))
dda00b2c 2264
23347d76 2265(mh-defcustom mh-do-not-confirm-flag nil
dda00b2c
BW
2266 "*Non-nil means non-reversible commands do not prompt for confirmation.
2267
2268Commands such as `mh-pack-folder' prompt to confirm whether to
2269process outstanding moves and deletes or not before continuing.
2270Turning on this option means that these actions will be
2271performed--which is usually desired but cannot be
2272retracted--without question."
2273 :type 'boolean
23347d76
BW
2274 :group 'mh-show
2275 :package-version '(MH-E "7.0"))
dda00b2c 2276
23347d76 2277(mh-defcustom mh-fetch-x-image-url nil
dda00b2c
BW
2278 "*Control fetching of \"X-Image-URL:\" header field image.
2279
2280Ths option controls the fetching of the \"X-Image-URL:\" header
2281field image with the following values:
2282
2283Ask Before Fetching
2284 You are prompted before the image is fetched. MH-E will
2285 remember your reply and will either use the already fetched
2286 image the next time the same URL is encountered or silently
2287 skip it if you didn't fetch it the first time. This is a
2288 good setting.
2289
2290Never Fetch
2291 Images are never fetched and only displayed if they are
2292 already present in the cache. This is the default.
2293
2294There isn't a value of \"Always Fetch\" for privacy and DOS (denial of
2295service) reasons. For example, fetching a URL can tip off a spammer
2296that you've read his email (which is why you shouldn't blindly answer
2297yes if you've set this option to \"Ask Before Fetching\"). Someone may
2298also flood your network and fill your disk drive by sending a torrent
2299of messages, each specifying a unique URL to a very large file.
2300
2301The cache of images is found in the directory \".mhe-x-image-cache\"
2302within your MH directory. You can add your own face to the \"From:\"
2303field too. See Info node `(mh-e)Picture'.
2304
2305This setting only has effect if the option `mh-show-use-xface-flag' is
2306turned on."
2307
2308 :type '(choice (const :tag "Ask Before Fetching" ask)
2309 (const :tag "Never Fetch" nil))
23347d76
BW
2310 :group 'mh-show
2311 :package-version '(MH-E "7.3"))
dda00b2c 2312
23347d76 2313(mh-defcustom mh-graphical-smileys-flag t
dda00b2c
BW
2314 "*Non-nil means graphical smileys are displayed.
2315
2316It is a long standing custom to inject body language using a
2317cornucopia of punctuation, also known as the \"smileys\". MH-E
2318can render these as graphical widgets if this option is turned
2319on, which it is by default. Smileys include patterns such as :-)
2320and ;-).
2321
2322This option is disabled if the option `mh-decode-mime-flag' is
2323turned off."
2324 :type 'boolean
23347d76
BW
2325 :group 'mh-show
2326 :package-version '(MH-E "7.0"))
dda00b2c 2327
23347d76 2328(mh-defcustom mh-graphical-emphasis-flag t
dda00b2c
BW
2329 "*Non-nil means graphical emphasis is displayed.
2330
2331A few typesetting features are indicated in ASCII text with
2332certain characters. If your terminal supports it, MH-E can render
2333these typesetting directives naturally if this option is turned
2334on, which it is by default. For example, _underline_ will be
2335underlined, *bold* will appear in bold, /italics/ will appear in
2336italics, and so on. See the option `gnus-emphasis-alist' for the
2337whole list.
2338
2339This option is disabled if the option `mh-decode-mime-flag' is
2340turned off."
2341 :type 'boolean
23347d76
BW
2342 :group 'mh-show
2343 :package-version '(MH-E "7.0"))
dda00b2c 2344
23347d76 2345(mh-defcustom mh-highlight-citation-style 'gnus
dda00b2c
BW
2346 "Style for highlighting citations.
2347
2348If the sender of the message has cited other messages in his
2349message, then MH-E will highlight these citations to emphasize
2350the sender's actual response. This option can be customized to
2351change the highlighting style. The \"Multicolor\" method uses a
2352different color for each indentation while the \"Monochrome\"
2353method highlights all citations in red. To disable highlighting
2354of citations entirely, choose \"None\"."
2355 :type '(choice (const :tag "Multicolor" gnus)
2356 (const :tag "Monochrome" font-lock)
2357 (const :tag "None" nil))
23347d76
BW
2358 :group 'mh-show
2359 :package-version '(MH-E "8.0"))
dda00b2c
BW
2360
2361;; Keep fields alphabetized. Mention source, if known.
2362(defvar mh-invisible-header-fields-internal
2363 '("Approved:"
2364 "Autoforwarded:"
2365 "Bestservhost:"
2366 "Cancel-Lock:" ; NNTP posts
2367 "Content-" ; RFC 2045
2368 "Delivered-To:" ; Egroups/yahoogroups mailing list manager
2369 "Delivery-Date:" ; MH
2370 "Delivery:"
2371 "DomainKey-Signature:" ;http://antispam.yahoo.com/domainkeys
2372 "Encoding:"
2373 "Envelope-to:"
2374 "Errors-To:"
2375 "Face:" ; Gnus Face header
2376 "Forwarded:" ; MH
2377 "From " ; sendmail
2378 "Importance:" ; MS Outlook
2379 "In-Reply-To:" ; MH
2380 "Lines:"
2381 "List-" ; Mailman mailing list manager
2382 "List-" ; Unknown mailing list managers
2383 "List-Subscribe:" ; Unknown mailing list managers
2384 "List-Unsubscribe:" ; Unknown mailing list managers
2385 "Mail-from:" ; MH
2386 "Mailing-List:" ; Egroups/yahoogroups mailing list manager
2387 "Message-Id:" ; RFC 822
2388 "Mime-Version" ; RFC 2045
2389 "NNTP-" ; News
2390 "Old-Return-Path:"
2391 "Original-Encoded-Information-Types:" ; X400
2392 "Original-Lines:" ; mail to news
2393 "Original-NNTP-" ; mail to news
2394 "Original-Newsgroups:" ; mail to news
2395 "Original-Path:" ; mail to news
2396 "Original-Received:" ; mail to news
2397 "Original-To:" ; mail to news
2398 "Original-X-" ; mail to news
2399 "Originator:"
2400 "P1-Content-Type:" ; X400
2401 "P1-Message-Id:" ; X400
2402 "P1-Recipient:" ; X400
2403 "Path:"
2404 "Precedence:"
2405 "Prev-Resent" ; MH
2406 "Priority:"
2407 "Received:" ; RFC 822
2408 "Received-SPF:" ; Gmail
2409 "References:"
2410 "Remailed-" ; MH
2411 "Replied:" ; MH
2412 "Resent" ; MH
2413 "Return-Path:" ; RFC 822
2414 "Sensitivity:" ; MS Outlook
2415 "Status:" ; sendmail
2416 "Thread-"
2417 "Ua-Content-Id:" ; X400
2418;; "User-Agent:" ; Similar to X-Mailer, so display it.
2419 "Via:" ; MH
2e9aae14 2420 "X-AOL-IP:" ; AOL WebMail
dda00b2c
BW
2421 "X-Abuse-Info:"
2422 "X-Abuse-and-DMCA-"
2423 "X-Accept-Language:"
2424 "X-Accept-Language:" ; Netscape/Mozilla
2425 "X-Ack:"
2426 "X-Administrivia-To:"
2427 "X-AntiAbuse:" ; cPanel
2428 "X-Apparently-From:" ; MS Outlook
2429 "X-Apparently-To:" ; Egroups/yahoogroups mailing list manager
efd5b7df 2430 "X-Authenticated-Sender:" ; AT&T Message Center (webmail)
dda00b2c 2431 "X-Authentication-Warning:" ; sendmail
efd5b7df 2432 "X-Barracuda-" ; Barracuda spam scores
dda00b2c
BW
2433 "X-Beenthere:" ; Mailman mailing list manager
2434 "X-Bogosity:" ; bogofilter
201a821a
PG
2435 "X-BrightmailFiltered:" ; Brightmail
2436 "X-Brightmail-Tracker:" ; Brightmail
efd5b7df 2437 "X-Bugzilla-" ; Bugzilla
dda00b2c
BW
2438 "X-Complaints-To:"
2439 "X-ContentStamp:" ; NetZero
2440 "X-Cron-Env:"
2441 "X-DMCA"
2442 "X-Delivered"
efd5b7df 2443 "X-EFL-Spamscore:" ; MIT alumni spam filtering
dda00b2c
BW
2444 "X-ELNK-Trace:" ; Earthlink mailer
2445 "X-Envelope-Date:" ; GNU mailutils
2446 "X-Envelope-From:"
2447 "X-Envelope-Sender:"
2448 "X-Envelope-To:"
2449 "X-Evolution:" ; Evolution mail client
2450 "X-Face:"
2451 "X-Folder:" ; Spam
2452 "X-From-Line"
2453 "X-Gmail-" ; Gmail
2454 "X-Gnus-Mail-Source:" ; gnus
2455 "X-Greylist:" ; milter-greylist-1.2.1
2456 "X-Habeas-SWE-1:" ; Spam
2457 "X-Habeas-SWE-2:" ; Spam
2458 "X-Habeas-SWE-3:" ; Spam
2459 "X-Habeas-SWE-4:" ; Spam
2460 "X-Habeas-SWE-5:" ; Spam
2461 "X-Habeas-SWE-6:" ; Spam
2462 "X-Habeas-SWE-7:" ; Spam
2463 "X-Habeas-SWE-8:" ; Spam
2464 "X-Habeas-SWE-9:" ; Spam
201a821a 2465 "X-Hashcash:" ; hashcash
dda00b2c 2466 "X-Info:" ; NTMail
efd5b7df 2467 "X-IronPort-AV:" ; IronPort AV
dda00b2c
BW
2468 "X-Juno-" ; Juno
2469 "X-List-Host:" ; Unknown mailing list managers
2470 "X-List-Subscribe:" ; Unknown mailing list managers
2471 "X-List-Unsubscribe:" ; Unknown mailing list managers
2472 "X-Listprocessor-" ; ListProc(tm) by CREN
2473 "X-Listserver:" ; Unknown mailing list managers
2474 "X-Loop:" ; Unknown mailing list managers
2475 "X-Lumos-SenderID:" ; Roving ConstantContact
2476 "X-MAIL-INFO:" ; NetZero
2e9aae14 2477 "X-MB-Message-" ; AOL WebMail
efd5b7df 2478 "X-MHE-Checksum:" ; Checksum added during index search
dda00b2c
BW
2479 "X-MIME-Autoconverted:" ; sendmail
2480 "X-MIMETrack:"
2481 "X-MS-" ; MS Outlook
efd5b7df 2482 "X-Mail-from:" ; fastmail.fm
dda00b2c
BW
2483 "X-MailScanner" ; ListProc(tm) by CREN
2484 "X-Mailing-List:" ; Unknown mailing list managers
efd5b7df 2485 "X-Mailman-Approved-At:" ; Mailman mailing list manager
dda00b2c
BW
2486 "X-Mailman-Version:" ; Mailman mailing list manager
2487 "X-Majordomo:" ; Majordomo mailing list manager
2488 "X-Message-Id"
2489 "X-MessageWall-Score:" ; Unknown mailing list manager, AUC TeX
2490 "X-MimeOLE:" ; MS Outlook
2491 "X-Mms-" ; T-Mobile pictures
2492 "X-Mozilla-Status:" ; Netscape/Mozilla
2493 "X-Msmail-" ; MS Outlook
2494 "X-NAI-Spam-" ; Network Associates Inc. SpamKiller
2495 "X-News:" ; News
2496 "X-No-Archive:"
2497 "X-Notes-Item:" ; Lotus Notes Domino structured header
2498 "X-OperatingSystem:"
2499 ;;"X-Operator:" ; Similar to X-Mailer, so display it
2500 "X-Orcl-Content-Type:"
2501 "X-Original-Complaints-To:"
2502 "X-Original-Date:" ; SourceForge mailing list manager
2503 "X-Original-To:"
2504 "X-Original-Trace:"
2505 "X-OriginalArrivalTime:" ; Hotmail
2506 "X-Originating-IP:" ; Hotmail
2507 "X-Postfilter:"
2508 "X-Priority:" ; MS Outlook
2509 "X-Qotd-" ; User added
2510 "X-RM"
2511 "X-Received-Date:"
2512 "X-Received:"
2513 "X-Request-"
efd5b7df 2514 "X-Resolved-to:" ; fastmail.fm
dda00b2c 2515 "X-Return-Path-Hint:" ; Roving ConstantContact
efd5b7df
ED
2516 "X-Roving-" ; Roving ConstantContact
2517 "X-SA-Exim-" ; Exim SpamAssassin
dda00b2c
BW
2518 "X-SBClass:" ; Spam
2519 "X-SBNote:" ; Spam
2520 "X-SBPass:" ; Spam
2521 "X-SBRule:" ; Spam
2522 "X-SMTP-"
f12d6a4a
ED
2523 "X-Sasl-enc:" ; Apple Mail
2524 "X-Scanned-By:"
dda00b2c
BW
2525 "X-Sender:"
2526 "X-Server-Date:"
2527 "X-Server-Uuid:"
2528 "X-Sieve:" ; Sieve filtering
2529 "X-Source"
2530 "X-Spam-" ; Spamassassin
2531 "X-SpamBouncer:" ; Spam
2532 "X-Status"
2533 "X-Submissions-To:"
2534 "X-Telecom-Digest"
2535 "X-Trace:"
2536 "X-UID"
2537 "X-UIDL:"
2538 "X-UNTD-" ; NetZero
2539 "X-USANET-" ; usa.net
2540 "X-UserInfo1:"
2541 "X-VSMLoop:" ; NTMail
2542 "X-Virus-Scanned" ; amavisd-new
2543 "X-Vms-To:"
2544 "X-WebTV-Signature:"
2545 "X-Wss-Id:" ; Worldtalk gateways
2546 "X-Yahoo"
2547 "X-eGroups-" ; Egroups/yahoogroups mailing list manager
2548 "X-pgp:"
2549 "X-submission-address:"
2550 "X400-" ; X400
2551 "Xref:")
2552 "List of default header fields that are not to be shown.
2553
2554Do not alter this variable directly. Instead, add entries from
2555here that you would like to be displayed in
2556`mh-invisible-header-fields-default' and add entries to hide in
2557`mh-invisible-header-fields'.")
2558
2559(eval-and-compile
2560 (unless (fboundp 'mh-invisible-headers)
2561 (defun mh-invisible-headers ()
2562 "Temporary definition.
2563Real definition, below, uses variables that aren't defined yet."
2564 nil)))
2565
2566(defvar mh-delay-invisible-header-generation-flag t
2567 "Non-nil means to delay the generation of invisible header fields.
2568Because the function `mh-invisible-headers' uses both
2569`mh-invisible-header-fields' and `mh-invisible-header-fields', it
2570cannot be run until both variables have been initialized.")
2571
23347d76 2572(mh-defcustom mh-invisible-header-fields nil
dda00b2c
BW
2573 "*Additional header fields to hide.
2574
2575Header fields that you would like to hide that aren't listed in
2576`mh-invisible-header-fields-default' can be added to this option
2577with a couple of caveats. Regular expressions are not allowed.
2578Unique fields should have a \":\" suffix; otherwise, the element
2579can be used to render invisible an entire class of fields that
2580start with the same prefix. If you think a header field should be
2581generally ignored, report a bug (see URL
2582`https://sourceforge.net/tracker/?group_id=13357&atid=113357').
2583
2584See also `mh-clean-message-header-flag'."
2585
2586 :type '(repeat (string :tag "Header field"))
2587 :set (lambda (symbol value)
2588 (set-default symbol value)
2589 (mh-invisible-headers))
23347d76
BW
2590 :group 'mh-show
2591 :package-version '(MH-E "7.1"))
dda00b2c 2592
23347d76 2593(mh-defcustom mh-invisible-header-fields-default nil
dda00b2c
BW
2594 "*List of hidden header fields.
2595
2596The header fields listed in this option are hidden, although you
2597can check off any field that you would like to see.
2598
2599Header fields that you would like to hide that aren't listed can
2600be added to the option `mh-invisible-header-fields'.
2601
2602See also `mh-clean-message-header-flag'."
2603 :type `(set ,@(mapcar (lambda (x) `(const ,x))
2604 mh-invisible-header-fields-internal))
2605 :set (lambda (symbol value)
2606 (set-default symbol value)
2607 (mh-invisible-headers))
23347d76
BW
2608 :group 'mh-show
2609 :package-version '(MH-E "8.0"))
dda00b2c
BW
2610
2611(defvar mh-invisible-header-fields-compiled nil
2612 "*Regexp matching lines in a message header that are not to be shown.
2613Do not alter this variable directly. Instead, customize
2614`mh-invisible-header-fields-default' checking for fields normally
2615hidden that you wish to display, and add extra entries to hide in
2616`mh-invisible-header-fields'.")
2617
2618(defun mh-invisible-headers ()
2619 "Make or remake the variable `mh-invisible-header-fields-compiled'.
2620Done using `mh-invisible-header-fields-internal' as input, from
2621which entries from `mh-invisible-header-fields-default' are
2622removed and entries from `mh-invisible-header-fields' are added."
2623 (let ((fields mh-invisible-header-fields-internal))
2624 (when mh-invisible-header-fields-default
2625 ;; Remove entries from `mh-invisible-header-fields-default'
2626 (setq fields
2627 (loop for x in fields
2628 unless (member x mh-invisible-header-fields-default)
2629 collect x)))
2630 (when (and (boundp 'mh-invisible-header-fields)
2631 mh-invisible-header-fields)
2632 (dolist (x mh-invisible-header-fields)
2633 (unless (member x fields) (setq fields (cons x fields)))))
2634 (if fields
2635 (setq mh-invisible-header-fields-compiled
2636 (concat
2637 "^"
2638 ;; workaround for insufficient default
2639 (let ((max-specpdl-size 1000))
2640 (regexp-opt fields t))))
2641 (setq mh-invisible-header-fields-compiled nil))))
2642
2643;; Compile invisible header fields.
2644(mh-invisible-headers)
2645
23347d76 2646(mh-defcustom mh-lpr-command-format "lpr -J '%s'"
dda00b2c
BW
2647 "*Command used to print\\<mh-folder-mode-map>.
2648
2649This option contains the Unix command line which performs the
2650actual printing for the \\[mh-print-msg] command. The string can
2651contain one escape, \"%s\", which is replaced by the name of the
2652folder and the message number and is useful for print job names.
2653I use \"mpage -h'%s' -b Letter -H1of -mlrtb -P\" which produces a
2654nice header and adds a bit of margin so the text fits within my
2655printer's margins.
2656
2657This options is not used by the commands \\[mh-ps-print-msg] or
2658\\[mh-ps-print-msg-file]."
2659 :type 'string
23347d76
BW
2660 :group 'mh-show
2661 :package-version '(MH-E "6.0"))
dda00b2c 2662
23347d76 2663(mh-defcustom mh-max-inline-image-height nil
dda00b2c
BW
2664 "*Maximum inline image height if \"Content-Disposition:\" is not present.
2665
2666Some older mail programs do not insert this needed plumbing to
2667tell MH-E whether to display the attachments inline or not. If
2668this is the case, MH-E will display these images inline if they
2669are smaller than the window. However, you might want to allow
2670larger images to be displayed inline. To do this, you can change
2671the options `mh-max-inline-image-width' and
2672`mh-max-inline-image-height' from their default value of zero to
2673a large number. The size of your screen is a good choice for
2674these numbers."
2675 :type '(choice (const nil) integer)
23347d76
BW
2676 :group 'mh-show
2677 :package-version '(MH-E "7.0"))
dda00b2c 2678
23347d76 2679(mh-defcustom mh-max-inline-image-width nil
dda00b2c
BW
2680 "*Maximum inline image width if \"Content-Disposition:\" is not present.
2681
2682Some older mail programs do not insert this needed plumbing to
2683tell MH-E whether to display the attachments inline or not. If
2684this is the case, MH-E will display these images inline if they
2685are smaller than the window. However, you might want to allow
2686larger images to be displayed inline. To do this, you can change
2687the options `mh-max-inline-image-width' and
2688`mh-max-inline-image-height' from their default value of zero to
2689a large number. The size of your screen is a good choice for
2690these numbers."
2691 :type '(choice (const nil) integer)
23347d76
BW
2692 :group 'mh-show
2693 :package-version '(MH-E "7.0"))
dda00b2c 2694
23347d76 2695(mh-defcustom mh-mhl-format-file nil
dda00b2c
BW
2696 "*Specifies the format file to pass to the \"mhl\" program.
2697
2698Normally MH-E takes care of displaying messages itself (rather than
2699calling an MH program to do the work). If you'd rather have \"mhl\"
2700display the message (within MH-E), change this option from its default
2701value of \"Use Default mhl Format (Printing Only)\".
2702
2703You can set this option to \"Use Default mhl Format\" to get the same
2704output as you would get if you ran \"mhl\" from the shell.
2705
2706If you have a format file that you want MH-E to use, you can set this
2707option to \"Specify an mhl Format File\" and enter the name of your
2708format file. Your format file should specify a non-zero value for
2709\"overflowoffset\" to allow MH-E to parse the header. Note that
2710\"mhl\" is always used for printing and forwarding; in this case, the
2711value of this option is consulted if you have specified a format
2712file."
2713 :type '(choice (const :tag "Use Default mhl Format (Printing Only)" nil)
2714 (const :tag "Use Default mhl Format" t)
2715 (file :tag "Specify an mhl Format File"))
23347d76
BW
2716 :group 'mh-show
2717 :package-version '(MH-E "8.0"))
dda00b2c 2718
23347d76 2719(mh-defcustom mh-mime-save-parts-default-directory t
dda00b2c
BW
2720 "Default directory to use for \\<mh-folder-mode-map>\\[mh-mime-save-parts].
2721
2722The default value for this option is \"Prompt Always\" so that
2723you are always prompted for the directory in which to save the
2724attachments. However, if you usually use the same directory
2725within a session, then you can set this option to \"Prompt the
2726First Time\" to avoid the prompt each time. you can make this
2727directory permanent by choosing \"Directory\" and entering the
2728directory's name."
2729 :type '(choice (const :tag "Prompt the First Time" nil)
2730 (const :tag "Prompt Always" t)
2731 directory)
23347d76
BW
2732 :group 'mh-show
2733 :package-version '(MH-E "7.0"))
dda00b2c 2734
23347d76 2735(mh-defcustom mh-print-background-flag nil
dda00b2c
BW
2736 "*Non-nil means messages should be printed in the background\\<mh-folder-mode-map>.
2737
2738Normally messages are printed in the foreground. If this is slow on
2739your system, you may elect to turn off this option to print in the
2740background.
2741
2742WARNING: If you do this, do not delete the message until it is printed
2743or else the output may be truncated.
2744
2745This option is not used by the commands \\[mh-ps-print-msg] or
2746\\[mh-ps-print-msg-file]."
2747 :type 'boolean
23347d76
BW
2748 :group 'mh-show
2749 :package-version '(MH-E "7.0"))
dda00b2c 2750
23347d76 2751(mh-defcustom mh-show-maximum-size 0
dda00b2c
BW
2752 "*Maximum size of message (in bytes) to display automatically.
2753
2754This option provides an opportunity to skip over large messages
2755which may be slow to load. The default value of 0 means that all
2756message are shown regardless of size."
2757 :type 'integer
23347d76
BW
2758 :group 'mh-show
2759 :package-version '(MH-E "8.0"))
dda00b2c 2760
23347d76 2761(mh-defcustom mh-show-use-xface-flag (>= emacs-major-version 21)
dda00b2c
BW
2762 "*Non-nil means display face images in MH-show buffers.
2763
2764MH-E can display the content of \"Face:\", \"X-Face:\", and
2765\"X-Image-URL:\" header fields. If any of these fields occur in the
2766header of your message, the sender's face will appear in the \"From:\"
2767header field. If more than one of these fields appear, then the first
2768field found in the order \"Face:\", \"X-Face:\", and \"X-Image-URL:\"
2769will be used.
2770
2771The option `mh-show-use-xface-flag' is used to turn this feature on
2772and off. This feature will be turned on by default if your system
2773supports it.
2774
2775The first header field used, if present, is the Gnus-specific
2776\"Face:\" field. The \"Face:\" field appeared in GNU Emacs 21 and
2777XEmacs. For more information, see URL
2778`http://quimby.gnus.org/circus/face/'. Next is the traditional
2779\"X-Face:\" header field. The display of this field requires the
2780\"uncompface\" program (see URL
2781`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.z'). Recent
2782versions of XEmacs have internal support for \"X-Face:\" images. If
2783your version of XEmacs does not, then you'll need both \"uncompface\"
2784and the x-face package (see URL `ftp://ftp.jpl.org/pub/elisp/').
2785
2786Finally, MH-E will display images referenced by the \"X-Image-URL:\"
2787header field if neither the \"Face:\" nor the \"X-Face:\" fields are
2788present. The display of the images requires \"wget\" (see URL
2789`http://www.gnu.org/software/wget/wget.html'), \"fetch\", or \"curl\"
2790to fetch the image and the \"convert\" program from the ImageMagick
2791suite (see URL `http://www.imagemagick.org/'). Of the three header
2792fields this is the most efficient in terms of network usage since the
2793image doesn't need to be transmitted with every single mail.
2794
2795The option `mh-fetch-x-image-url' controls the fetching of the
2796\"X-Image-URL:\" header field image."
2797 :type 'boolean
23347d76
BW
2798 :group 'mh-show
2799 :package-version '(MH-E "7.0"))
dda00b2c 2800
23347d76 2801(mh-defcustom mh-store-default-directory nil
dda00b2c
BW
2802 "*Default directory for \\<mh-folder-mode-map>\\[mh-store-msg].
2803
2804If you would like to change the initial default directory,
2805customize this option, change the value from \"Current\" to
2806\"Directory\", and then enter the name of the directory for storing
2807the content of these messages."
2808 :type '(choice (const :tag "Current" nil)
2809 directory)
23347d76
BW
2810 :group 'mh-show
2811 :package-version '(MH-E "6.0"))
dda00b2c 2812
23347d76 2813(mh-defcustom mh-summary-height nil
dda00b2c
BW
2814 "*Number of lines in MH-Folder buffer (including the mode line).
2815
2816The default value of this option is \"Automatic\" which means
2817that the MH-Folder buffer will maintain the same proportional
2818size if the frame is resized. If you'd prefer a fixed height,
2819then choose the \"Fixed Size\" option and enter the number of
2820lines you'd like to see."
2821 :type '(choice (const :tag "Automatic" nil)
2822 (integer :tag "Fixed Size"))
23347d76
BW
2823 :group 'mh-show
2824 :package-version '(MH-E "7.4"))
dda00b2c
BW
2825
2826;;; The Speedbar (:group 'mh-speedbar)
2827
23347d76 2828(mh-defcustom mh-speed-update-interval 60
dda00b2c
BW
2829 "Time between speedbar updates in seconds.
2830Set to 0 to disable automatic update."
2831 :type 'integer
23347d76
BW
2832 :group 'mh-speedbar
2833 :package-version '(MH-E "8.0"))
dda00b2c
BW
2834
2835;;; Threading (:group 'mh-thread)
2836
23347d76 2837(mh-defcustom mh-show-threads-flag nil
dda00b2c
BW
2838 "*Non-nil means new folders start in threaded mode.
2839
2840Threading large number of messages can be time consuming so this
2841option is turned off by default. If you turn this option on, then
2842threading will be done only if the number of messages being
2843threaded is less than `mh-large-folder'."
2844 :type 'boolean
23347d76
BW
2845 :group 'mh-thread
2846 :package-version '(MH-E "7.1"))
c26cf6c8 2847
dda00b2c
BW
2848;;; The Tool Bar (:group 'mh-tool-bar)
2849
2850;; mh-tool-bar-folder-buttons and mh-tool-bar-letter-buttons defined
2851;; dynamically in mh-tool-bar.el.
2852
23347d76 2853(mh-defcustom mh-tool-bar-search-function 'mh-search
dda00b2c
BW
2854 "*Function called by the tool bar search button.
2855
2856By default, this is set to `mh-search'. You can also choose
2857\"Other Function\" from the \"Value Menu\" and enter a function
2858of your own choosing."
2859 :type '(choice (const mh-search)
2860 (function :tag "Other Function"))
23347d76
BW
2861 :group 'mh-tool-bar
2862 :package-version '(MH-E "7.0"))
dda00b2c
BW
2863
2864;; XEmacs has a couple of extra customizations...
2865(mh-do-in-xemacs
23347d76 2866 (mh-defcustom mh-xemacs-use-tool-bar-flag mh-xemacs-has-tool-bar-flag
dda00b2c
BW
2867 "*If non-nil, use tool bar.
2868
2869This option controls whether to show the MH-E icons at all. By
2870default, this option is turned on if the window system supports
2871tool bars. If your system doesn't support tool bars, then you
2872won't be able to turn on this option."
2873 :type 'boolean
2874 :group 'mh-tool-bar
2875 :set (lambda (symbol value)
2876 (if (and (eq value t)
2877 (not mh-xemacs-has-tool-bar-flag))
2878 (error "Tool bar not supported"))
23347d76
BW
2879 (set-default symbol value))
2880 :package-version '(MH-E "7.3"))
dda00b2c 2881
23347d76 2882 (mh-defcustom mh-xemacs-tool-bar-position nil
dda00b2c
BW
2883 "*Tool bar location.
2884
2885This option controls the placement of the tool bar along the four
2886edges of the frame. You can choose from one of \"Same As Default
2887Tool Bar\", \"Top\", \"Bottom\", \"Left\", or \"Right\". If this
2888variable is set to anything other than \"Same As Default Tool
2889Bar\" and the default tool bar is in a different location, then
2890two tool bars will be displayed: the MH-E tool bar and the
2891default tool bar."
2892 :type '(radio (const :tag "Same As Default Tool Bar" :value nil)
2893 (const :tag "Top" :value top)
2894 (const :tag "Bottom" :value bottom)
2895 (const :tag "Left" :value left)
2896 (const :tag "Right" :value right))
23347d76
BW
2897 :group 'mh-tool-bar
2898 :package-version '(MH-E "7.3")))
942fc772 2899
c26cf6c8
RS
2900\f
2901
dda00b2c
BW
2902;;; Hooks (:group 'mh-hooks + group where hook described)
2903
23347d76 2904(mh-defcustom mh-after-commands-processed-hook nil
e5d763d8 2905 "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] after performing outstanding refile and delete requests.
dda00b2c
BW
2906
2907Variables that are useful in this hook include
2908`mh-folders-changed', which lists which folders were affected by
2909deletes and refiles. This list will always include the current
2910folder, which is also available in `mh-current-folder'."
2911 :type 'hook
2912 :group 'mh-hooks
23347d76
BW
2913 :group 'mh-folder
2914 :package-version '(MH-E "8.0"))
dda00b2c 2915
23347d76 2916(mh-defcustom mh-alias-reloaded-hook nil
dda00b2c
BW
2917 "Hook run by `mh-alias-reload' after loading aliases."
2918 :type 'hook
2919 :group 'mh-hooks
23347d76
BW
2920 :group 'mh-alias
2921 :package-version '(MH-E "8.0"))
dda00b2c 2922
23347d76 2923(mh-defcustom mh-before-commands-processed-hook nil
e5d763d8 2924 "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding refile and delete requests.
dda00b2c
BW
2925
2926Variables that are useful in this hook include `mh-delete-list'
2927and `mh-refile-list' which can be used to see which changes will
2928be made to the current folder, `mh-current-folder'."
2929 :type 'hook
2930 :group 'mh-hooks
23347d76
BW
2931 :group 'mh-folder
2932 :package-version '(MH-E "8.0"))
dda00b2c 2933
23347d76 2934(mh-defcustom mh-before-quit-hook nil
dda00b2c
BW
2935 "Hook run by \\<mh-folder-mode-map>\\[mh-quit] before quitting MH-E.
2936
2937This hook is called before the quit occurs, so you might use it
2938to perform any MH-E operations; you could perform some query and
2939abort the quit or call `mh-execute-commands', for example.
2940
2941See also `mh-quit-hook'."
2942 :type 'hook
2943 :group 'mh-hooks
23347d76
BW
2944 :group 'mh-folder
2945 :package-version '(MH-E "6.0"))
dda00b2c 2946
23347d76 2947(mh-defcustom mh-before-send-letter-hook nil
dda00b2c
BW
2948 "Hook run at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command.
2949
2950For example, if you want to check your spelling in your message
2951before sending, add the `ispell-message' function."
2952 :type 'hook
2953 :options '(ispell-message)
2954 :group 'mh-hooks
23347d76
BW
2955 :group 'mh-letter
2956 :package-version '(MH-E "6.0"))
dda00b2c 2957
23347d76 2958(mh-defcustom mh-delete-msg-hook nil
dda00b2c
BW
2959 "Hook run by \\<mh-letter-mode-map>\\[mh-delete-msg] after marking each message for deletion.
2960
2961For example, a past maintainer of MH-E used this once when he
2962kept statistics on his mail usage."
2963 :type 'hook
2964 :group 'mh-hooks
23347d76
BW
2965 :group 'mh-show
2966 :package-version '(MH-E "6.0"))
dda00b2c 2967
23347d76 2968(mh-defcustom mh-find-path-hook nil
dda00b2c
BW
2969 "Hook run by `mh-find-path' after reading the user's MH profile.
2970
2971This hook can be used the change the value of the variables that
2972`mh-find-path' sets if you need to run with different values
2973between MH and MH-E."
2974 :type 'hook
2975 :group 'mh-hooks
23347d76
BW
2976 :group 'mh-e
2977 :package-version '(MH-E "7.0"))
dda00b2c 2978
23347d76 2979(mh-defcustom mh-folder-mode-hook nil
dda00b2c
BW
2980 "Hook run by `mh-folder-mode' when visiting a new folder."
2981 :type 'hook
2982 :group 'mh-hooks
23347d76
BW
2983 :group 'mh-folder
2984 :package-version '(MH-E "6.0"))
dda00b2c 2985
23347d76 2986(mh-defcustom mh-forward-hook nil
dda00b2c
BW
2987 "Hook run by `mh-forward' on a forwarded letter."
2988 :type 'hook
2989 :group 'mh-hooks
23347d76
BW
2990 :group 'mh-sending-mail
2991 :package-version '(MH-E "8.0"))
dda00b2c 2992
23347d76 2993(mh-defcustom mh-inc-folder-hook nil
dda00b2c
BW
2994 "Hook run by \\<mh-folder-mode-map>\\[mh-inc-folder] after incorporating mail into a folder."
2995 :type 'hook
2996 :group 'mh-hooks
23347d76
BW
2997 :group 'mh-inc
2998 :package-version '(MH-E "6.0"))
dda00b2c 2999
23347d76 3000(mh-defcustom mh-insert-signature-hook nil
dda00b2c
BW
3001 "Hook run by \\<mh-letter-mode-map>\\[mh-insert-signature] after signature has been inserted.
3002
3003Hook functions may access the actual name of the file or the
3004function used to insert the signature with
3005`mh-signature-file-name'."
3006 :type 'hook
3007 :group 'mh-hooks
23347d76
BW
3008 :group 'mh-letter
3009 :package-version '(MH-E "8.0"))
dda00b2c 3010
23347d76 3011(mh-defcustom mh-kill-folder-suppress-prompt-hooks '(mh-search-p)
dda00b2c
BW
3012 "Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder].
3013
3014The hook functions are called with no arguments and should return
3015a non-nil value to suppress the normal prompt when you remove a
3016folder. This is useful for folders that are easily regenerated.
3017
3018The default value of `mh-search-p' suppresses the prompt on
3019folders generated by searching.
3020
3021WARNING: Use this hook with care. If there is a bug in your hook
3022which returns t on \"+inbox\" and you hit \\[mh-kill-folder] by
3023accident in the \"+inbox\" folder, you will not be happy."
3024 :type 'hook
3025 :group 'mh-hooks
23347d76
BW
3026 :group 'mh-folder
3027 :package-version '(MH-E "7.4"))
dda00b2c 3028
23347d76 3029(mh-defcustom mh-letter-mode-hook nil
dda00b2c
BW
3030 "Hook run by `mh-letter-mode' on a new letter.
3031
3032This hook allows you to do some processing before editing a
3033letter. For example, you may wish to modify the header after
3034\"repl\" has done its work, or you may have a complicated
3035\"components\" file and need to tell MH-E where the cursor should
3036go."
3037 :type 'hook
3038 :group 'mh-hooks
23347d76
BW
3039 :group 'mh-sending-mail
3040 :package-version '(MH-E "6.0"))
dda00b2c 3041
23347d76 3042(mh-defcustom mh-mh-to-mime-hook nil
dda00b2c
BW
3043 "Hook run on the formatted letter by \\<mh-letter-mode-map>\\[mh-mh-to-mime]."
3044 :type 'hook
3045 :group 'mh-hooks
23347d76
BW
3046 :group 'mh-letter
3047 :package-version '(MH-E "8.0"))
dda00b2c 3048
23347d76 3049(mh-defcustom mh-search-mode-hook nil
dda00b2c
BW
3050 "Hook run upon entry to `mh-search-mode'\\<mh-folder-mode-map>.
3051
3052If you find that you do the same thing over and over when editing
3053the search template, you may wish to bind some shortcuts to keys.
3054This can be done with this hook which is called when
3055\\[mh-search] is run on a new pattern."
3056 :type 'hook
3057 :group 'mh-hooks
23347d76
BW
3058 :group 'mh-search
3059 :package-version '(MH-E "8.0"))
dda00b2c 3060
23347d76 3061(mh-defcustom mh-quit-hook nil
dda00b2c
BW
3062 "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
3063
3064This hook is not run in an MH-E context, so you might use it to
3065modify the window setup.
3066
3067See also `mh-before-quit-hook'."
3068 :type 'hook
3069 :group 'mh-hooks
23347d76
BW
3070 :group 'mh-folder
3071 :package-version '(MH-E "6.0"))
dda00b2c 3072
23347d76 3073(mh-defcustom mh-refile-msg-hook nil
dda00b2c
BW
3074 "Hook run by \\<mh-folder-mode-map>\\[mh-refile-msg] after marking each message for refiling."
3075 :type 'hook
3076 :group 'mh-hooks
23347d76
BW
3077 :group 'mh-folder
3078 :package-version '(MH-E "6.0"))
dda00b2c 3079
23347d76 3080(mh-defcustom mh-show-hook nil
dda00b2c
BW
3081 "Hook run after \\<mh-folder-mode-map>\\[mh-show] shows a message.
3082
3083It is the last thing called after messages are displayed. It's
3084used to affect the behavior of MH-E in general or when
3085`mh-show-mode-hook' is too early. See `mh-show-mode-hook'."
3086 :type 'hook
3087 :group 'mh-hooks
23347d76
BW
3088 :group 'mh-show
3089 :package-version '(MH-E "6.0"))
dda00b2c 3090
23347d76 3091(mh-defcustom mh-show-mode-hook nil
dda00b2c
BW
3092 "Hook run upon entry to `mh-show-mode'.
3093
3094This hook is called early on in the process of the message
3095display. It is usually used to perform some action on the
3096message's content. See `mh-show-hook'."
3097 :type 'hook
3098 :group 'mh-hooks
23347d76
BW
3099 :group 'mh-show
3100 :package-version '(MH-E "6.0"))
dda00b2c 3101
23347d76 3102(mh-defcustom mh-unseen-updated-hook nil
dda00b2c
BW
3103 "Hook run after the unseen sequence has been updated.
3104
3105The variable `mh-seen-list' can be used by this hook to obtain
3106the list of messages which were removed from the unseen
3107sequence."
3108 :type 'hook
3109 :group 'mh-hooks
23347d76
BW
3110 :group 'mh-sequences
3111 :package-version '(MH-E "6.0"))
a1b4049d 3112
bdcfe844 3113\f
a1b4049d 3114
dda00b2c
BW
3115;;; Faces (:group 'mh-faces + group where faces described)
3116
3117(if (boundp 'facemenu-unlisted-faces)
3118 (add-to-list 'facemenu-unlisted-faces "^mh-"))
3119
367c48ef
BW
3120;; To add a new face:
3121;; 1. Add entry to variable mh-face-data.
3122;; 2. Create face using mh-defface (which removes min-color spec and
3123;; :package-version keyword where these are not supported),
3124;; accessing face data with function mh-face-data.
3125;; 3. Add inherit argument to function mh-face-data if applicable.
6d21875b
BW
3126(defvar mh-face-data
3127 '((mh-folder-followup
3128 ((((class color) (background light))
3129 (:foreground "blue3"))
3130 (((class color) (background dark))
3131 (:foreground "LightGoldenRod"))
3132 (t
3133 (:bold t))))
3134 (mh-folder-msg-number
3135 ((((class color) (min-colors 64) (background light))
3136 (:foreground "snow4"))
3137 (((class color) (min-colors 64) (background dark))
3138 (:foreground "snow3"))
b95d0a24
BW
3139 (((class color) (background light))
3140 (:foreground "purple"))
3141 (((class color) (background dark))
6d21875b
BW
3142 (:foreground "cyan"))))
3143 (mh-folder-refiled
3144 ((((class color) (min-colors 64) (background light))
3145 (:foreground "DarkGoldenrod"))
3146 (((class color) (min-colors 64) (background dark))
3147 (:foreground "LightGoldenrod"))
3148 (((class color))
3149 (:foreground "yellow" :weight light))
3150 (((class grayscale) (background light))
3151 (:foreground "Gray90" :bold t :italic t))
3152 (((class grayscale) (background dark))
3153 (:foreground "DimGray" :bold t :italic t))
3154 (t
3155 (:bold t :italic t))))
3156 (mh-folder-subject
3157 ((((class color) (background light))
3158 (:foreground "blue4"))
3159 (((class color) (background dark))
3160 (:foreground "yellow"))
3161 (t
3162 (:bold t))))
3163 (mh-folder-tick
b95d0a24 3164 ((((class color) (background light))
6d21875b 3165 (:background "#dddf7e"))
b95d0a24 3166 (((class color) (background dark))
6d21875b
BW
3167 (:background "#dddf7e"))
3168 (t
3169 (:underline t))))
3170 (mh-folder-to
3171 ((((class color) (min-colors 64) (background light))
3172 (:foreground "RosyBrown"))
3173 (((class color) (min-colors 64) (background dark))
3174 (:foreground "LightSalmon"))
3175 (((class color))
3176 (:foreground "green"))
3177 (((class grayscale) (background light))
3178 (:foreground "DimGray" :italic t))
3179 (((class grayscale) (background dark))
3180 (:foreground "LightGray" :italic t))
3181 (t
3182 (:italic t))))
3183 (mh-letter-header-field
3184 ((((class color) (background light))
3185 (:background "gray90"))
3186 (((class color) (background dark))
3187 (:background "gray10"))
3188 (t
3189 (:bold t))))
3190 (mh-search-folder
3191 ((((class color) (background light))
3192 (:foreground "dark green" :bold t))
3193 (((class color) (background dark))
3194 (:foreground "indian red" :bold t))
3195 (t
3196 (:bold t))))
3197 (mh-show-cc
3198 ((((class color) (min-colors 64) (background light))
3199 (:foreground "DarkGoldenrod"))
3200 (((class color) (min-colors 64) (background dark))
3201 (:foreground "LightGoldenrod"))
3202 (((class color))
3203 (:foreground "yellow" :weight light))
3204 (((class grayscale) (background light))
3205 (:foreground "Gray90" :bold t :italic t))
3206 (((class grayscale) (background dark))
3207 (:foreground "DimGray" :bold t :italic t))
3208 (t
3209 (:bold t :italic t))))
3210 (mh-show-date
3211 ((((class color) (min-colors 64) (background light))
3212 (:foreground "ForestGreen"))
3213 (((class color) (min-colors 64) (background dark))
3214 (:foreground "PaleGreen"))
3215 (((class color))
3216 (:foreground "green"))
3217 (((class grayscale) (background light))
3218 (:foreground "Gray90" :bold t))
3219 (((class grayscale) (background dark))
3220 (:foreground "DimGray" :bold t))
3221 (t
3222 (:bold t :underline t))))
3223 (mh-show-from
3224 ((((class color) (background light))
3225 (:foreground "red3"))
3226 (((class color) (background dark))
3227 (:foreground "cyan"))
3228 (t
3229 (:bold t))))
3230 (mh-show-header
3231 ((((class color) (min-colors 64) (background light))
3232 (:foreground "RosyBrown"))
3233 (((class color) (min-colors 64) (background dark))
3234 (:foreground "LightSalmon"))
3235 (((class color))
3236 (:foreground "green"))
3237 (((class grayscale) (background light))
3238 (:foreground "DimGray" :italic t))
3239 (((class grayscale) (background dark))
3240 (:foreground "LightGray" :italic t))
3241 (t
3242 (:italic t))))
3243 (mh-show-pgg-bad ((t (:bold t :foreground "DeepPink1"))))
3244 (mh-show-pgg-good ((t (:bold t :foreground "LimeGreen"))))
3245 (mh-show-pgg-unknown ((t (:bold t :foreground "DarkGoldenrod2"))))
3246 (mh-show-signature ((t (:italic t))))
3247 (mh-show-to
3248 ((((class color) (background light))
3249 (:foreground "SaddleBrown"))
3250 (((class color) (background dark))
3251 (:foreground "burlywood"))
3252 (((class grayscale) (background light))
3253 (:foreground "DimGray" :underline t))
3254 (((class grayscale) (background dark))
3255 (:foreground "LightGray" :underline t))
3256 (t (:underline t))))
3257 (mh-speedbar-folder
3258 ((((class color) (background light))
3259 (:foreground "blue4"))
3260 (((class color) (background dark))
3261 (:foreground "light blue"))))
3262 (mh-speedbar-selected-folder
3263 ((((class color) (background light))
3264 (:foreground "red1" :underline t))
3265 (((class color) (background dark))
3266 (:foreground "red1" :underline t))
3267 (t
367c48ef
BW
3268 (:underline t)))))
3269 "MH-E face data.
3270Used by function `mh-face-data' which returns spec that is
3271consumed by `mh-defface'.")
3272
3273(require 'cus-face)
3274
3275(defvar mh-inherit-face-flag (assq :inherit custom-face-attributes)
3276 "Non-nil means that the `defface' :inherit keyword is available.
3277The :inherit keyword is available on all supported versions of
3278GNU Emacs and XEmacs from at least 21.5.23 on.")
3279
3280(defvar mh-min-colors-defined-flag (and (not mh-xemacs-flag)
3281 (>= emacs-major-version 22))
3282 "Non-nil means `defface' supports min-colors display requirement.")
6d21875b
BW
3283
3284(defun mh-face-data (face &optional inherit)
3285 "Return spec for FACE.
367c48ef 3286See `defface' for the spec definition.
6d21875b 3287
367c48ef
BW
3288If INHERIT is non-nil and `defface' supports the :inherit
3289keyword, return INHERIT literally; otherwise, return spec for
3290FACE from the variable `mh-face-data'. This isn't a perfect
3291implementation. In the case that the :inherit keyword is not
3292supported, any additional attributes in the inherit parameter are
3293not added to the returned spec.
3294
3295Furthermore, when `mh-min-colors-defined-flag' is nil, this
3296function finds display entries with \"min-colors\" requirements
3297and either removes the \"min-colors\" requirement or strips the
3298display entirely if the display does not support the number of
3299specified colors."
3300 (let ((spec
3301 (if (and inherit mh-inherit-face-flag)
3302 inherit
3303 (or (cadr (assq face mh-face-data))
3304 (error "Could not find %s in mh-face-data" face)))))
3305
3306 (if mh-min-colors-defined-flag
3307 spec
3308 (let ((cells (mh-display-color-cells))
3309 new-spec)
3310 ;; Remove entries with min-colors, or delete them if we have
3311 ;; fewer colors than they specify.
3312 (loop for entry in (reverse spec) do
3313 (let ((requirement (if (eq (car entry) t)
3314 nil
3315 (assq 'min-colors (car entry)))))
3316 (if requirement
3317 (when (>= cells (nth 1 requirement))
3318 (setq new-spec (cons (cons (delq requirement (car entry))
3319 (cdr entry))
3320 new-spec)))
3321 (setq new-spec (cons entry new-spec)))))
3322 new-spec))))
6d21875b 3323
23347d76 3324(mh-defface mh-folder-address
6d21875b 3325 (mh-face-data 'mh-folder-subject '((t (:inherit mh-folder-subject))))
dda00b2c
BW
3326 "Recipient face."
3327 :group 'mh-faces
23347d76
BW
3328 :group 'mh-folder
3329 :package-version '(MH-E "8.0"))
dda00b2c 3330
23347d76 3331(mh-defface mh-folder-body
6d21875b
BW
3332 (mh-face-data 'mh-folder-msg-number
3333 '((((class color))
3334 (:inherit mh-folder-msg-number))
3335 (t
3336 (:inherit mh-folder-msg-number :italic t))))
dda00b2c
BW
3337 "Body text face."
3338 :group 'mh-faces
23347d76
BW
3339 :group 'mh-folder
3340 :package-version '(MH-E "8.0"))
dda00b2c 3341
23347d76 3342(mh-defface mh-folder-cur-msg-number
6d21875b
BW
3343 (mh-face-data 'mh-folder-msg-number
3344 '((t (:inherit mh-folder-msg-number :bold t))))
dda00b2c
BW
3345 "Current message number face."
3346 :group 'mh-faces
23347d76
BW
3347 :group 'mh-folder
3348 :package-version '(MH-E "8.0"))
dda00b2c 3349
23347d76 3350(mh-defface mh-folder-date
6d21875b 3351 (mh-face-data 'mh-folder-msg-number '((t (:inherit mh-folder-msg-number))))
dda00b2c
BW
3352 "Date face."
3353 :group 'mh-faces
23347d76
BW
3354 :group 'mh-folder
3355 :package-version '(MH-E "8.0"))
dda00b2c 3356
23347d76 3357(mh-defface mh-folder-deleted
6d21875b 3358 (mh-face-data 'mh-folder-msg-number '((t (:inherit mh-folder-msg-number))))
dda00b2c
BW
3359 "Deleted message face."
3360 :group 'mh-faces
23347d76
BW
3361 :group 'mh-folder
3362 :package-version '(MH-E "8.0"))
dda00b2c 3363
23347d76 3364(mh-defface mh-folder-followup (mh-face-data 'mh-folder-followup)
dda00b2c
BW
3365 "\"Re:\" face."
3366 :group 'mh-faces
23347d76
BW
3367 :group 'mh-folder
3368 :package-version '(MH-E "8.0"))
dda00b2c 3369
23347d76 3370(mh-defface mh-folder-msg-number (mh-face-data 'mh-folder-msg-number)
dda00b2c
BW
3371 "Message number face."
3372 :group 'mh-faces
23347d76
BW
3373 :group 'mh-folder
3374 :package-version '(MH-E "8.0"))
dda00b2c 3375
23347d76 3376(mh-defface mh-folder-refiled (mh-face-data 'mh-folder-refiled)
dda00b2c
BW
3377 "Refiled message face."
3378 :group 'mh-faces
23347d76
BW
3379 :group 'mh-folder
3380 :package-version '(MH-E "8.0"))
dda00b2c 3381
23347d76 3382(mh-defface mh-folder-sent-to-me-hint
6d21875b 3383 (mh-face-data 'mh-folder-msg-number '((t (:inherit mh-folder-date))))
dda00b2c
BW
3384 "Fontification hint face in messages sent directly to us.
3385The detection of messages sent to us is governed by the scan
3386format `mh-scan-format-nmh' and the regular expression
3387`mh-scan-sent-to-me-sender-regexp'."
3388 :group 'mh-faces
23347d76
BW
3389 :group 'mh-folder
3390 :package-version '(MH-E "8.0"))
dda00b2c 3391
23347d76 3392(mh-defface mh-folder-sent-to-me-sender
6d21875b 3393 (mh-face-data 'mh-folder-followup '((t (:inherit mh-folder-followup))))
dda00b2c
BW
3394 "Sender face in messages sent directly to us.
3395The detection of messages sent to us is governed by the scan
3396format `mh-scan-format-nmh' and the regular expression
3397`mh-scan-sent-to-me-sender-regexp'."
3398 :group 'mh-faces
23347d76
BW
3399 :group 'mh-folder
3400 :package-version '(MH-E "8.0"))
dda00b2c 3401
23347d76 3402(mh-defface mh-folder-subject (mh-face-data 'mh-folder-subject)
dda00b2c
BW
3403 "Subject face."
3404 :group 'mh-faces
23347d76
BW
3405 :group 'mh-folder
3406 :package-version '(MH-E "8.0"))
dda00b2c 3407
23347d76 3408(mh-defface mh-folder-tick (mh-face-data 'mh-folder-tick)
dda00b2c
BW
3409 "Ticked message face."
3410 :group 'mh-faces
23347d76
BW
3411 :group 'mh-folder
3412 :package-version '(MH-E "8.0"))
dda00b2c 3413
23347d76 3414(mh-defface mh-folder-to (mh-face-data 'mh-folder-to)
dda00b2c
BW
3415 "\"To:\" face."
3416 :group 'mh-faces
23347d76
BW
3417 :group 'mh-folder
3418 :package-version '(MH-E "8.0"))
dda00b2c 3419
23347d76 3420(mh-defface mh-letter-header-field (mh-face-data 'mh-letter-header-field)
dda00b2c
BW
3421 "Editable header field value face in draft buffers."
3422 :group 'mh-faces
23347d76
BW
3423 :group 'mh-letter
3424 :package-version '(MH-E "8.0"))
dda00b2c 3425
23347d76 3426(mh-defface mh-search-folder (mh-face-data 'mh-search-folder)
6d21875b
BW
3427 "Folder heading face in MH-Folder buffers created by searches."
3428 :group 'mh-faces
23347d76
BW
3429 :group 'mh-search
3430 :package-version '(MH-E "8.0"))
6d21875b 3431
23347d76 3432(mh-defface mh-show-cc (mh-face-data 'mh-show-cc)
dda00b2c
BW
3433 "Face used to highlight \"cc:\" header fields."
3434 :group 'mh-faces
23347d76
BW
3435 :group 'mh-show
3436 :package-version '(MH-E "8.0"))
dda00b2c 3437
23347d76 3438(mh-defface mh-show-date (mh-face-data 'mh-show-date)
dda00b2c
BW
3439 "Face used to highlight \"Date:\" header fields."
3440 :group 'mh-faces
23347d76
BW
3441 :group 'mh-show
3442 :package-version '(MH-E "8.0"))
dda00b2c 3443
23347d76 3444(mh-defface mh-show-from (mh-face-data 'mh-show-from)
dda00b2c
BW
3445 "Face used to highlight \"From:\" header fields."
3446 :group 'mh-faces
23347d76
BW
3447 :group 'mh-show
3448 :package-version '(MH-E "8.0"))
dda00b2c 3449
23347d76 3450(mh-defface mh-show-header (mh-face-data 'mh-show-header)
dda00b2c
BW
3451 "Face used to deemphasize less interesting header fields."
3452 :group 'mh-faces
23347d76
BW
3453 :group 'mh-show
3454 :package-version '(MH-E "8.0"))
dda00b2c 3455
23347d76 3456(mh-defface mh-show-pgg-bad (mh-face-data 'mh-show-pgg-bad)
dda00b2c
BW
3457 "Bad PGG signature face."
3458 :group 'mh-faces
23347d76
BW
3459 :group 'mh-show
3460 :package-version '(MH-E "8.0"))
dda00b2c 3461
23347d76 3462(mh-defface mh-show-pgg-good (mh-face-data 'mh-show-pgg-good)
dda00b2c
BW
3463 "Good PGG signature face."
3464 :group 'mh-faces
23347d76
BW
3465 :group 'mh-show
3466 :package-version '(MH-E "8.0"))
dda00b2c 3467
23347d76 3468(mh-defface mh-show-pgg-unknown (mh-face-data 'mh-show-pgg-unknown)
dda00b2c
BW
3469 "Unknown or untrusted PGG signature face."
3470 :group 'mh-faces
23347d76
BW
3471 :group 'mh-show
3472 :package-version '(MH-E "8.0"))
dda00b2c 3473
23347d76 3474(mh-defface mh-show-signature (mh-face-data 'mh-show-signature)
dda00b2c
BW
3475 "Signature face."
3476 :group 'mh-faces
23347d76
BW
3477 :group 'mh-show
3478 :package-version '(MH-E "8.0"))
dda00b2c 3479
23347d76 3480(mh-defface mh-show-subject
6d21875b 3481 (mh-face-data 'mh-folder-subject '((t (:inherit mh-folder-subject))))
dda00b2c
BW
3482 "Face used to highlight \"Subject:\" header fields."
3483 :group 'mh-faces
23347d76
BW
3484 :group 'mh-show
3485 :package-version '(MH-E "8.0"))
dda00b2c 3486
23347d76 3487(mh-defface mh-show-to (mh-face-data 'mh-show-to)
dda00b2c
BW
3488 "Face used to highlight \"To:\" header fields."
3489 :group 'mh-faces
23347d76
BW
3490 :group 'mh-show
3491 :package-version '(MH-E "8.0"))
dda00b2c 3492
23347d76 3493(mh-defface mh-show-xface
6d21875b 3494 (mh-face-data 'mh-show-from '((t (:inherit (mh-show-from highlight)))))
6d21875b 3495"X-Face image face.
dda00b2c
BW
3496The background and foreground are used in the image."
3497 :group 'mh-faces
23347d76
BW
3498 :group 'mh-show
3499 :package-version '(MH-E "8.0"))
dda00b2c 3500
23347d76 3501(mh-defface mh-speedbar-folder (mh-face-data 'mh-speedbar-folder)
dda00b2c
BW
3502 "Basic folder face."
3503 :group 'mh-faces
23347d76
BW
3504 :group 'mh-speedbar
3505 :package-version '(MH-E "8.0"))
dda00b2c 3506
23347d76 3507(mh-defface mh-speedbar-folder-with-unseen-messages
6d21875b
BW
3508 (mh-face-data 'mh-speedbar-folder
3509 '((t (:inherit mh-speedbar-folder :bold t))))
dda00b2c
BW
3510 "Folder face when folder contains unread messages."
3511 :group 'mh-faces
23347d76
BW
3512 :group 'mh-speedbar
3513 :package-version '(MH-E "8.0"))
dda00b2c 3514
23347d76 3515(mh-defface mh-speedbar-selected-folder
6d21875b 3516 (mh-face-data 'mh-speedbar-selected-folder)
dda00b2c
BW
3517 "Selected folder face."
3518 :group 'mh-faces
23347d76
BW
3519 :group 'mh-speedbar
3520 :package-version '(MH-E "8.0"))
dda00b2c 3521
23347d76 3522(mh-defface mh-speedbar-selected-folder-with-unseen-messages
6d21875b
BW
3523 (mh-face-data 'mh-speedbar-selected-folder
3524 '((t (:inherit mh-speedbar-selected-folder :bold t))))
dda00b2c
BW
3525 "Selected folder face when folder contains unread messages."
3526 :group 'mh-faces
23347d76
BW
3527 :group 'mh-speedbar
3528 :package-version '(MH-E "8.0"))
f1ed9461 3529
6d21875b 3530;; Get rid of temporary functions and data structures.
23347d76
BW
3531(fmakunbound 'mh-defcustom)
3532(fmakunbound 'mh-defface)
23347d76 3533(fmakunbound 'mh-defgroup)
6d21875b 3534(fmakunbound 'mh-face-data)
367c48ef 3535(fmakunbound 'mh-strip-package-version)
6d21875b
BW
3536(makunbound 'mh-face-data)
3537(makunbound 'mh-inherit-face-flag)
3538(makunbound 'mh-min-colors-defined-flag)
3539
bdcfe844
BW
3540(provide 'mh-e)
3541
cee9f5c6
BW
3542;; Local Variables:
3543;; indent-tabs-mode: nil
3544;; sentence-end-double-space: nil
3545;; End:
bdcfe844 3546
cee9f5c6 3547;; arch-tag: cce884de-bd37-4104-9963-e4439d5ed22b
c26cf6c8 3548;;; mh-e.el ends here