1 ;;; mh-e.el --- GNU Emacs interface to the MH mail system
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.
7 ;; Author: Bill Wohler <wohler@newt.com>
8 ;; Maintainer: Bill Wohler <wohler@newt.com>
12 ;; This file is part of GNU Emacs.
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)
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.
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.
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.
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)
41 ;; If Emacs can't find mh-rmail or mh-smail, add the following to ~/.emacs:
42 ;; (require 'mh-autoloads)
44 ;; If you want to customize MH-E before explicitly loading it, add this:
45 ;; (require 'mh-cus-load)
47 ;; MH (Message Handler) is a powerful mail reader.
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
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.
58 ;; MH-E is an Emacs interface to the MH mail system.
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.
65 ;; mh-e-users@lists.sourceforge.net
66 ;; mh-e-announce@lists.sourceforge.net
67 ;; mh-e-devel@lists.sourceforge.net
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
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.
79 ;; https://sourceforge.net/tracker/?group_id=13357&atid=363357
82 ;; https://sourceforge.net/tracker/?group_id=13357&atid=213357
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.
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)
103 (defvar mh-xemacs-flag (featurep 'xemacs)
104 "Non-nil means the current Emacs is XEmacs."))
106 (require 'mh-xemacs))
108 (require 'mh-buffers)
115 ;; Try to keep variables local to a single file. Provide accessors if
116 ;; variables are shared. Use this section as a last resort.
118 (defconst mh-version "7.85+sans-entropy" "Version number of MH-E.")
123 '("/usr/local/nmh/bin" ; nmh default
126 "/usr/bin/mh/" ; Ultrix 4.2, Linux
127 "/usr/new/mh/" ; Ultrix < 4.2
128 "/usr/contrib/mh/bin/" ; BSDI
129 "/usr/pkg/bin/" ; NetBSD
131 "/usr/local/bin/mu-mh/" ; GNU mailutils - default
132 "/usr/bin/mu-mh/") ; GNU mailutils - packaged
133 "List of directories to search for variants of the MH variant.
134 The list `exec-path' is searched in addition to this list.
135 There's no need for users to modify this list. Instead add extra
136 directories to the customizable variable `mh-path'.")
138 (defvar mh-variants nil
139 "List describing known MH variants.
140 Do not access this variable directly as it may not have yet been initialized.
141 Use the function `mh-variants' instead.")
143 (defvar mh-variant-in-use nil
144 "The MH variant currently in use; a string with variant and version number.
145 This differs from `mh-variant' when the latter is set to
149 "Directory containing MH commands, such as inc, repl, and rmm.")
152 (put 'mh-progs 'risky-local-variable t)
155 "Directory containing the MH library.
156 This directory contains, among other things, the components file.")
159 (put 'mh-lib 'risky-local-variable t)
161 (defvar mh-lib-progs nil
162 "Directory containing MH helper programs.
163 This directory contains, among other things, the mhl program.")
166 (put 'mh-lib-progs 'risky-local-variable t)
168 ;; Profile Components
170 (defvar mh-draft-folder nil
171 "Cached value of the \"Draft-Folder:\" MH profile component.
172 Name of folder containing draft messages.
173 Nil means do not use a draft folder.")
176 "Cached value of the \"Inbox:\" MH profile component.
177 Set to \"+inbox\" if no such component.
178 Name of the Inbox folder.")
180 (defvar mh-user-path nil
181 "Cached value of the \"Path:\" MH profile component.
182 User's mail folder directory.")
184 ;; Maps declared here so that they can be used in docstrings.
186 (defvar mh-folder-mode-map (make-keymap)
187 "Keymap for MH-Folder mode.")
189 (defvar mh-folder-seq-tool-bar-map nil
190 "Keymap for MH-Folder tool bar.")
192 (defvar mh-folder-tool-bar-map nil
193 "Keymap for MH-Folder tool bar.")
195 (defvar mh-inc-spool-map (make-sparse-keymap)
196 "Keymap for MH-E's mh-inc-spool commands.")
198 (defvar mh-letter-mode-map (copy-keymap text-mode-map)
199 "Keymap for MH-Letter mode.")
201 (defvar mh-letter-tool-bar-map nil
202 "Keymap for MH-Letter tool bar.")
204 (defvar mh-search-mode-map (make-sparse-keymap)
205 "Keymap for MH-Search mode.")
207 (defvar mh-show-mode-map (make-sparse-keymap)
208 "Keymap MH-Show mode.")
210 (defvar mh-show-seq-tool-bar-map nil
211 "Keymap for MH-Show tool bar.")
213 (defvar mh-show-tool-bar-map nil
214 "Keymap for MH-Show tool bar.")
216 ;; MH-Folder Locals (alphabetical)
218 (defvar mh-arrow-marker nil
219 "Marker for arrow display in fringe.")
221 (defvar mh-colors-available-flag nil
222 "Non-nil means colors are available.")
224 (defvar mh-current-folder nil
225 "Name of current folder, a string.")
227 (defvar mh-delete-list nil
228 "List of message numbers to delete.
229 This variable can be used by
230 `mh-before-commands-processed-hook'.")
232 (defvar mh-folder-view-stack nil
233 "Stack of previous folder views.")
235 (defvar mh-index-data nil
236 "Info about index search results.")
238 (defvar mh-index-previous-search nil)
240 (defvar mh-index-msg-checksum-map nil)
242 (defvar mh-index-checksum-origin-map nil)
244 (defvar mh-index-sequence-search-flag nil)
246 (defvar mh-mode-line-annotation nil
247 "Message range displayed in buffer.")
249 (defvar mh-next-direction 'forward
250 "Direction to move to next message.")
252 (defvar mh-previous-window-config nil
253 "Window configuration before MH-E command.")
255 (defvar mh-refile-list nil
256 "List of folder names in `mh-seq-list'.
257 This variable can be used by
258 `mh-before-commands-processed-hook'.")
260 (defvar mh-seen-list nil
261 "List of displayed messages to be removed from the \"Unseen\" sequence.")
263 (defvar mh-seq-list nil
264 "Alist of this folder's sequences.
265 Elements have the form (SEQUENCE . MESSAGES).")
267 (defvar mh-sequence-notation-history nil
268 "Remember original notation that is overwritten by `mh-note-seq'.")
270 (defvar mh-show-buffer nil
271 "Buffer that displays message for this folder.")
273 (defvar mh-showing-mode nil
274 "If non-nil, show the message in a separate window.")
276 (defvar mh-view-ops nil
277 "Stack of operations that change the folder view.
278 These operations include narrowing or threading.")
280 ;; MH-Show Locals (alphabetical)
282 (defvar mh-globals-hash (make-hash-table)
283 "Keeps track of MIME data on a per buffer basis.")
285 (defvar mh-show-folder-buffer nil
286 "Keeps track of folder whose message is being displayed.")
290 (defvar mh-folders-changed nil
291 "Lists which folders were affected by deletes and refiles.
292 This list will always include the current folder
293 `mh-current-folder'. This variable can be used by
294 `mh-after-commands-processed-hook'.")
296 (defvar mh-mail-header-separator "--------"
297 "*Line used by MH to separate headers from text in messages being composed.
299 This variable should not be used directly in programs. Programs
300 should use `mail-header-separator' instead.
301 `mail-header-separator' is initialized to
302 `mh-mail-header-separator' in `mh-letter-mode'; in other
303 contexts, you may have to perform this initialization yourself.
305 Do not make this a regular expression as it may be the argument
306 to `insert' and it is passed through `regexp-quote' before being
307 used by functions like `re-search-forward'.")
309 (defvar mh-sent-from-folder nil
310 "Folder of msg assoc with this letter.")
312 (defvar mh-sent-from-msg nil
313 "Number of msg assoc with this letter.")
317 (defvar mh-unseen-seq nil
318 "Cached value of the \"Unseen-Sequence:\" MH profile component.
319 Name of the Unseen sequence.")
321 (defvar mh-previous-seq nil
322 "Cached value of the \"Previous-Sequence:\" MH profile component.
323 Name of the Previous sequence.")
325 ;; Etc. (alphabetical)
327 (defvar mh-flists-present-flag nil
328 "Non-nil means that we have \"flists\".")
330 (defvar mh-index-data-file ".mhe_index"
331 "MH-E specific file where index seach info is stored.")
333 (defvar mh-letter-header-field-regexp "^\\([A-Za-z][A-Za-z0-9-]*\\):")
335 (defvar mh-page-to-next-msg-flag nil
336 "Non-nil means next SPC or whatever goes to next undeleted message.")
338 (defvar mh-pgp-support-flag (not (not (locate-library "mml2015")))
339 "Non-nil means PGP support is available.")
341 (defvar mh-signature-separator "-- \n"
342 "Text of a signature separator.
344 A signature separator is used to separate the body of a message
345 from the signature. This can be used by user agents such as MH-E
346 to render the signature differently or to suppress the inclusion
347 of the signature in a reply. Use `mh-signature-separator-regexp'
348 when searching for a separator.")
350 (defvar mh-signature-separator-regexp "^-- $"
351 "This regular expression matches the signature separator.
352 See `mh-signature-separator'.")
354 (defvar mh-thread-scan-line-map nil
355 "Map of message index to various parts of the scan line.")
356 (make-variable-buffer-local 'mh-thread-scan-line-map)
358 (defvar mh-thread-scan-line-map-stack nil
359 "Old map of message index to various parts of the scan line.
360 This is the original map that is stored when the folder is
362 (make-variable-buffer-local 'mh-thread-scan-line-map-stack)
364 (defvar mh-x-mailer-string nil
365 "*String containing the contents of the X-Mailer header field.
366 If nil, this variable is initialized to show the version of MH-E,
367 Emacs, and MH the first time a message is composed.")
371 ;;; MH-E Entry Points
373 (eval-when-compile (require 'gnus))
375 (defmacro mh-macro-expansion-time-gnus-version ()
376 "Return Gnus version available at macro expansion time.
377 The macro evaluates the Gnus version at macro expansion time. If
378 MH-E was compiled then macro expansion happens at compile time."
381 (defun mh-run-time-gnus-version ()
382 "Return Gnus version available at run time."
388 "Display version information about MH-E and the MH mail handling system."
390 (set-buffer (get-buffer-create mh-info-buffer))
393 (insert "MH-E " mh-version "\n\n")
394 ;; MH-E compilation details.
395 (insert "MH-E compilation details:\n")
396 (let* ((compiled-mhe (byte-code-function-p (symbol-function 'mh-version)))
397 (gnus-compiled-version (if compiled-mhe
398 (mh-macro-expansion-time-gnus-version)
400 (insert " Byte compiled:\t\t" (if compiled-mhe "yes" "no") "\n"
401 " Gnus (compile-time):\t" gnus-compiled-version "\n"
402 " Gnus (run-time):\t" (mh-run-time-gnus-version) "\n\n"))
404 (insert (emacs-version) "\n\n")
406 (if mh-variant-in-use
407 (insert mh-variant-in-use "\n"
408 " mh-progs:\t" mh-progs "\n"
409 " mh-lib:\t" mh-lib "\n"
410 " mh-lib-progs:\t" mh-lib-progs "\n\n")
411 (insert "No MH variant detected\n"))
414 (call-process "uname" nil t nil "-a")
416 (goto-char (point-min))
417 (display-buffer mh-info-buffer))
423 (defun mh-list-to-string (l)
424 "Flatten the list L and make every element of the new list into a string."
425 (nreverse (mh-list-to-string-1 l)))
427 (defun mh-list-to-string-1 (l)
428 "Flatten the list L and make every element of the new list into a string."
429 (let ((new-list nil))
431 (cond ((null (car l)))
433 (setq new-list (cons (symbol-name (car l)) new-list)))
435 (setq new-list (cons (int-to-string (car l)) new-list)))
437 ((stringp (car l)) (setq new-list (cons (car l) new-list)))
439 (setq new-list (nconc (mh-list-to-string-1 (car l))
441 (t (error "Bad element in `mh-list-to-string': %s" (car l))))
447 ;;; MH-E Process Support
449 (defvar mh-index-max-cmdline-args 500
450 "Maximum number of command line args.")
452 (defun mh-xargs (cmd &rest args)
453 "Partial imitation of xargs.
454 The current buffer contains a list of strings, one on each line.
455 The function will execute CMD with ARGS and pass the first
456 `mh-index-max-cmdline-args' strings to it. This is repeated till
457 all the strings have been used."
458 (goto-char (point-min))
459 (let ((current-buffer (current-buffer)))
461 (let ((out (current-buffer)))
462 (set-buffer current-buffer)
464 (let ((arg-list (reverse args))
466 (while (and (not (eobp)) (< count mh-index-max-cmdline-args))
467 (push (buffer-substring-no-properties (point) (line-end-position))
471 (apply #'call-process cmd nil (list out nil) nil
472 (nreverse arg-list))))
474 (insert-buffer-substring out)))))
476 ;; XXX This should be applied anywhere MH-E calls out to /bin/sh.
477 (defun mh-quote-for-shell (string)
478 "Quote STRING for /bin/sh.
479 Adds double-quotes around entire string and quotes the characters
480 \\, `, and $ with a backslash."
482 (loop for x across string
483 concat (format (if (memq x '(?\\ ?` ?$)) "\\%c" "%c") x))
486 (defun mh-exec-cmd (command &rest args)
487 "Execute mh-command COMMAND with ARGS.
488 The side effects are what is desired. Any output is assumed to be
489 an error and is shown to the user. The output is not read or
492 (set-buffer (get-buffer-create mh-log-buffer))
493 (let* ((initial-size (mh-truncate-log-buffer))
495 (args (mh-list-to-string args)))
496 (apply 'call-process (expand-file-name command mh-progs) nil t nil args)
497 (when (> (buffer-size) initial-size)
500 (insert "Errors when executing: " command)
501 (loop for arg in args do (insert " " arg))
503 (save-window-excursion
504 (switch-to-buffer-other-window mh-log-buffer)
507 (defun mh-exec-cmd-error (env command &rest args)
508 "In environment ENV, execute mh-command COMMAND with ARGS.
509 ENV is nil or a string of space-separated \"var=value\" elements.
510 Signals an error if process does not complete successfully."
512 (set-buffer (get-buffer-create mh-temp-buffer))
514 (let ((process-environment process-environment))
515 ;; XXX: We should purge the list that split-string returns of empty
516 ;; strings. This can happen in XEmacs if leading or trailing spaces
518 (dolist (elem (if (stringp env) (split-string env " ") ()))
519 (push elem process-environment))
520 (mh-handle-process-error
521 command (apply #'call-process (expand-file-name command mh-progs)
522 nil t nil (mh-list-to-string args))))))
524 (defun mh-exec-cmd-daemon (command filter &rest args)
525 "Execute MH command COMMAND in the background.
527 If FILTER is non-nil then it is used to process the output
528 otherwise the default filter `mh-process-daemon' is used. See
529 `set-process-filter' for more details of FILTER.
531 ARGS are passed to COMMAND as command line arguments."
533 (set-buffer (get-buffer-create mh-log-buffer))
534 (mh-truncate-log-buffer))
535 (let* ((process-connection-type nil)
536 (process (apply 'start-process
538 (expand-file-name command mh-progs)
539 (mh-list-to-string args))))
540 (set-process-filter process (or filter 'mh-process-daemon))
543 (defun mh-exec-cmd-env-daemon (env command filter &rest args)
544 "In ennvironment ENV, execute mh-command COMMAND in the background.
546 ENV is nil or a string of space-separated \"var=value\" elements.
547 Signals an error if process does not complete successfully.
549 If FILTER is non-nil then it is used to process the output
550 otherwise the default filter `mh-process-daemon' is used. See
551 `set-process-filter' for more details of FILTER.
553 ARGS are passed to COMMAND as command line arguments."
554 (let ((process-environment process-environment))
555 (dolist (elem (if (stringp env) (split-string env " ") ()))
556 (push elem process-environment))
557 (apply #'mh-exec-cmd-daemon command filter args)))
559 (defun mh-process-daemon (process output)
560 "PROCESS daemon that puts OUTPUT into a temporary buffer.
561 Any output from the process is displayed in an asynchronous
563 (with-current-buffer (get-buffer-create mh-log-buffer)
564 (insert-before-markers output)
565 (display-buffer mh-log-buffer)))
567 (defun mh-exec-cmd-quiet (raise-error command &rest args)
568 "Signal RAISE-ERROR if COMMAND with ARGS fails.
569 Execute MH command COMMAND with ARGS. ARGS is a list of strings.
570 Return at start of mh-temp buffer, where output can be parsed and
572 Returns value of `call-process', which is 0 for success, unless
573 RAISE-ERROR is non-nil, in which case an error is signaled if
574 `call-process' returns non-0."
575 (set-buffer (get-buffer-create mh-temp-buffer))
579 (expand-file-name command mh-progs) nil t nil
581 (goto-char (point-min))
583 (mh-handle-process-error command value)
586 (defun mh-exec-cmd-output (command display &rest args)
587 "Execute MH command COMMAND with DISPLAY flag and ARGS.
588 Put the output into buffer after point.
589 Set mark after inserted text.
590 Output is expected to be shown to user, not parsed by MH-E."
591 (push-mark (point) t)
593 (expand-file-name command mh-progs) nil t display
594 (mh-list-to-string args))
596 ;; The following is used instead of 'exchange-point-and-mark because the
597 ;; latter activates the current region (between point and mark), which
598 ;; turns on highlighting. So prior to this bug fix, doing "inc" would
599 ;; highlight a region containing the new messages, which is undesirable.
600 ;; The bug wasn't seen in emacs21 but still occurred in XEmacs21.4.
601 (mh-exchange-point-and-mark-preserving-active-mark))
604 (eval-when-compile (mh-do-in-xemacs (defvar mark-active)))
606 (defun mh-exchange-point-and-mark-preserving-active-mark ()
607 "Put the mark where point is now, and point where the mark is now.
608 This command works even when the mark is not active, and
609 preserves whether the mark is active or not."
611 (let ((is-active (and (boundp 'mark-active) mark-active)))
612 (let ((omark (mark t)))
614 (error "No mark set in this buffer"))
617 (if (boundp 'mark-active)
618 (setq mark-active is-active))
621 (defun mh-exec-lib-cmd-output (command &rest args)
622 "Execute MH library command COMMAND with ARGS.
623 Put the output into buffer after point.
624 Set mark after inserted text."
625 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args))
627 (defun mh-handle-process-error (command status)
628 "Raise error if COMMAND returned non-zero STATUS, otherwise return STATUS."
631 (goto-char (point-min))
632 (insert (if (integerp status)
633 (format "%s: exit code %d\n" command status)
634 (format "%s: %s\n" command status)))
636 (let ((error-message (buffer-substring (point-min) (point-max))))
637 (set-buffer (get-buffer-create mh-log-buffer))
638 (mh-truncate-log-buffer)
639 (insert error-message)))
640 (error "%s failed, check buffer %s for error message"
641 command mh-log-buffer)))
647 (defcustom mh-path nil
648 "*Additional list of directories to search for MH.
651 :type '(repeat (directory)))
653 (defun mh-variants ()
654 "Return a list of installed variants of MH on the system.
655 This function looks for MH in `mh-sys-path', `mh-path' and
656 `exec-path'. The format of the list of variants that is returned
657 is described by the variable `mh-variants'."
661 ;; Make a unique list of directories, keeping the given order.
662 ;; We don't want the same MH variant to be listed multiple times.
663 (loop for dir in (append mh-path mh-sys-path exec-path) do
664 (setq dir (file-chase-links (directory-file-name dir)))
665 (add-to-list 'list-unique dir))
666 (loop for dir in (nreverse list-unique) do
667 (when (and dir (file-directory-p dir) (file-readable-p dir))
668 (let ((variant (mh-variant-info dir)))
670 (add-to-list 'mh-variants variant)))))
673 (defun mh-variant-info (dir)
674 "Return MH variant found in DIR, or nil if none present."
676 (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
677 (set-buffer tmp-buffer)
679 ((mh-variant-mh-info dir))
680 ((mh-variant-nmh-info dir))
681 ((mh-variant-mu-mh-info dir))))))
683 (defun mh-variant-mh-info (dir)
684 "Return info for MH variant in DIR assuming a temporary buffer is setup."
685 ;; MH does not have the -version option.
686 ;; Its version number is included in the output of "-help" as:
688 ;; version: MH 6.8.4 #2[UCI] (burrito) of Fri Jan 15 20:01:39 EST 1999
689 ;; options: [ATHENA] [BIND] [DUMB] [LIBLOCKFILE] [LOCALE] [MAILGROUP] [MHE]
690 ;; [MHRC] [MIME] [MORE='"/usr/bin/sensible-pager"'] [NLINK_HACK]
691 ;; [NORUSERPASS] [OVERHEAD] [POP] [POPSERVICE='"pop-3"'] [RENAME]
692 ;; [RFC1342] [RPATHS] [RPOP] [SENDMTS] [SMTP] [SOCKETS]
693 ;; [SPRINTFTYPE=int] [SVR4] [SYS5] [SYS5DIR] [TERMINFO]
694 ;; [TYPESIG=void] [UNISTD] [UTK] [VSPRINTF]
695 (let ((mhparam (expand-file-name "mhparam" dir)))
696 (when (mh-file-command-p mhparam)
698 (call-process mhparam nil '(t nil) nil "-help")
699 (goto-char (point-min))
700 (when (search-forward-regexp "version: MH \\(\\S +\\)" nil t)
701 (let ((version (format "MH %s" (match-string 1))))
703 (call-process mhparam nil '(t nil) nil "libdir")
704 (goto-char (point-min))
705 (when (search-forward-regexp "^.*$" nil t)
706 (let ((libdir (match-string 0)))
709 (mh-lib-progs ,libdir)
714 (defun mh-variant-mu-mh-info (dir)
715 "Return info for GNU mailutils variant in DIR.
716 This assumes that a temporary buffer is setup."
717 ;; 'mhparam -version' output:
718 ;; mhparam (GNU mailutils 0.3.2)
719 (let ((mhparam (expand-file-name "mhparam" dir)))
720 (when (mh-file-command-p mhparam)
722 (call-process mhparam nil '(t nil) nil "-version")
723 (goto-char (point-min))
724 (when (search-forward-regexp "mhparam (\\(GNU [Mm]ailutils \\S +\\))"
726 (let ((version (match-string 1))
730 (mh-lib-progs ,(mh-profile-component "libdir"))
731 (mh-lib ,(mh-profile-component "etcdir"))
733 (flists ,(file-exists-p
734 (expand-file-name "flists" dir)))))))))
736 (defun mh-variant-nmh-info (dir)
737 "Return info for nmh variant in DIR assuming a temporary buffer is setup."
738 ;; `mhparam -version' outputs:
739 ;; mhparam -- nmh-1.1-RC1 [compiled on chaak at Fri Jun 20 11:03:28 PDT 2003]
740 (let ((mhparam (expand-file-name "mhparam" dir)))
741 (when (mh-file-command-p mhparam)
743 (call-process mhparam nil '(t nil) nil "-version")
744 (goto-char (point-min))
745 (when (search-forward-regexp "mhparam -- nmh-\\(\\S +\\)" nil t)
746 (let ((version (format "nmh %s" (match-string 1)))
750 (mh-lib-progs ,(mh-profile-component "libdir"))
751 (mh-lib ,(mh-profile-component "etcdir"))
753 (flists ,(file-exists-p
754 (expand-file-name "flists" dir)))))))))
756 (defun mh-file-command-p (file)
757 "Return t if file FILE is the name of a executable regular file."
758 (and (file-regular-p file) (file-executable-p file)))
760 (defun mh-variant-set-variant (variant)
761 "Setup the system variables for the MH variant named VARIANT.
762 If VARIANT is a string, use that key in the alist returned by the
763 function `mh-variants'.
764 If VARIANT is a symbol, select the first entry that matches that
767 ((stringp variant) ;e.g. "nmh 1.1-RC1"
768 (when (assoc variant (mh-variants))
769 (let* ((alist (cdr (assoc variant (mh-variants))))
770 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
771 (lib (cadr (assoc 'mh-lib alist)))
772 (progs (cadr (assoc 'mh-progs alist)))
773 (flists (cadr (assoc 'flists alist))))
774 ;;(set-default mh-variant variant)
775 (setq mh-x-mailer-string nil
776 mh-flists-present-flag flists
777 mh-lib-progs lib-progs
780 mh-variant-in-use variant))))
781 ((symbolp variant) ;e.g. 'nmh (pick the first match)
782 (loop for variant-list in (mh-variants)
783 when (eq variant (cadr (assoc 'variant (cdr variant-list))))
784 return (let* ((version (car variant-list))
785 (alist (cdr variant-list))
786 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
787 (lib (cadr (assoc 'mh-lib alist)))
788 (progs (cadr (assoc 'mh-progs alist)))
789 (flists (cadr (assoc 'flists alist))))
790 ;;(set-default mh-variant flavor)
791 (setq mh-x-mailer-string nil
792 mh-flists-present-flag flists
793 mh-lib-progs lib-progs
796 mh-variant-in-use version)
799 (defun mh-variant-p (&rest variants)
800 "Return t if variant is any of VARIANTS.
801 Currently known variants are 'MH, 'nmh, and 'mu-mh."
802 (let ((variant-in-use
803 (cadr (assoc 'variant (assoc mh-variant-in-use (mh-variants))))))
804 (not (null (member variant-in-use variants)))))
806 (defun mh-profile-component (component)
807 "Return COMPONENT value from mhparam, or nil if unset."
809 (mh-exec-cmd-quiet nil "mhparam" "-components" component)
810 (mh-profile-component-value component)))
812 (defun mh-profile-component-value (component)
813 "Find and return the value of COMPONENT in the current buffer.
814 Returns nil if the component is not in the buffer."
815 (let ((case-fold-search t))
816 (goto-char (point-min))
817 (cond ((not (re-search-forward (format "^%s:" component) nil t)) nil)
818 ((looking-at "[\t ]*$") nil)
820 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t)
821 (let ((start (match-beginning 1)))
823 (buffer-substring start (point)))))))
825 (defun mh-variant-set (variant)
826 "Set the MH variant to VARIANT.
827 Sets `mh-progs', `mh-lib', `mh-lib-progs' and
828 `mh-flists-present-flag'.
829 If the VARIANT is \"autodetect\", then first try nmh, then MH and
830 finally GNU mailutils."
832 (list (completing-read
834 (mapcar (lambda (x) (list (car x))) (mh-variants))
836 (let ((valid-list (mapcar (lambda (x) (car x)) (mh-variants))))
839 ((eq variant 'autodetect)
841 ((mh-variant-set-variant 'nmh)
842 (message "%s installed as MH variant" mh-variant-in-use))
843 ((mh-variant-set-variant 'mh)
844 (message "%s installed as MH variant" mh-variant-in-use))
845 ((mh-variant-set-variant 'mu-mh)
846 (message "%s installed as MH variant" mh-variant-in-use))
848 (message "No MH variant found on the system"))))
849 ((member variant valid-list)
850 (when (not (mh-variant-set-variant variant))
851 (message "Warning: %s variant not found. Autodetecting..." variant)
852 (mh-variant-set 'autodetect)))
854 (message "Unknown variant; use %s"
855 (mapconcat '(lambda (x) (format "%s" (car x)))
856 (mh-variants) " or "))))))
858 (defcustom mh-variant 'autodetect
859 "*Specifies the variant used by MH-E.
861 The default setting of this option is \"Auto-detect\" which means
862 that MH-E will automatically choose the first of nmh, MH, or GNU
863 mailutils that it finds in the directories listed in
864 `mh-path' (which you can customize), `mh-sys-path', and
865 `exec-path'. If, for example, you have both nmh and mailutils
866 installed and `mh-variant-in-use' was initialized to nmh but you
867 want to use mailutils, then you can set this option to
870 When this variable is changed, MH-E resets `mh-progs', `mh-lib',
871 `mh-lib-progs', `mh-flists-present-flag', and `mh-variant-in-use'
874 (const :tag "Auto-detect" autodetect)
875 ,@(mapcar (lambda (x) `(const ,(car x))) (mh-variants)))
876 :set (lambda (symbol value)
877 (set-default symbol value) ;Done in mh-variant-set-variant!
878 (mh-variant-set value))
883 ;;; MH-E Customization
885 ;; All of the defgroups, defcustoms, and deffaces in MH-E are found
886 ;; here. This makes it possible to customize modules that aren't
887 ;; loaded yet. It also makes it easier to organize the customization
890 ;; This section contains the following sub-sections:
892 ;; 1. MH-E Customization Groups
894 ;; These are the customization group definitions. Every group has a
895 ;; associated manual node. The ordering is alphabetical, except for
896 ;; the groups mh-faces and mh-hooks which are last .
898 ;; 2. MH-E Customization
900 ;; These are the actual customization variables. There is a
901 ;; sub-section for each group in the MH-E Customization Groups
902 ;; section, in the same order, separated by page breaks. Within
903 ;; each section, variables are sorted alphabetically.
907 ;; All hooks must be placed in the mh-hook group; in addition, add
908 ;; the group associated with the manual node in which the hook is
909 ;; described. Since the mh-hook group appears near the end of this
910 ;; section, the hooks will appear at the end of these other groups.
914 ;; All faces must be placed in the mh-faces group; in addition, add
915 ;; the group associated with the manual node in which the face is
916 ;; described. Since the mh-faces group appears near the end of this
917 ;; section, the faces will appear at the end of these other groups.
919 (defun mh-customize (&optional delete-other-windows-flag)
920 "Customize MH-E variables.
921 If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other
922 windows in the frame are removed."
924 (customize-group 'mh-e)
925 (when delete-other-windows-flag
926 (delete-other-windows)))
930 ;;; MH-E Customization Groups
933 "Emacs interface to the MH mail system.
934 MH is the Rand Mail Handler. Other implementations include nmh
936 :link '(custom-manual "(mh-e)Top")
939 (defgroup mh-alias nil
941 :link '(custom-manual "(mh-e)Aliases")
945 (defgroup mh-folder nil
946 "Organizing your mail with folders."
948 :link '(custom-manual "(mh-e)Folders")
951 (defgroup mh-folder-selection nil
954 :link '(custom-manual "(mh-e)Folder Selection")
957 (defgroup mh-identity nil
959 :link '(custom-manual "(mh-e)Identities")
960 :prefix "mh-identity-"
964 "Incorporating your mail."
966 :link '(custom-manual "(mh-e)Incorporating Mail")
969 (defgroup mh-junk nil
970 "Dealing with junk mail."
971 :link '(custom-manual "(mh-e)Junk")
975 (defgroup mh-letter nil
978 :link '(custom-manual "(mh-e)Editing Drafts")
981 (defgroup mh-ranges nil
984 :link '(custom-manual "(mh-e)Ranges")
987 (defgroup mh-scan-line-formats nil
989 :link '(custom-manual "(mh-e)Scan Line Formats")
993 (defgroup mh-search nil
995 :link '(custom-manual "(mh-e)Searching")
999 (defgroup mh-sending-mail nil
1002 :link '(custom-manual "(mh-e)Sending Mail")
1005 (defgroup mh-sequences nil
1008 :link '(custom-manual "(mh-e)Sequences")
1011 (defgroup mh-show nil
1012 "Reading your mail."
1014 :link '(custom-manual "(mh-e)Reading Mail")
1017 (defgroup mh-speedbar nil
1020 :link '(custom-manual "(mh-e)Speedbar")
1023 (defgroup mh-thread nil
1025 :prefix "mh-thread-"
1026 :link '(custom-manual "(mh-e)Threading")
1029 (defgroup mh-tool-bar nil
1031 :link '(custom-manual "(mh-e)Tool Bar")
1035 (defgroup mh-hooks nil
1037 :link '(custom-manual "(mh-e)Top")
1041 (defgroup mh-faces nil
1042 "Faces used in MH-E."
1043 :link '(custom-manual "(mh-e)Top")
1050 ;;; Emacs Interface to the MH Mail System (:group mh-e)
1052 ;; See Variant Support, above.
1054 ;;; Aliases (:group 'mh-alias)
1056 (defcustom mh-alias-completion-ignore-case-flag t
1057 "*Non-nil means don't consider case significant in MH alias completion.
1059 As MH ignores case in the aliases, so too does MH-E. However, you
1060 may turn off this option to make case significant which can be
1061 used to segregate completion of your aliases. You might use
1062 lowercase for mailing lists and uppercase for people."
1066 (defcustom mh-alias-expand-aliases-flag nil
1067 "*Non-nil means to expand aliases entered in the minibuffer.
1069 In other words, aliases entered in the minibuffer will be
1070 expanded to the full address in the message draft. By default,
1071 this expansion is not performed."
1075 (defcustom mh-alias-flash-on-comma t
1076 "*Specify whether to flash address or warn on translation.
1078 This option controls the behavior when a [comma] is pressed while
1079 entering aliases or addresses. The default setting flashes the
1080 address associated with an address in the minibuffer briefly, but
1081 does not display a warning if the alias is not found."
1082 :type '(choice (const :tag "Flash but Don't Warn If No Alias" t)
1083 (const :tag "Flash and Warn If No Alias" 1)
1084 (const :tag "Don't Flash Nor Warn If No Alias" nil))
1087 (defcustom mh-alias-insert-file nil
1088 "*Filename used to store a new MH-E alias.
1090 The default setting of this option is \"Use Aliasfile Profile
1091 Component\". This option can also hold the name of a file or a
1092 list a file names. If this option is set to a list of file names,
1093 or the \"Aliasfile:\" profile component contains more than one file
1094 name, MH-E will prompt for one of them when MH-E adds an alias."
1095 :type '(choice (const :tag "Use Aliasfile Profile Component" nil)
1096 (file :tag "Alias File")
1097 (repeat :tag "List of Alias Files" file))
1100 (defcustom mh-alias-insertion-location 'sorted
1101 "Specifies where new aliases are entered in alias files.
1103 This option is set to \"Alphabetical\" by default. If you organize
1104 your alias file in other ways, then adding aliases to the \"Top\"
1105 or \"Bottom\" of your alias file might be more appropriate."
1106 :type '(choice (const :tag "Alphabetical" sorted)
1107 (const :tag "Top" top)
1108 (const :tag "Bottom" bottom))
1111 (defcustom mh-alias-local-users t
1112 "*If on, local users are added to alias completion.
1114 Aliases are created from \"/etc/passwd\" entries with a user ID
1115 larger than a magical number, typically 200. This can be a handy
1116 tool on a machine where you and co-workers exchange messages.
1117 These aliases have the form \"local.first.last\" if a real name is
1118 present in the password file. Otherwise, the alias will have the
1119 form \"local.login\".
1121 If you're on a system with thousands of users you don't know, and
1122 the loading of local aliases slows MH-E down noticeably, then
1123 turn this option off.
1125 This option also takes a string which is executed to generate the
1126 password file. For example, use \"ypcat passwd\" to obtain the
1128 :type '(choice (boolean) (string))
1131 (defcustom mh-alias-local-users-prefix "local."
1132 "*String prefixed to the real names of users from the password file.
1133 This option can also be set to \"Use Login\".
1135 For example, consider the following password file entry:
1137 psg:x:1000:1000:Peter S Galbraith,,,:/home/psg:/bin/tcsh
1139 The following settings of this option will produce the associated
1142 \"local.\" local.peter.galbraith
1143 \"\" peter.galbraith
1146 This option has no effect if variable `mh-alias-local-users' is
1148 :type '(choice (const :tag "Use Login" nil)
1152 (defcustom mh-alias-passwd-gecos-comma-separator-flag t
1153 "*Non-nil means the gecos field in the password file uses a comma separator.
1155 In the example in `mh-alias-local-users-prefix', commas are used
1156 to separate different values within the so-called gecos field.
1157 This is a fairly common usage. However, in the rare case that the
1158 gecos field in your password file is not separated by commas and
1159 whose contents may contain commas, you can turn this option off."
1165 ;;; Organizing Your Mail with Folders (:group 'mh-folder)
1167 (defcustom mh-new-messages-folders t
1168 "Folders searched for the \"unseen\" sequence.
1170 Set this option to \"Inbox\" to search the \"+inbox\" folder or
1171 \"All\" to search all of the top level folders. Otherwise, list
1172 the folders that should be searched with the \"Choose Folders\"
1175 See also `mh-recursive-folders-flag'."
1176 :type '(choice (const :tag "Inbox" t)
1177 (const :tag "All" nil)
1178 (repeat :tag "Choose Folders" (string :tag "Folder")))
1181 (defcustom mh-ticked-messages-folders t
1182 "Folders searched for `mh-tick-seq'.
1184 Set this option to \"Inbox\" to search the \"+inbox\" folder or
1185 \"All\" to search all of the top level folders. Otherwise, list
1186 the folders that should be searched with the \"Choose Folders\"
1189 See also `mh-recursive-folders-flag'."
1190 :type '(choice (const :tag "Inbox" t)
1191 (const :tag "All" nil)
1192 (repeat :tag "Choose Folders" (string :tag "Folder")))
1195 (defcustom mh-large-folder 200
1196 "The number of messages that indicates a large folder.
1198 If a folder is deemed to be large, that is the number of messages
1199 in it exceed this value, then confirmation is needed when it is
1200 visited. Even when `mh-show-threads-flag' is non-nil, the folder
1201 is not automatically threaded, if it is large. If set to nil all
1202 folders are treated as if they are small."
1203 :type '(choice (const :tag "No Limit") integer)
1206 (defcustom mh-recenter-summary-flag nil
1207 "*Non-nil means to recenter the summary window.
1209 If this option is turned on, recenter the summary window when the
1210 show window is toggled off."
1214 (defcustom mh-recursive-folders-flag nil
1215 "*Non-nil means that commands which operate on folders do so recursively."
1219 (defcustom mh-sortm-args nil
1220 "*Additional arguments for \"sortm\"\\<mh-folder-mode-map>.
1222 This option is consulted when a prefix argument is used with
1223 \\[mh-sort-folder]. Normally default arguments to \"sortm\" are
1224 specified in the MH profile. This option may be used to provide
1225 an alternate view. For example, \"'(\"-nolimit\" \"-textfield\"
1226 \"subject\")\" is a useful setting."
1232 ;;; Folder Selection (:group 'mh-folder-selection)
1234 (defcustom mh-default-folder-for-message-function nil
1235 "Function to select a default folder for refiling or \"Fcc:\".
1237 The current buffer is set to the message being refiled with point
1238 at the start of the message. This function should return the
1239 default folder as a string with a leading \"+\" sign. It can also
1240 return nil so that the last folder name is used as the default,
1241 or an empty string to suppress the default entirely."
1243 :group 'mh-folder-selection)
1245 (defcustom mh-default-folder-list nil
1246 "*List of addresses and folders.
1248 The folder name associated with the first address found in this
1249 list is used as the default for `mh-refile-msg' and similar
1250 functions. Each element in this list contains a \"Check Recipient\"
1251 item. If this item is turned on, then the address is checked
1252 against the recipient instead of the sender. This is useful for
1255 See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
1256 for more information."
1257 :type '(repeat (list (regexp :tag "Address")
1258 (string :tag "Folder")
1259 (boolean :tag "Check Recipient")))
1260 :group 'mh-folder-selection)
1262 (defcustom mh-default-folder-must-exist-flag t
1263 "*Non-nil means guessed folder name must exist to be used.
1265 If the derived folder does not exist, and this option is on, then
1266 the last folder name used is suggested. This is useful if you get
1267 mail from various people for whom you have an alias, but file
1268 them all in the same project folder.
1270 See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
1271 for more information."
1273 :group 'mh-folder-selection)
1275 (defcustom mh-default-folder-prefix ""
1276 "*Prefix used for folder names generated from aliases.
1277 The prefix is used to prevent clutter in your mail directory.
1279 See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
1280 for more information."
1282 :group 'mh-folder-selection)
1286 ;;; Identities (:group 'mh-identity)
1289 (unless (fboundp 'mh-identity-make-menu-no-autoload)
1290 (defun mh-identity-make-menu-no-autoload ()
1291 "Temporary definition.
1292 Real definition will take effect when mh-identity is loaded."
1295 (defcustom mh-identity-list nil
1296 "*List of identities.
1298 To customize this option, click on the \"INS\" button and enter a label
1299 such as \"Home\" or \"Work\". Then click on the \"INS\" button with the
1300 label \"Add at least one item below\". Then choose one of the items in
1303 You can specify an alternate \"From:\" header field using the \"From
1304 Field\" menu item. You must include a valid email address. A standard
1305 format is \"First Last <login@@host.domain>\". If you use an initial
1306 with a period, then you must quote your name as in '\"First I. Last\"
1307 <login@@host.domain>'. People usually list the name of the company
1308 where they work using the \"Organization Field\" menu item. Set any
1309 arbitrary header field and value in the \"Other Field\" menu item.
1310 Unless the header field is a standard one, precede the name of your
1311 field's label with \"X-\", as in \"X-Fruit-of-the-Day:\". The value of
1312 \"Attribution Verb\" overrides the setting of
1313 `mh-extract-from-attribution-verb'. Set your signature with the
1314 \"Signature\" menu item. You can specify the contents of
1315 `mh-signature-file-name', a file, or a function. Specify a different
1316 key to sign or encrypt messages with the \"GPG Key ID\" menu item.
1318 You can select the identities you have added via the menu called
1319 \"Identity\" in the MH-Letter buffer. You can also use
1320 \\[mh-insert-identity]. To clear the fields and signature added by the
1321 identity, select the \"None\" identity.
1323 The \"Identity\" menu contains two other items to save you from having
1324 to set the identity on every message. The menu item \"Set Default for
1325 Session\" can be used to set the default identity to the current
1326 identity until you exit Emacs. The menu item \"Save as Default\" sets
1327 the option `mh-identity-default' to the current identity setting. You
1328 can also customize the `mh-identity-default' option in the usual
1330 :type '(repeat (list :tag ""
1331 (string :tag "Label")
1332 (repeat :tag "Add at least one item below"
1334 (cons :tag "From Field"
1336 (string :tag "Value"))
1337 (cons :tag "Organization Field"
1338 (const "Organization")
1339 (string :tag "Value"))
1340 (cons :tag "Other Field"
1341 (string :tag "Field")
1342 (string :tag "Value"))
1343 (cons :tag "Attribution Verb"
1344 (const ":attribution-verb")
1345 (string :tag "Value"))
1346 (cons :tag "Signature"
1347 (const :tag "Signature"
1350 (const :tag "mh-signature-file-name"
1354 (cons :tag "GPG Key ID"
1355 (const :tag "GPG Key ID"
1356 ":pgg-default-user-id")
1357 (string :tag "Value"))))))
1358 :set (lambda (symbol value)
1359 (set-default symbol value)
1360 (mh-identity-make-menu-no-autoload))
1361 :group 'mh-identity)
1363 (defcustom mh-auto-fields-list nil
1364 "List of recipients for which header lines are automatically inserted.
1366 This option can be used to set the identity depending on the
1367 recipient. To customize this option, click on the \"INS\" button and
1368 enter a regular expression for the recipient's address. Click on the
1369 \"INS\" button with the \"Add at least one item below\" label. Then choose
1370 one of the items in the \"Value Menu\".
1372 The \"Identity\" menu item is used to select an identity from those
1373 configured in `mh-identity-list'. All of the information for that
1374 identity will be added if the recipient matches. The \"Fcc Field\" menu
1375 item is used to select a folder that is used in the \"Fcc:\" header.
1376 When you send the message, MH will put a copy of your message in this
1377 folder. The \"Mail-Followup-To Field\" menu item is used to insert an
1378 \"Mail-Followup-To:\" header field with the recipients you provide. If
1379 the recipient's mail user agent supports this header field (as nmh
1380 does), then their replies will go to the addresses listed. This is
1381 useful if their replies go both to the list and to you and you don't
1382 have a mechanism to suppress duplicates. If you reply to someone not
1383 on the list, you must either remove the \"Mail-Followup-To:\" field, or
1384 ensure the recipient is also listed there so that he receives replies
1385 to your reply. Other header fields may be added using the \"Other
1388 These fields can only be added after the recipient is known. Once the
1389 header contains one or more recipients, run the
1390 \\[mh-insert-auto-fields] command or choose the \"Identity -> Insert
1391 Auto Fields\" menu item to insert these fields manually. However, you
1392 can just send the message and the fields will be added automatically.
1393 You are given a chance to see these fields and to confirm them before
1394 the message is actually sent. You can do away with this confirmation
1395 by turning off the option `mh-auto-fields-prompt-flag'.
1397 You should avoid using the same header field in `mh-auto-fields-list'
1398 and `mh-identity-list' definitions that may apply to the same message
1399 as the result is undefined."
1402 (string :tag "Recipient")
1403 (repeat :tag "Add at least one item below"
1405 (cons :tag "Identity"
1410 (function (lambda (arg) `(const ,arg)))
1411 (mapcar 'car mh-identity-list))))
1412 (cons :tag "Fcc Field"
1414 (string :tag "Value"))
1415 (cons :tag "Mail-Followup-To Field"
1416 (const "Mail-Followup-To")
1417 (string :tag "Value"))
1418 (cons :tag "Other Field"
1419 (string :tag "Field")
1420 (string :tag "Value"))))))
1421 :group 'mh-identity)
1423 (defcustom mh-auto-fields-prompt-flag t
1424 "*Non-nil means to prompt before sending if fields inserted.
1425 See `mh-auto-fields-list'."
1427 :group 'mh-identity)
1429 (defcustom mh-identity-default nil
1430 "Default identity to use when `mh-letter-mode' is called.
1431 See `mh-identity-list'."
1434 (cons '(const :tag "None" nil)
1435 (mapcar (function (lambda (arg) `(const ,arg)))
1436 (mapcar 'car mh-identity-list))))
1437 :group 'mh-identity)
1439 (defcustom mh-identity-handlers
1440 '(("From" . mh-identity-handler-top)
1441 (":default" . mh-identity-handler-bottom)
1442 (":attribution-verb" . mh-identity-handler-attribution-verb)
1443 (":signature" . mh-identity-handler-signature)
1444 (":pgg-default-user-id" . mh-identity-handler-gpg-identity))
1445 "Handler functions for fields in `mh-identity-list'.
1447 This option is used to change the way that fields, signatures,
1448 and attributions in `mh-identity-list' are added. To customize
1449 `mh-identity-handlers', replace the name of an existing handler
1450 function associated with the field you want to change with the
1451 name of a function you have written. You can also click on an
1452 \"INS\" button and insert a field of your choice and the name of
1453 the function you have written to handle it.
1455 The \"Field\" field can be any field that you've used in your
1456 `mh-identity-list'. The special fields \":attribution-verb\",
1457 \":signature\", or \":pgg-default-user-id\" are used for the
1458 `mh-identity-list' choices \"Attribution Verb\", \"Signature\", and
1459 \"GPG Key ID\" respectively.
1461 The handler associated with the \":default\" field is used when no
1462 other field matches.
1464 The handler functions are passed two or three arguments: the
1465 FIELD itself (for example, \"From\"), or one of the special
1466 fields (for example, \":signature\"), and the ACTION 'remove or
1467 'add. If the action is 'add, an additional argument
1468 containing the VALUE for the field is given."
1469 :type '(repeat (cons (string :tag "Field") function))
1470 :group 'mh-identity)
1474 ;;; Incorporating Your Mail (:group 'mh-inc)
1476 (defcustom mh-inc-prog "inc"
1477 "*Program to incorporate new mail into a folder.
1479 This program generates a one-line summary for each of the new
1480 messages. Unless it is an absolute pathname, the file is assumed
1481 to be in the `mh-progs' directory. You may also link a file to
1482 \"inc\" that uses a different format. You'll then need to modify
1483 several scan line format variables appropriately."
1488 (unless (fboundp 'mh-inc-spool-make-no-autoload)
1489 (defun mh-inc-spool-make-no-autoload ()
1490 "Temporary definition.
1491 Real definition will take effect when mh-inc is loaded."
1494 (defcustom mh-inc-spool-list nil
1495 "*Alternate spool files.
1497 You can use the `mh-inc-spool-list' variable to direct MH-E to
1498 retrieve mail from arbitrary spool files other than your system
1499 mailbox, file it in folders other than your \"+inbox\", and assign
1500 key bindings to incorporate this mail.
1502 Suppose you are subscribed to the \"mh-e-devel\" mailing list and
1503 you use \"procmail\" to filter this mail into \"~/mail/mh-e\" with
1504 the following recipe in \".procmailrc\":
1508 * ^From mh-e-devel-admin@stop.mail-abuse.org
1511 In order to incorporate \"~/mail/mh-e\" into \"+mh-e\" with an
1512 \"I m\" (mh-inc-spool-mh-e) command, customize this option, and click
1513 on the \"INS\" button. Enter a \"Spool File\" of \"~/mail/mh-e\", a
1514 \"Folder\" of \"mh-e\", and a \"Key Binding\" of \"m\".
1516 You can use \"xbuffy\" to automate the incorporation of this mail
1517 using the \"gnudoit\" command in the \"gnuserv\" package as follows:
1524 command gnudoit -q '(mh-inc-spool-mh-e)'"
1525 :type '(repeat (list (file :tag "Spool File")
1526 (string :tag "Folder")
1527 (character :tag "Key Binding")))
1528 :set (lambda (symbol value)
1529 (set-default symbol value)
1530 (mh-inc-spool-make-no-autoload))
1535 ;;; Dealing with Junk Mail (:group 'mh-junk)
1537 (defvar mh-junk-choice nil
1538 "Chosen spam fighting program.")
1540 ;; Available spam filter interfaces
1541 (defvar mh-junk-function-alist
1542 '((spamassassin mh-spamassassin-blacklist mh-spamassassin-whitelist)
1543 (bogofilter mh-bogofilter-blacklist mh-bogofilter-whitelist)
1544 (spamprobe mh-spamprobe-blacklist mh-spamprobe-whitelist))
1545 "Available choices of spam programs to use.
1547 This is an alist. For each element there are functions that
1548 blacklist a message as spam and whitelist a message incorrectly
1549 classified as spam.")
1551 (defun mh-junk-choose (symbol value)
1552 "Choose spam program to use.
1554 The function is always called with SYMBOL bound to
1555 `mh-junk-program' and VALUE bound to the new value of
1556 `mh-junk-program'. The function sets the variable
1557 `mh-junk-choice' in addition to `mh-junk-program'."
1558 (set symbol value) ;XXX shouldn't this be set-default?
1559 (setq mh-junk-choice
1561 (loop for element in mh-junk-function-alist
1562 until (executable-find (symbol-name (car element)))
1563 finally return (car element)))))
1565 (defcustom mh-junk-background nil
1566 "If on, spam programs are run in background.
1568 By default, the programs are run in the foreground, but this can
1569 be slow when junking large numbers of messages. If you have
1570 enough memory or don't junk that many messages at the same time,
1571 you might try turning on this option."
1572 :type '(choice (const :tag "Off" nil)
1573 (const :tag "On" 0))
1576 (defcustom mh-junk-disposition nil
1577 "Disposition of junk mail."
1578 :type '(choice (const :tag "Delete Spam" nil)
1579 (string :tag "Spam Folder"))
1582 (defcustom mh-junk-program nil
1583 "Spam program that MH-E should use.
1585 The default setting of this option is \"Auto-detect\" which means
1586 that MH-E will automatically choose one of SpamAssassin,
1587 bogofilter, or SpamProbe in that order. If, for example, you have
1588 both SpamAssassin and bogofilter installed and you want to use
1589 bogofilter, then you can set this option to \"Bogofilter\"."
1590 :type '(choice (const :tag "Auto-detect" nil)
1591 (const :tag "SpamAssassin" spamassassin)
1592 (const :tag "Bogofilter" bogofilter)
1593 (const :tag "SpamProbe" spamprobe))
1594 :set 'mh-junk-choose
1599 ;;; Editing a Draft (:group 'mh-letter)
1601 (defcustom mh-compose-insertion (if (locate-library "mml") 'mml 'mh)
1602 "Type of tags used when composing MIME messages.
1604 In addition to MH-style directives, MH-E also supports MML (MIME
1605 Meta Language) tags. (see Info node `(emacs-mime)Composing').
1606 This option can be used to choose between them. By default, this
1607 option is set to \"MML\" if it is supported since it provides a
1608 lot more functionality. This option can also be set to \"MH\" if
1609 MH-style directives are preferred."
1610 :type '(choice (const :tag "MML" mml)
1611 (const :tag "MH" mh))
1614 (defcustom mh-compose-skipped-header-fields
1615 '("From" "Organization" "References" "In-Reply-To"
1616 "X-Face" "Face" "X-Image-URL" "X-Mailer")
1617 "List of header fields to skip over when navigating in draft."
1618 :type '(repeat (string :tag "Field"))
1621 (defcustom mh-compose-space-does-completion-flag nil
1622 "*Non-nil means \\<mh-letter-mode-map>\\[mh-letter-complete-or-space] does completion in message header."
1626 (defcustom mh-delete-yanked-msg-window-flag nil
1627 "*Non-nil means delete any window displaying the message.
1629 This deletes the window containing the original message after
1630 yanking it with \\<mh-letter-mode-map>\\[mh-yank-cur-msg] to make
1631 more room on your screen for your reply."
1635 (defcustom mh-extract-from-attribution-verb "wrote:"
1636 "*Verb to use for attribution when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
1638 The attribution consists of the sender's name and email address
1639 followed by the content of this option. This option can be set to
1640 \"wrote:\", \"a écrit:\", and \"schrieb:\". You can also use the
1641 \"Custom String\" menu item to enter your own verb."
1642 :type '(choice (const "wrote:")
1645 (string :tag "Custom String"))
1648 (defcustom mh-ins-buf-prefix "> "
1649 "*String to put before each line of a yanked or inserted message.
1651 The prefix \"> \" is the default setting of this option. I
1652 suggest that you not modify this option since it is used by many
1653 mailers and news readers: messages are far easier to read if
1654 several included messages have all been indented by the same
1657 This prefix is not inserted if you use one of the supercite
1658 flavors of `mh-yank-behavior' or you have added a
1659 `mail-citation-hook'."
1663 (defcustom mh-letter-complete-function 'ispell-complete-word
1664 "*Function to call when completing outside of address or folder fields.
1666 In the body of the message,
1667 \\<mh-letter-mode-map>\\[mh-letter-complete] runs this function,
1668 which is set to \"ispell-complete-word\" by default."
1669 :type '(choice function (const nil))
1672 (defcustom mh-letter-fill-column 72
1673 "*Fill column to use in MH Letter mode.
1675 By default, this option is 72 to allow others to quote your
1676 message without line wrapping."
1680 (defcustom mh-mml-method-default (if mh-pgp-support-flag "pgpmime" "none")
1681 "Default method to use in security tags.
1683 This option is used to select between a variety of mail security
1684 mechanisms. The default is \"PGP (MIME)\" if it is supported\;
1685 otherwise, the default is \"None\". Other mechanisms include
1686 vanilla \"PGP\" and \"S/MIME\".
1688 The `pgg' customization group may have some settings which may
1689 interest you (see Info node `(pgg)').
1691 In particular, I turn on the option `pgg-encrypt-for-me' so that
1692 all messages I encrypt are encrypted with my public key as well.
1693 If you keep a copy of all of your outgoing mail with a \"Fcc:\"
1694 header field, this setting is vital so that you can read the mail
1696 :type '(choice (const :tag "PGP (MIME)" "pgpmime")
1697 (const :tag "PGP" "pgp")
1698 (const :tag "S/MIME" "smime")
1699 (const :tag "None" "none"))
1702 (defcustom mh-signature-file-name "~/.signature"
1703 "*Source of user's signature.
1705 By default, the text of your signature is taken from the file
1706 \"~/.signature\". You can read from other sources by changing this
1707 option. This file may contain a vCard in which case an attachment is
1708 added with the vCard.
1710 This option may also be a symbol, in which case that function is
1711 called. You may not want a signature separator to be added for you;
1712 instead you may want to insert one yourself. Options that you may find
1713 useful to do this include `mh-signature-separator' (when inserting a
1714 signature separator) and `mh-signature-separator-regexp' (for finding
1715 said separator). The function `mh-signature-separator-p', which
1716 reports t if the buffer contains a separator, may be useful as well.
1718 The signature is inserted into your message with the command
1719 \\<mh-letter-mode-map>\\[mh-insert-signature] or with the option
1720 `mh-identity-list'."
1724 (defcustom mh-signature-separator-flag t
1725 "*Non-nil means a signature separator should be inserted.
1727 It is not recommended that you change this option since various
1728 mail user agents, including MH-E, use the separator to present
1729 the signature differently, and to suppress the signature when
1730 replying or yanking a letter into a draft."
1734 (defcustom mh-x-face-file "~/.face"
1735 "*File containing face header field to insert in outgoing mail.
1737 If the file starts with either of the strings \"X-Face:\", \"Face:\"
1738 or \"X-Image-URL:\" then the contents are added to the message header
1739 verbatim. Otherwise it is assumed that the file contains the value of
1740 the \"X-Face:\" header field.
1742 The \"X-Face:\" header field, which is a low-resolution, black and
1743 white image, can be generated using the \"compface\" command (see URL
1744 `ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.Z'). The
1745 \"Online X-Face Converter\" is a useful resource for quick conversion
1746 of images into \"X-Face:\" header fields (see URL
1747 `http://www.dairiki.org/xface/').
1749 Use the \"make-face\" script to convert a JPEG image to the higher
1750 resolution, color, \"Face:\" header field (see URL
1751 `http://quimby.gnus.org/circus/face/make-face').
1753 The URL of any image can be used for the \"X-Image-URL:\" field and no
1754 processing of the image is required.
1756 To prevent the setting of any of these header fields, either set
1757 `mh-x-face-file' to nil, or simply ensure that the file defined by
1758 this option doesn't exist."
1762 (defcustom mh-yank-behavior 'attribution
1763 "*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
1765 To include the entire message, including the entire header, use
1766 \"Body and Header\". Use \"Body\" to yank just the body without
1767 the header. To yank only the portion of the message following the
1768 point, set this option to \"Below Point\".
1770 Choose \"Invoke supercite\" to pass the entire message and header
1773 If the \"Body With Attribution\" setting is used, then the
1774 message minus the header is yanked and a simple attribution line
1775 is added at the top using the value of the option
1776 `mh-extract-from-attribution-verb'. This is the default.
1778 If the \"Invoke supercite\" or \"Body With Attribution\" settings
1779 are used, the \"-noformat\" argument is passed to the \"repl\"
1780 program to override a \"-filter\" or \"-format\" argument. These
1781 settings also have \"Automatically\" variants that perform the
1782 action automatically when you reply so that you don't need to use
1783 \\[mh-yank-cur-msg] at all. Note that this automatic action is
1784 only performed if the show buffer matches the message being
1785 replied to. People who use the automatic variants tend to turn on
1786 the option `mh-delete-yanked-msg-window-flag' as well so that the
1787 show window is never displayed.
1789 If the show buffer has a region, the option `mh-yank-behavior' is
1790 ignored unless its value is one of Attribution variants in which
1791 case the attribution is added to the yanked region.
1793 If this option is set to one of the supercite flavors, the hook
1794 `mail-citation-hook' is ignored and `mh-ins-buf-prefix' is not
1796 :type '(choice (const :tag "Body and Header" t)
1797 (const :tag "Body" body)
1798 (const :tag "Below Point" nil)
1799 (const :tag "Invoke supercite" supercite)
1800 (const :tag "Invoke supercite, Automatically" autosupercite)
1801 (const :tag "Body With Attribution" attribution)
1802 (const :tag "Body With Attribution, Automatically"
1808 ;;; Ranges (:group 'mh-ranges)
1810 (defcustom mh-interpret-number-as-range-flag t
1811 "*Non-nil means interpret a number as a range.
1813 Since one of the most frequent ranges used is \"last:N\", MH-E
1814 will interpret input such as \"200\" as \"last:200\" if this
1815 option is on (which is the default). If you need to scan just the
1816 message 200, then use the range \"200:200\"."
1822 ;;; Scan Line Formats (:group 'mh-scan-line-formats)
1825 (unless (fboundp 'mh-adaptive-cmd-note-flag-check)
1826 (defun mh-adaptive-cmd-note-flag-check (symbol value)
1827 "Temporary definition.
1828 Real definition, below, uses variables that aren't defined yet."
1829 (set-default symbol value))))
1831 (defcustom mh-adaptive-cmd-note-flag t
1832 "*Non-nil means that the message number width is determined dynamically.
1834 If you've created your own format to handle long message numbers,
1835 you'll be pleased to know you no longer need it since MH-E adapts its
1836 internal format based upon the largest message number if this option
1837 is on (the default). This option may only be turned on when
1838 `mh-scan-format-file' is set to \"Use MH-E scan Format\".
1840 If you prefer fixed-width message numbers, turn off this option and
1841 call `mh-set-cmd-note' with the width specified by your format file
1842 \(see `mh-scan-format-file'). For example, the default width is 4, so
1843 you would use \"(mh-set-cmd-note 4)\"."
1845 :group 'mh-scan-line-formats
1846 :set 'mh-adaptive-cmd-note-flag-check)
1848 (defun mh-scan-format-file-check (symbol value)
1849 "Check if desired setting is legal.
1850 Throw an error if user tries to set `mh-scan-format-file' to
1851 anything but t when `mh-adaptive-cmd-note-flag' is on. Otherwise,
1852 set SYMBOL to VALUE."
1853 (if (and (not (eq value t))
1854 (eq mh-adaptive-cmd-note-flag t))
1855 (error "%s %s" "You must turn off `mh-adaptive-cmd-note-flag'"
1856 "unless you use \"Use MH-E scan Format\"")
1857 (set-default symbol value)))
1859 (defcustom mh-scan-format-file t
1860 "Specifies the format file to pass to the scan program.
1862 The default setting for this option is \"Use MH-E scan Format\". This
1863 means that the format string will be taken from the either
1864 `mh-scan-format-mh' or `mh-scan-format-nmh' depending on whether MH or
1865 nmh (or GNU mailutils) is in use. This setting also enables you to
1866 turn on the `mh-adaptive-cmd-note-flag' option.
1868 You can also set this option to \"Use Default scan Format\" to get the
1869 same output as you would get if you ran \"scan\" from the shell. If
1870 you have a format file that you want MH-E to use but not MH, you can
1871 set this option to \"Specify a scan Format File\" and enter the name
1872 of your format file.
1874 If you change the format of the scan lines you'll need to tell MH-E
1875 how to parse the new format. As you will see, quite a lot of variables
1876 are involved to do that. Use \"\\[apropos] RET mh-scan.*regexp\" to
1877 obtain a list of these variables. You will also have to call
1878 `mh-set-cmd-note' if your notations are not in column 4 (columns in
1879 Emacs start with 0)."
1880 :type '(choice (const :tag "Use MH-E scan Format" t)
1881 (const :tag "Use Default scan Format" nil)
1882 (file :tag "Specify a scan Format File"))
1883 :group 'mh-scan-line-formats
1884 :set 'mh-scan-format-file-check)
1886 (defun mh-adaptive-cmd-note-flag-check (symbol value)
1887 "Check if desired setting is legal.
1888 Throw an error if user tries to turn on
1889 `mh-adaptive-cmd-note-flag' when `mh-scan-format-file' isn't t.
1890 Otherwise, set SYMBOL to VALUE."
1892 (not (eq mh-scan-format-file t)))
1893 (error "%s %s" "Can't turn on unless `mh-scan-format-file'"
1894 "is set to \"Use MH-E scan Format\"")
1895 (set-default symbol value)))
1897 (defcustom mh-scan-prog "scan"
1898 "*Program used to scan messages.
1900 The name of the program that generates a listing of one line per
1901 message is held in this option. Unless this variable contains an
1902 absolute pathname, it is assumed to be in the `mh-progs'
1903 directory. You may link another program to `scan' (see
1904 \"mh-profile(5)\") to produce a different type of listing."
1906 :group 'mh-scan-line-formats)
1907 (make-variable-buffer-local 'mh-scan-prog)
1911 ;;; Searching (:group 'mh-search)
1913 (defcustom mh-search-program nil
1914 "Search program that MH-E shall use.
1916 The default setting of this option is \"Auto-detect\" which means
1917 that MH-E will automatically choose one of swish++, swish-e,
1918 mairix, namazu, pick and grep in that order. If, for example, you
1919 have both swish++ and mairix installed and you want to use
1920 mairix, then you can set this option to \"mairix\".
1922 More information about setting up an indexing program to use with
1923 MH-E can be found in the documentation of `mh-search'."
1924 :type '(choice (const :tag "Auto-detect" nil)
1925 (const :tag "swish++" swish++)
1926 (const :tag "swish-e" swish)
1927 (const :tag "mairix" mairix)
1928 (const :tag "namazu" namazu)
1929 (const :tag "pick" pick)
1930 (const :tag "grep" grep))
1935 ;;; Sending Mail (:group 'mh-sending-mail)
1937 (defcustom mh-compose-forward-as-mime-flag t
1938 "*Non-nil means that messages are forwarded as attachments.
1940 By default, this option is on which means that the forwarded
1941 messages are included as attachments. If you would prefer to
1942 forward your messages verbatim (as text, inline), then turn off
1943 this option. Forwarding messages verbatim works well for short,
1944 textual messages, but your recipient won't be able to view any
1945 non-textual attachments that were in the forwarded message. Be
1946 aware that if you have \"forw: -mime\" in your MH profile, then
1947 forwarded messages will always be included as attachments
1948 regardless of the settings of this option."
1950 :group 'mh-sending-mail)
1952 (defcustom mh-compose-letter-function nil
1953 "Invoked when starting a new draft.
1955 However, it is the last function called before you edit your
1956 message. The consequence of this is that you can write a function
1957 to write and send the message for you. This function is passed
1958 three arguments: the contents of the TO, SUBJECT, and CC header
1960 :type '(choice (const nil) function)
1961 :group 'mh-sending-mail)
1963 (defcustom mh-compose-prompt-flag nil
1964 "*Non-nil means prompt for header fields when composing a new draft."
1966 :group 'mh-sending-mail)
1968 (defcustom mh-forward-subject-format "%s: %s"
1969 "*Format string for forwarded message subject.
1971 This option is a string which includes two escapes (\"%s\"). The
1972 first \"%s\" is replaced with the sender of the original message,
1973 and the second one is replaced with the original \"Subject:\"."
1975 :group 'mh-sending-mail)
1977 (defcustom mh-insert-x-mailer-flag t
1978 "*Non-nil means append an \"X-Mailer:\" header field to the header.
1980 This header field includes the version of MH-E and Emacs that you
1981 are using. If you don't want to participate in our marketing, you
1982 can turn this option off."
1984 :group 'mh-sending-mail)
1986 (defcustom mh-redist-full-contents-flag nil
1987 "*Non-nil means the \"dist\" command needs entire letter for redistribution.
1989 This option must be turned on if \"dist\" requires the whole
1990 letter for redistribution, which is the case if \"send\" is
1991 compiled with the BERK option (which many people abhor). If you
1992 find that MH will not allow you to redistribute a message that
1993 has been redistributed before, turn off this option."
1995 :group 'mh-sending-mail)
1997 (defcustom mh-reply-default-reply-to nil
1998 "*Sets the person or persons to whom a reply will be sent.
2000 This option is set to \"Prompt\" by default so that you are
2001 prompted for the recipient of a reply. If you find that most of
2002 the time that you specify \"cc\" when you reply to a message, set
2003 this option to \"cc\". Other choices include \"from\", \"to\", or
2004 \"all\". You can always edit the recipients in the draft."
2005 :type '(choice (const :tag "Prompt" nil)
2010 :group 'mh-sending-mail)
2012 (defcustom mh-reply-show-message-flag t
2013 "*Non-nil means the MH-Show buffer is displayed when replying.
2015 If you include the message automatically, you can hide the
2016 MH-Show buffer by turning off this option.
2018 See also `mh-reply'."
2020 :group 'mh-sending-mail)
2024 ;;; Sequences (:group 'mh-sequences)
2026 ;; If `mh-unpropagated-sequences' becomes a defcustom, add the following to
2027 ;; the docstring: "Additional sequences that should not to be preserved can be
2028 ;; specified by setting `mh-unpropagated-sequences' appropriately." XXX
2030 (defcustom mh-refile-preserves-sequences-flag t
2031 "*Non-nil means that sequences are preserved when messages are refiled.
2033 If a message is in any sequence (except \"Previous-Sequence:\"
2034 and \"cur\") when it is refiled, then it will still be in those
2035 sequences in the destination folder. If this behavior is not
2036 desired, then turn off this option."
2038 :group 'mh-sequences)
2040 (defcustom mh-tick-seq 'tick
2041 "The name of the MH sequence for ticked messages.
2043 You can customize this option if you already use the \"tick\"
2044 sequence for your own use. You can also disable all of the
2045 ticking functions by choosing the \"Disable Ticking\" item but
2046 there isn't much advantage to that."
2047 :type '(choice (const :tag "Disable Ticking" nil)
2049 :group 'mh-sequences)
2051 (defcustom mh-update-sequences-after-mh-show-flag t
2052 "*Non-nil means flush MH sequences to disk after message is shown\\<mh-folder-mode-map>.
2054 Three sequences are maintained internally by MH-E and pushed out
2055 to MH when a message is shown. They include the sequence
2056 specified by your \"Unseen-Sequence:\" profile entry, \"cur\",
2057 and the sequence listed by the option `mh-tick-seq' which is
2058 \"tick\" by default. If you do not like this behavior, turn off
2059 this option. You can then update the state manually with the
2060 \\[mh-execute-commands], \\[mh-quit], or \\[mh-update-sequences]
2063 :group 'mh-sequences)
2067 ;;; Reading Your Mail (:group 'mh-show)
2069 (defcustom mh-bury-show-buffer-flag t
2070 "*Non-nil means show buffer is buried.
2072 One advantage of not burying the show buffer is that one can
2073 delete the show buffer more easily in an electric buffer list
2074 because of its proximity to its associated MH-Folder buffer. Try
2075 running \\[electric-buffer-list] to see what I mean."
2079 (defcustom mh-clean-message-header-flag t
2080 "*Non-nil means remove extraneous header fields.
2082 See also `mh-invisible-header-fields-default' and
2083 `mh-invisible-header-fields'."
2087 (defcustom mh-decode-mime-flag (not (not (locate-library "mm-decode")))
2088 "*Non-nil means attachments are handled\\<mh-folder-mode-map>.
2090 MH-E can handle attachments as well if the Gnus `mm-decode'
2091 library is present. If so, this option will be on. Otherwise,
2092 you'll see the MIME body parts rather than text or attachments.
2093 There isn't much point in turning off this option; however, you
2094 can inspect it if it appears that the body parts are not being
2095 interpreted correctly or toggle it with the command
2096 \\[mh-toggle-mh-decode-mime-flag] to view the raw message.
2098 This option also controls the display of quoted-printable
2099 messages and other graphical widgets. See the options
2100 `mh-graphical-smileys-flag' and `mh-graphical-emphasis-flag'."
2104 (defcustom mh-display-buttons-for-alternatives-flag nil
2105 "*Non-nil means display buttons for all alternative attachments.
2107 Sometimes, a mail program will produce multiple alternatives of
2108 the attachment in increasing degree of faithfulness to the
2109 original content. By default, only the preferred alternative is
2110 displayed. If this option is on, then the preferred part is shown
2111 inline and buttons are shown for each of the other alternatives."
2115 (defcustom mh-display-buttons-for-inline-parts-flag nil
2116 "*Non-nil means display buttons for all inline attachments\\<mh-folder-mode-map>.
2118 The sender can request that attachments should be viewed inline so
2119 that they do not really appear like an attachment at all to the
2120 reader. Most of the time, this is desirable, so by default MH-E
2121 suppresses the buttons for inline attachments. On the other hand, you
2122 may receive code or HTML which the sender has added to his message as
2123 inline attachments so that you can read them in MH-E. In this case, it
2124 is useful to see the buttons so that you know you don't have to cut
2125 and paste the code into a file; you can simply save the attachment.
2127 If you want to make the buttons visible for inline attachments, you
2128 can use the command \\[mh-toggle-mime-buttons] to toggle the
2129 visibility of these buttons. You can turn on these buttons permanently
2130 by turning on this option.
2132 MH-E cannot display all attachments inline however. It can display
2133 text (including HTML) and images."
2137 (defcustom mh-do-not-confirm-flag nil
2138 "*Non-nil means non-reversible commands do not prompt for confirmation.
2140 Commands such as `mh-pack-folder' prompt to confirm whether to
2141 process outstanding moves and deletes or not before continuing.
2142 Turning on this option means that these actions will be
2143 performed--which is usually desired but cannot be
2144 retracted--without question."
2148 (defcustom mh-fetch-x-image-url nil
2149 "*Control fetching of \"X-Image-URL:\" header field image.
2151 Ths option controls the fetching of the \"X-Image-URL:\" header
2152 field image with the following values:
2155 You are prompted before the image is fetched. MH-E will
2156 remember your reply and will either use the already fetched
2157 image the next time the same URL is encountered or silently
2158 skip it if you didn't fetch it the first time. This is a
2162 Images are never fetched and only displayed if they are
2163 already present in the cache. This is the default.
2165 There isn't a value of \"Always Fetch\" for privacy and DOS (denial of
2166 service) reasons. For example, fetching a URL can tip off a spammer
2167 that you've read his email (which is why you shouldn't blindly answer
2168 yes if you've set this option to \"Ask Before Fetching\"). Someone may
2169 also flood your network and fill your disk drive by sending a torrent
2170 of messages, each specifying a unique URL to a very large file.
2172 The cache of images is found in the directory \".mhe-x-image-cache\"
2173 within your MH directory. You can add your own face to the \"From:\"
2174 field too. See Info node `(mh-e)Picture'.
2176 This setting only has effect if the option `mh-show-use-xface-flag' is
2179 :type '(choice (const :tag "Ask Before Fetching" ask)
2180 (const :tag "Never Fetch" nil))
2183 (defcustom mh-graphical-smileys-flag t
2184 "*Non-nil means graphical smileys are displayed.
2186 It is a long standing custom to inject body language using a
2187 cornucopia of punctuation, also known as the \"smileys\". MH-E
2188 can render these as graphical widgets if this option is turned
2189 on, which it is by default. Smileys include patterns such as :-)
2192 This option is disabled if the option `mh-decode-mime-flag' is
2197 (defcustom mh-graphical-emphasis-flag t
2198 "*Non-nil means graphical emphasis is displayed.
2200 A few typesetting features are indicated in ASCII text with
2201 certain characters. If your terminal supports it, MH-E can render
2202 these typesetting directives naturally if this option is turned
2203 on, which it is by default. For example, _underline_ will be
2204 underlined, *bold* will appear in bold, /italics/ will appear in
2205 italics, and so on. See the option `gnus-emphasis-alist' for the
2208 This option is disabled if the option `mh-decode-mime-flag' is
2213 (defcustom mh-highlight-citation-style 'gnus
2214 "Style for highlighting citations.
2216 If the sender of the message has cited other messages in his
2217 message, then MH-E will highlight these citations to emphasize
2218 the sender's actual response. This option can be customized to
2219 change the highlighting style. The \"Multicolor\" method uses a
2220 different color for each indentation while the \"Monochrome\"
2221 method highlights all citations in red. To disable highlighting
2222 of citations entirely, choose \"None\"."
2223 :type '(choice (const :tag "Multicolor" gnus)
2224 (const :tag "Monochrome" font-lock)
2225 (const :tag "None" nil))
2228 ;; Keep fields alphabetized. Mention source, if known.
2229 (defvar mh-invisible-header-fields-internal
2233 "Cancel-Lock:" ; NNTP posts
2234 "Content-" ; RFC 2045
2235 "Delivered-To:" ; Egroups/yahoogroups mailing list manager
2236 "Delivery-Date:" ; MH
2238 "DomainKey-Signature:" ;http://antispam.yahoo.com/domainkeys
2242 "Face:" ; Gnus Face header
2245 "Importance:" ; MS Outlook
2248 "List-" ; Mailman mailing list manager
2249 "List-" ; Unknown mailing list managers
2250 "List-Subscribe:" ; Unknown mailing list managers
2251 "List-Unsubscribe:" ; Unknown mailing list managers
2253 "Mailing-List:" ; Egroups/yahoogroups mailing list manager
2254 "Message-Id:" ; RFC 822
2255 "Mime-Version" ; RFC 2045
2258 "Original-Encoded-Information-Types:" ; X400
2259 "Original-Lines:" ; mail to news
2260 "Original-NNTP-" ; mail to news
2261 "Original-Newsgroups:" ; mail to news
2262 "Original-Path:" ; mail to news
2263 "Original-Received:" ; mail to news
2264 "Original-To:" ; mail to news
2265 "Original-X-" ; mail to news
2267 "P1-Content-Type:" ; X400
2268 "P1-Message-Id:" ; X400
2269 "P1-Recipient:" ; X400
2274 "Received:" ; RFC 822
2275 "Received-SPF:" ; Gmail
2280 "Return-Path:" ; RFC 822
2281 "Sensitivity:" ; MS Outlook
2282 "Status:" ; sendmail
2284 "Ua-Content-Id:" ; X400
2285 ;; "User-Agent:" ; Similar to X-Mailer, so display it.
2289 "X-Accept-Language:"
2290 "X-Accept-Language:" ; Netscape/Mozilla
2292 "X-Administrivia-To:"
2293 "X-AntiAbuse:" ; cPanel
2294 "X-Apparently-From:" ; MS Outlook
2295 "X-Apparently-To:" ; Egroups/yahoogroups mailing list manager
2296 "X-Authentication-Warning:" ; sendmail
2297 "X-Beenthere:" ; Mailman mailing list manager
2298 "X-Bogosity:" ; bogofilter
2299 "X-Bugzilla-*" ; Bugzilla
2301 "X-ContentStamp:" ; NetZero
2305 "X-ELNK-Trace:" ; Earthlink mailer
2306 "X-Envelope-Date:" ; GNU mailutils
2308 "X-Envelope-Sender:"
2310 "X-Evolution:" ; Evolution mail client
2315 "X-Gnus-Mail-Source:" ; gnus
2316 "X-Greylist:" ; milter-greylist-1.2.1
2317 "X-Habeas-SWE-1:" ; Spam
2318 "X-Habeas-SWE-2:" ; Spam
2319 "X-Habeas-SWE-3:" ; Spam
2320 "X-Habeas-SWE-4:" ; Spam
2321 "X-Habeas-SWE-5:" ; Spam
2322 "X-Habeas-SWE-6:" ; Spam
2323 "X-Habeas-SWE-7:" ; Spam
2324 "X-Habeas-SWE-8:" ; Spam
2325 "X-Habeas-SWE-9:" ; Spam
2328 "X-List-Host:" ; Unknown mailing list managers
2329 "X-List-Subscribe:" ; Unknown mailing list managers
2330 "X-List-Unsubscribe:" ; Unknown mailing list managers
2331 "X-Listprocessor-" ; ListProc(tm) by CREN
2332 "X-Listserver:" ; Unknown mailing list managers
2333 "X-Loop:" ; Unknown mailing list managers
2334 "X-Lumos-SenderID:" ; Roving ConstantContact
2335 "X-MAIL-INFO:" ; NetZero
2336 "X-MHE-Checksum" ; Checksum added during index search
2337 "X-MIME-Autoconverted:" ; sendmail
2339 "X-MS-" ; MS Outlook
2340 "X-MailScanner" ; ListProc(tm) by CREN
2341 "X-Mailing-List:" ; Unknown mailing list managers
2342 "X-Mailman-Version:" ; Mailman mailing list manager
2343 "X-Majordomo:" ; Majordomo mailing list manager
2345 "X-MessageWall-Score:" ; Unknown mailing list manager, AUC TeX
2346 "X-MimeOLE:" ; MS Outlook
2347 "X-Mms-" ; T-Mobile pictures
2348 "X-Mozilla-Status:" ; Netscape/Mozilla
2349 "X-Msmail-" ; MS Outlook
2350 "X-NAI-Spam-" ; Network Associates Inc. SpamKiller
2353 "X-Notes-Item:" ; Lotus Notes Domino structured header
2354 "X-OperatingSystem:"
2355 ;;"X-Operator:" ; Similar to X-Mailer, so display it
2356 "X-Orcl-Content-Type:"
2357 "X-Original-Complaints-To:"
2358 "X-Original-Date:" ; SourceForge mailing list manager
2361 "X-OriginalArrivalTime:" ; Hotmail
2362 "X-Originating-IP:" ; Hotmail
2364 "X-Priority:" ; MS Outlook
2365 "X-Qotd-" ; User added
2370 "X-Return-Path-Hint:" ; Roving ConstantContact
2371 "X-Roving-*" ; Roving ConstantContact
2381 "X-Sieve:" ; Sieve filtering
2383 "X-Spam-" ; Spamassassin
2384 "X-SpamBouncer:" ; Spam
2392 "X-USANET-" ; usa.net
2394 "X-VSMLoop:" ; NTMail
2395 "X-Virus-Scanned" ; amavisd-new
2397 "X-WebTV-Signature:"
2398 "X-Wss-Id:" ; Worldtalk gateways
2400 "X-eGroups-" ; Egroups/yahoogroups mailing list manager
2402 "X-submission-address:"
2405 "List of default header fields that are not to be shown.
2407 Do not alter this variable directly. Instead, add entries from
2408 here that you would like to be displayed in
2409 `mh-invisible-header-fields-default' and add entries to hide in
2410 `mh-invisible-header-fields'.")
2413 (unless (fboundp 'mh-invisible-headers)
2414 (defun mh-invisible-headers ()
2415 "Temporary definition.
2416 Real definition, below, uses variables that aren't defined yet."
2419 (defvar mh-delay-invisible-header-generation-flag t
2420 "Non-nil means to delay the generation of invisible header fields.
2421 Because the function `mh-invisible-headers' uses both
2422 `mh-invisible-header-fields' and `mh-invisible-header-fields', it
2423 cannot be run until both variables have been initialized.")
2425 (defcustom mh-invisible-header-fields nil
2426 "*Additional header fields to hide.
2428 Header fields that you would like to hide that aren't listed in
2429 `mh-invisible-header-fields-default' can be added to this option
2430 with a couple of caveats. Regular expressions are not allowed.
2431 Unique fields should have a \":\" suffix; otherwise, the element
2432 can be used to render invisible an entire class of fields that
2433 start with the same prefix. If you think a header field should be
2434 generally ignored, report a bug (see URL
2435 `https://sourceforge.net/tracker/?group_id=13357&atid=113357').
2437 See also `mh-clean-message-header-flag'."
2439 :type '(repeat (string :tag "Header field"))
2440 :set (lambda (symbol value)
2441 (set-default symbol value)
2442 (mh-invisible-headers))
2445 (defcustom mh-invisible-header-fields-default nil
2446 "*List of hidden header fields.
2448 The header fields listed in this option are hidden, although you
2449 can check off any field that you would like to see.
2451 Header fields that you would like to hide that aren't listed can
2452 be added to the option `mh-invisible-header-fields'.
2454 See also `mh-clean-message-header-flag'."
2455 :type `(set ,@(mapcar (lambda (x) `(const ,x))
2456 mh-invisible-header-fields-internal))
2457 :set (lambda (symbol value)
2458 (set-default symbol value)
2459 (mh-invisible-headers))
2462 (defvar mh-invisible-header-fields-compiled nil
2463 "*Regexp matching lines in a message header that are not to be shown.
2464 Do not alter this variable directly. Instead, customize
2465 `mh-invisible-header-fields-default' checking for fields normally
2466 hidden that you wish to display, and add extra entries to hide in
2467 `mh-invisible-header-fields'.")
2469 (defun mh-invisible-headers ()
2470 "Make or remake the variable `mh-invisible-header-fields-compiled'.
2471 Done using `mh-invisible-header-fields-internal' as input, from
2472 which entries from `mh-invisible-header-fields-default' are
2473 removed and entries from `mh-invisible-header-fields' are added."
2474 (let ((fields mh-invisible-header-fields-internal))
2475 (when mh-invisible-header-fields-default
2476 ;; Remove entries from `mh-invisible-header-fields-default'
2478 (loop for x in fields
2479 unless (member x mh-invisible-header-fields-default)
2481 (when (and (boundp 'mh-invisible-header-fields)
2482 mh-invisible-header-fields)
2483 (dolist (x mh-invisible-header-fields)
2484 (unless (member x fields) (setq fields (cons x fields)))))
2486 (setq mh-invisible-header-fields-compiled
2489 ;; workaround for insufficient default
2490 (let ((max-specpdl-size 1000))
2491 (regexp-opt fields t))))
2492 (setq mh-invisible-header-fields-compiled nil))))
2494 ;; Compile invisible header fields.
2495 (mh-invisible-headers)
2497 (defcustom mh-lpr-command-format "lpr -J '%s'"
2498 "*Command used to print\\<mh-folder-mode-map>.
2500 This option contains the Unix command line which performs the
2501 actual printing for the \\[mh-print-msg] command. The string can
2502 contain one escape, \"%s\", which is replaced by the name of the
2503 folder and the message number and is useful for print job names.
2504 I use \"mpage -h'%s' -b Letter -H1of -mlrtb -P\" which produces a
2505 nice header and adds a bit of margin so the text fits within my
2508 This options is not used by the commands \\[mh-ps-print-msg] or
2509 \\[mh-ps-print-msg-file]."
2513 (defcustom mh-max-inline-image-height nil
2514 "*Maximum inline image height if \"Content-Disposition:\" is not present.
2516 Some older mail programs do not insert this needed plumbing to
2517 tell MH-E whether to display the attachments inline or not. If
2518 this is the case, MH-E will display these images inline if they
2519 are smaller than the window. However, you might want to allow
2520 larger images to be displayed inline. To do this, you can change
2521 the options `mh-max-inline-image-width' and
2522 `mh-max-inline-image-height' from their default value of zero to
2523 a large number. The size of your screen is a good choice for
2525 :type '(choice (const nil) integer)
2528 (defcustom mh-max-inline-image-width nil
2529 "*Maximum inline image width if \"Content-Disposition:\" is not present.
2531 Some older mail programs do not insert this needed plumbing to
2532 tell MH-E whether to display the attachments inline or not. If
2533 this is the case, MH-E will display these images inline if they
2534 are smaller than the window. However, you might want to allow
2535 larger images to be displayed inline. To do this, you can change
2536 the options `mh-max-inline-image-width' and
2537 `mh-max-inline-image-height' from their default value of zero to
2538 a large number. The size of your screen is a good choice for
2540 :type '(choice (const nil) integer)
2543 (defcustom mh-mhl-format-file nil
2544 "*Specifies the format file to pass to the \"mhl\" program.
2546 Normally MH-E takes care of displaying messages itself (rather than
2547 calling an MH program to do the work). If you'd rather have \"mhl\"
2548 display the message (within MH-E), change this option from its default
2549 value of \"Use Default mhl Format (Printing Only)\".
2551 You can set this option to \"Use Default mhl Format\" to get the same
2552 output as you would get if you ran \"mhl\" from the shell.
2554 If you have a format file that you want MH-E to use, you can set this
2555 option to \"Specify an mhl Format File\" and enter the name of your
2556 format file. Your format file should specify a non-zero value for
2557 \"overflowoffset\" to allow MH-E to parse the header. Note that
2558 \"mhl\" is always used for printing and forwarding; in this case, the
2559 value of this option is consulted if you have specified a format
2561 :type '(choice (const :tag "Use Default mhl Format (Printing Only)" nil)
2562 (const :tag "Use Default mhl Format" t)
2563 (file :tag "Specify an mhl Format File"))
2566 (defcustom mh-mime-save-parts-default-directory t
2567 "Default directory to use for \\<mh-folder-mode-map>\\[mh-mime-save-parts].
2569 The default value for this option is \"Prompt Always\" so that
2570 you are always prompted for the directory in which to save the
2571 attachments. However, if you usually use the same directory
2572 within a session, then you can set this option to \"Prompt the
2573 First Time\" to avoid the prompt each time. you can make this
2574 directory permanent by choosing \"Directory\" and entering the
2576 :type '(choice (const :tag "Prompt the First Time" nil)
2577 (const :tag "Prompt Always" t)
2581 (defcustom mh-print-background-flag nil
2582 "*Non-nil means messages should be printed in the background\\<mh-folder-mode-map>.
2584 Normally messages are printed in the foreground. If this is slow on
2585 your system, you may elect to turn off this option to print in the
2588 WARNING: If you do this, do not delete the message until it is printed
2589 or else the output may be truncated.
2591 This option is not used by the commands \\[mh-ps-print-msg] or
2592 \\[mh-ps-print-msg-file]."
2596 (defcustom mh-show-maximum-size 0
2597 "*Maximum size of message (in bytes) to display automatically.
2599 This option provides an opportunity to skip over large messages
2600 which may be slow to load. The default value of 0 means that all
2601 message are shown regardless of size."
2605 (defcustom mh-show-use-goto-addr-flag (and (boundp 'goto-address-highlight-p)
2606 goto-address-highlight-p)
2607 "*Non-nil means highlight URLs and email addresses\\<goto-address-highlight-keymap>.
2609 To send a message using the highlighted email address or to view
2610 the web page for the highlighted URL, use the middle mouse button
2611 or \\[goto-address-at-point].
2613 See Info node `(mh-e)Sending Mail' to see how to configure Emacs
2614 to send the message using MH-E.
2616 The default value of this option comes from the value of
2617 `goto-address-highlight-p'."
2621 (defcustom mh-show-use-xface-flag (>= emacs-major-version 21)
2622 "*Non-nil means display face images in MH-show buffers.
2624 MH-E can display the content of \"Face:\", \"X-Face:\", and
2625 \"X-Image-URL:\" header fields. If any of these fields occur in the
2626 header of your message, the sender's face will appear in the \"From:\"
2627 header field. If more than one of these fields appear, then the first
2628 field found in the order \"Face:\", \"X-Face:\", and \"X-Image-URL:\"
2631 The option `mh-show-use-xface-flag' is used to turn this feature on
2632 and off. This feature will be turned on by default if your system
2635 The first header field used, if present, is the Gnus-specific
2636 \"Face:\" field. The \"Face:\" field appeared in GNU Emacs 21 and
2637 XEmacs. For more information, see URL
2638 `http://quimby.gnus.org/circus/face/'. Next is the traditional
2639 \"X-Face:\" header field. The display of this field requires the
2640 \"uncompface\" program (see URL
2641 `ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.z'). Recent
2642 versions of XEmacs have internal support for \"X-Face:\" images. If
2643 your version of XEmacs does not, then you'll need both \"uncompface\"
2644 and the x-face package (see URL `ftp://ftp.jpl.org/pub/elisp/').
2646 Finally, MH-E will display images referenced by the \"X-Image-URL:\"
2647 header field if neither the \"Face:\" nor the \"X-Face:\" fields are
2648 present. The display of the images requires \"wget\" (see URL
2649 `http://www.gnu.org/software/wget/wget.html'), \"fetch\", or \"curl\"
2650 to fetch the image and the \"convert\" program from the ImageMagick
2651 suite (see URL `http://www.imagemagick.org/'). Of the three header
2652 fields this is the most efficient in terms of network usage since the
2653 image doesn't need to be transmitted with every single mail.
2655 The option `mh-fetch-x-image-url' controls the fetching of the
2656 \"X-Image-URL:\" header field image."
2660 (defcustom mh-store-default-directory nil
2661 "*Default directory for \\<mh-folder-mode-map>\\[mh-store-msg].
2663 If you would like to change the initial default directory,
2664 customize this option, change the value from \"Current\" to
2665 \"Directory\", and then enter the name of the directory for storing
2666 the content of these messages."
2667 :type '(choice (const :tag "Current" nil)
2671 (defcustom mh-summary-height nil
2672 "*Number of lines in MH-Folder buffer (including the mode line).
2674 The default value of this option is \"Automatic\" which means
2675 that the MH-Folder buffer will maintain the same proportional
2676 size if the frame is resized. If you'd prefer a fixed height,
2677 then choose the \"Fixed Size\" option and enter the number of
2678 lines you'd like to see."
2679 :type '(choice (const :tag "Automatic" nil)
2680 (integer :tag "Fixed Size"))
2685 ;;; The Speedbar (:group 'mh-speedbar)
2687 (defcustom mh-speed-update-interval 60
2688 "Time between speedbar updates in seconds.
2689 Set to 0 to disable automatic update."
2691 :group 'mh-speedbar)
2695 ;;; Threading (:group 'mh-thread)
2697 (defcustom mh-show-threads-flag nil
2698 "*Non-nil means new folders start in threaded mode.
2700 Threading large number of messages can be time consuming so this
2701 option is turned off by default. If you turn this option on, then
2702 threading will be done only if the number of messages being
2703 threaded is less than `mh-large-folder'."
2709 ;;; The Tool Bar (:group 'mh-tool-bar)
2711 ;; mh-tool-bar-folder-buttons and mh-tool-bar-letter-buttons defined
2712 ;; dynamically in mh-tool-bar.el.
2714 (defcustom mh-tool-bar-search-function 'mh-search
2715 "*Function called by the tool bar search button.
2717 By default, this is set to `mh-search'. You can also choose
2718 \"Other Function\" from the \"Value Menu\" and enter a function
2719 of your own choosing."
2720 :type '(choice (const mh-search)
2721 (function :tag "Other Function"))
2722 :group 'mh-tool-bar)
2724 ;; XEmacs has a couple of extra customizations...
2726 (defcustom mh-xemacs-use-tool-bar-flag mh-xemacs-has-tool-bar-flag
2727 "*If non-nil, use tool bar.
2729 This option controls whether to show the MH-E icons at all. By
2730 default, this option is turned on if the window system supports
2731 tool bars. If your system doesn't support tool bars, then you
2732 won't be able to turn on this option."
2735 :set (lambda (symbol value)
2736 (if (and (eq value t)
2737 (not mh-xemacs-has-tool-bar-flag))
2738 (error "Tool bar not supported"))
2739 (set-default symbol value)))
2741 (defcustom mh-xemacs-tool-bar-position nil
2742 "*Tool bar location.
2744 This option controls the placement of the tool bar along the four
2745 edges of the frame. You can choose from one of \"Same As Default
2746 Tool Bar\", \"Top\", \"Bottom\", \"Left\", or \"Right\". If this
2747 variable is set to anything other than \"Same As Default Tool
2748 Bar\" and the default tool bar is in a different location, then
2749 two tool bars will be displayed: the MH-E tool bar and the
2751 :type '(radio (const :tag "Same As Default Tool Bar" :value nil)
2752 (const :tag "Top" :value top)
2753 (const :tag "Bottom" :value bottom)
2754 (const :tag "Left" :value left)
2755 (const :tag "Right" :value right))
2756 :group 'mh-tool-bar))
2760 ;;; Hooks (:group 'mh-hooks + group where hook described)
2762 (defcustom mh-after-commands-processed-hook nil
2763 "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] after performing outstanding refile and delete requests.
2765 Variables that are useful in this hook include
2766 `mh-folders-changed', which lists which folders were affected by
2767 deletes and refiles. This list will always include the current
2768 folder, which is also available in `mh-current-folder'."
2773 (defcustom mh-alias-reloaded-hook nil
2774 "Hook run by `mh-alias-reload' after loading aliases."
2779 (defcustom mh-before-commands-processed-hook nil
2780 "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding refile and delete requests.
2782 Variables that are useful in this hook include `mh-delete-list'
2783 and `mh-refile-list' which can be used to see which changes will
2784 be made to the current folder, `mh-current-folder'."
2789 (defcustom mh-before-quit-hook nil
2790 "Hook run by \\<mh-folder-mode-map>\\[mh-quit] before quitting MH-E.
2792 This hook is called before the quit occurs, so you might use it
2793 to perform any MH-E operations; you could perform some query and
2794 abort the quit or call `mh-execute-commands', for example.
2796 See also `mh-quit-hook'."
2801 (defcustom mh-before-send-letter-hook nil
2802 "Hook run at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command.
2804 For example, if you want to check your spelling in your message
2805 before sending, add the `ispell-message' function."
2807 :options '(ispell-message)
2811 (defcustom mh-delete-msg-hook nil
2812 "Hook run by \\<mh-letter-mode-map>\\[mh-delete-msg] after marking each message for deletion.
2814 For example, a past maintainer of MH-E used this once when he
2815 kept statistics on his mail usage."
2820 (defcustom mh-find-path-hook nil
2821 "Hook run by `mh-find-path' after reading the user's MH profile.
2823 This hook can be used the change the value of the variables that
2824 `mh-find-path' sets if you need to run with different values
2825 between MH and MH-E."
2830 (defcustom mh-folder-mode-hook nil
2831 "Hook run by `mh-folder-mode' when visiting a new folder."
2836 (defcustom mh-forward-hook nil
2837 "Hook run by `mh-forward' on a forwarded letter."
2840 :group 'mh-sending-mail)
2842 (defcustom mh-inc-folder-hook nil
2843 "Hook run by \\<mh-folder-mode-map>\\[mh-inc-folder] after incorporating mail into a folder."
2848 (defcustom mh-insert-signature-hook nil
2849 "Hook run by \\<mh-letter-mode-map>\\[mh-insert-signature] after signature has been inserted.
2851 Hook functions may access the actual name of the file or the
2852 function used to insert the signature with
2853 `mh-signature-file-name'."
2858 (defcustom mh-kill-folder-suppress-prompt-hooks '(mh-search-p)
2859 "Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder].
2861 The hook functions are called with no arguments and should return
2862 a non-nil value to suppress the normal prompt when you remove a
2863 folder. This is useful for folders that are easily regenerated.
2865 The default value of `mh-search-p' suppresses the prompt on
2866 folders generated by searching.
2868 WARNING: Use this hook with care. If there is a bug in your hook
2869 which returns t on \"+inbox\" and you hit \\[mh-kill-folder] by
2870 accident in the \"+inbox\" folder, you will not be happy."
2875 (defcustom mh-letter-mode-hook nil
2876 "Hook run by `mh-letter-mode' on a new letter.
2878 This hook allows you to do some processing before editing a
2879 letter. For example, you may wish to modify the header after
2880 \"repl\" has done its work, or you may have a complicated
2881 \"components\" file and need to tell MH-E where the cursor should
2885 :group 'mh-sending-mail)
2887 (defcustom mh-mh-to-mime-hook nil
2888 "Hook run on the formatted letter by \\<mh-letter-mode-map>\\[mh-mh-to-mime]."
2893 (defcustom mh-search-mode-hook nil
2894 "Hook run upon entry to `mh-search-mode'\\<mh-folder-mode-map>.
2896 If you find that you do the same thing over and over when editing
2897 the search template, you may wish to bind some shortcuts to keys.
2898 This can be done with this hook which is called when
2899 \\[mh-search] is run on a new pattern."
2904 (defcustom mh-quit-hook nil
2905 "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
2907 This hook is not run in an MH-E context, so you might use it to
2908 modify the window setup.
2910 See also `mh-before-quit-hook'."
2915 (defcustom mh-refile-msg-hook nil
2916 "Hook run by \\<mh-folder-mode-map>\\[mh-refile-msg] after marking each message for refiling."
2921 (defcustom mh-show-hook nil
2922 "Hook run after \\<mh-folder-mode-map>\\[mh-show] shows a message.
2924 It is the last thing called after messages are displayed. It's
2925 used to affect the behavior of MH-E in general or when
2926 `mh-show-mode-hook' is too early. See `mh-show-mode-hook'."
2931 (defcustom mh-show-mode-hook nil
2932 "Hook run upon entry to `mh-show-mode'.
2934 This hook is called early on in the process of the message
2935 display. It is usually used to perform some action on the
2936 message's content. See `mh-show-hook'."
2941 (defcustom mh-unseen-updated-hook nil
2942 "Hook run after the unseen sequence has been updated.
2944 The variable `mh-seen-list' can be used by this hook to obtain
2945 the list of messages which were removed from the unseen
2949 :group 'mh-sequences)
2953 ;;; Faces (:group 'mh-faces + group where faces described)
2955 (if (boundp 'facemenu-unlisted-faces)
2956 (add-to-list 'facemenu-unlisted-faces "^mh-"))
2958 (defvar mh-min-colors-defined-flag (and (not mh-xemacs-flag)
2959 (>= emacs-major-version 22))
2960 "Non-nil means defface supports min-colors display requirement.")
2962 (defun mh-defface-compat (spec)
2963 "Convert SPEC for defface if necessary to run on older platforms.
2964 Modifies SPEC in place and returns it. See `defface' for the spec definition.
2966 When `mh-min-colors-defined-flag' is nil, this function finds
2967 display entries with \"min-colors\" requirements and either
2968 removes the \"min-colors\" requirement or strips the display
2969 entirely if the display does not support the number of specified
2971 (if mh-min-colors-defined-flag
2973 (let ((cells (display-color-cells))
2975 ;; Remove entries with min-colors, or delete them if we have fewer colors
2976 ;; than they specify.
2977 (loop for entry in (reverse spec) do
2978 (let ((requirement (if (eq (car entry) t)
2980 (assoc 'min-colors (car entry)))))
2982 (when (>= cells (nth 1 requirement))
2983 (setq new-spec (cons (cons (delq requirement (car entry))
2986 (setq new-spec (cons entry new-spec)))))
2989 (defface mh-folder-address '((t (:inherit mh-folder-subject)))
2994 (defface mh-folder-body
2996 (:inherit mh-folder-msg-number))
2998 (:inherit mh-folder-msg-number :italic t)))
3003 (defface mh-folder-cur-msg-number
3005 (:inherit mh-folder-msg-number :bold t)))
3006 "Current message number face."
3010 (defface mh-folder-date '((t (:inherit mh-folder-msg-number)))
3015 (defface mh-folder-deleted '((t (:inherit mh-folder-msg-number)))
3016 "Deleted message face."
3020 (defface mh-folder-followup
3021 '((((class color) (background light))
3022 (:foreground "blue3"))
3023 (((class color) (background dark))
3024 (:foreground "LightGoldenRod"))
3031 (defface mh-folder-msg-number
3033 '((((class color) (min-colors 88) (background light))
3034 (:foreground "snow4"))
3035 (((class color) (min-colors 88) (background dark))
3036 (:foreground "snow3"))
3038 (:foreground "cyan"))))
3040 "Message number face."
3044 (defface mh-folder-refiled
3046 '((((class color) (min-colors 88) (background light))
3047 (:foreground "DarkGoldenrod"))
3048 (((class color) (min-colors 88) (background dark))
3049 (:foreground "LightGoldenrod"))
3051 (:foreground "yellow" :weight light))
3052 (((class grayscale) (background light))
3053 (:foreground "Gray90" :bold t :italic t))
3054 (((class grayscale) (background dark))
3055 (:foreground "DimGray" :bold t :italic t))
3057 (:bold t :italic t))))
3058 "Refiled message face."
3062 (defface mh-folder-sent-to-me-hint '((t (:inherit mh-folder-date)))
3063 "Fontification hint face in messages sent directly to us.
3064 The detection of messages sent to us is governed by the scan
3065 format `mh-scan-format-nmh' and the regular expression
3066 `mh-scan-sent-to-me-sender-regexp'."
3070 (defface mh-folder-sent-to-me-sender '((t (:inherit mh-folder-followup)))
3071 "Sender face in messages sent directly to us.
3072 The detection of messages sent to us is governed by the scan
3073 format `mh-scan-format-nmh' and the regular expression
3074 `mh-scan-sent-to-me-sender-regexp'."
3078 (defface mh-folder-subject
3079 '((((class color) (background light))
3080 (:foreground "blue4"))
3081 (((class color) (background dark))
3082 (:foreground "yellow"))
3089 (defface mh-folder-tick
3090 '((((class color) (background dark))
3091 (:background "#dddf7e"))
3092 (((class color) (background light))
3093 (:background "#dddf7e"))
3096 "Ticked message face."
3100 (defface mh-folder-to
3102 '((((class color) (min-colors 88) (background light))
3103 (:foreground "RosyBrown"))
3104 (((class color) (min-colors 88) (background dark))
3105 (:foreground "LightSalmon"))
3107 (:foreground "green"))
3108 (((class grayscale) (background light))
3109 (:foreground "DimGray" :italic t))
3110 (((class grayscale) (background dark))
3111 (:foreground "LightGray" :italic t))
3118 (defface mh-search-folder
3119 '((((class color) (background light))
3120 (:foreground "dark green" :bold t))
3121 (((class color) (background dark))
3122 (:foreground "indian red" :bold t))
3125 "Folder heading face in MH-Folder buffers created by searches."
3129 (defface mh-letter-header-field
3130 '((((class color) (background light))
3131 (:background "gray90"))
3132 (((class color) (background dark))
3133 (:background "gray10"))
3136 "Editable header field value face in draft buffers."
3142 '((((class color) (min-colors 88) (background light))
3143 (:foreground "DarkGoldenrod"))
3144 (((class color) (min-colors 88) (background dark))
3145 (:foreground "LightGoldenrod"))
3147 (:foreground "yellow" :weight light))
3148 (((class grayscale) (background light))
3149 (:foreground "Gray90" :bold t :italic t))
3150 (((class grayscale) (background dark))
3151 (:foreground "DimGray" :bold t :italic t))
3153 (:bold t :italic t))))
3154 "Face used to highlight \"cc:\" header fields."
3158 (defface mh-show-date
3160 '((((class color) (min-colors 88) (background light))
3161 (:foreground "ForestGreen"))
3162 (((class color) (min-colors 88) (background dark))
3163 (:foreground "PaleGreen"))
3165 (:foreground "green"))
3166 (((class grayscale) (background light))
3167 (:foreground "Gray90" :bold t))
3168 (((class grayscale) (background dark))
3169 (:foreground "DimGray" :bold t))
3171 (:bold t :underline t))))
3172 "Face used to highlight \"Date:\" header fields."
3176 (defface mh-show-from
3177 '((((class color) (background light))
3178 (:foreground "red3"))
3179 (((class color) (background dark))
3180 (:foreground "cyan"))
3183 "Face used to highlight \"From:\" header fields."
3187 (defface mh-show-header
3189 '((((class color) (min-colors 88) (background light))
3190 (:foreground "RosyBrown"))
3191 (((class color) (min-colors 88) (background dark))
3192 (:foreground "LightSalmon"))
3194 (:foreground "green"))
3195 (((class grayscale) (background light))
3196 (:foreground "DimGray" :italic t))
3197 (((class grayscale) (background dark))
3198 (:foreground "LightGray" :italic t))
3201 "Face used to deemphasize less interesting header fields."
3205 (defface mh-show-pgg-bad '((t (:bold t :foreground "DeepPink1")))
3206 "Bad PGG signature face."
3210 (defface mh-show-pgg-good '((t (:bold t :foreground "LimeGreen")))
3211 "Good PGG signature face."
3215 (defface mh-show-pgg-unknown '((t (:bold t :foreground "DarkGoldenrod2")))
3216 "Unknown or untrusted PGG signature face."
3220 (defface mh-show-signature '((t (:italic t)))
3225 (defface mh-show-subject '((t (:inherit mh-folder-subject)))
3226 "Face used to highlight \"Subject:\" header fields."
3231 '((((class color) (background light))
3232 (:foreground "SaddleBrown"))
3233 (((class color) (background dark))
3234 (:foreground "burlywood"))
3235 (((class grayscale) (background light))
3236 (:foreground "DimGray" :underline t))
3237 (((class grayscale) (background dark))
3238 (:foreground "LightGray" :underline t))
3240 "Face used to highlight \"To:\" header fields."
3244 (defface mh-show-xface '((t (:inherit (mh-show-from highlight))))
3246 The background and foreground are used in the image."
3250 (defface mh-speedbar-folder
3251 '((((class color) (background light))
3252 (:foreground "blue4"))
3253 (((class color) (background dark))
3254 (:foreground "light blue")))
3255 "Basic folder face."
3257 :group 'mh-speedbar)
3259 (defface mh-speedbar-folder-with-unseen-messages
3261 (:inherit mh-speedbar-folder :bold t)))
3262 "Folder face when folder contains unread messages."
3264 :group 'mh-speedbar)
3266 (defface mh-speedbar-selected-folder
3267 '((((class color) (background light))
3268 (:foreground "red1" :underline t))
3269 (((class color) (background dark))
3270 (:foreground "red1" :underline t))
3273 "Selected folder face."
3275 :group 'mh-speedbar)
3277 (defface mh-speedbar-selected-folder-with-unseen-messages
3279 (:inherit mh-speedbar-selected-folder :bold t)))
3280 "Selected folder face when folder contains unread messages."
3282 :group 'mh-speedbar)
3287 ;; indent-tabs-mode: nil
3288 ;; sentence-end-double-space: nil
3291 ;; arch-tag: cce884de-bd37-4104-9963-e4439d5ed22b
3292 ;;; mh-e.el ends here