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