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