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