annotate lisp/mh-e/mh-init.el @ 67383:b9bee637452c

version 3.23
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 08 Dec 2005 13:14:19 +0000
parents 4b8cea82e2d9
children 315e71e95246
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1 ;;; mh-init.el --- MH-E initialization.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
2
67245
4b8cea82e2d9 (mh-defface-compat): Checkdoc fix.
Bill Wohler <wohler@newt.com>
parents: 66716
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
4
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
5 ;; Author: Peter S. Galbraith <psg@debian.org>
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
7 ;; Keywords: mail
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
8 ;; See: mh-e.el
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
15 ;; any later version.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
16
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
21
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62847
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62847
diff changeset
25 ;; Boston, MA 02110-1301, USA.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27 ;;; Commentary:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
28
66716
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
29 ;; Sets up the MH variant (currently nmh, MH, or GNU mailutils).
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
30 ;;
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
31 ;; Users may customize `mh-variant' to switch between available variants.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
32 ;; Available MH variants are described in the variable `mh-variants'.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
33 ;; Developers may check which variant is currently in use with the
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
34 ;; variable `mh-variant-in-use' or the function `mh-variant-p'.
66716
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
35 ;;
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
36 ;; Also contains code that is used at load or initialization time only.
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38 ;;; Change Log:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
39
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
40 ;;; Code:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
41
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
42 (eval-when-compile (require 'mh-acros))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
43 (mh-require-cl)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
44 (require 'mh-utils)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
45
65980
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
46 ;;; Avoid compiler warnings.
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
47 (eval-when-compile (defvar image-load-path))
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
48
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
49 ;;; Set for local environment:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
50 ;;; mh-progs and mh-lib used to be set in paths.el, which tried to
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
51 ;;; figure out at build time which of several possible directories MH
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
52 ;;; was installed into. But if you installed MH after building Emacs,
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
53 ;;; this would almost certainly be wrong, so now we do it at run time.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
54
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
55 (defvar mh-progs nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
56 "Directory containing MH commands, such as inc, repl, and rmm.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
57
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
58 (defvar mh-lib nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
59 "Directory containing the MH library.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
60 This directory contains, among other things, the components file.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
61
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
62 (defvar mh-lib-progs nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
63 "Directory containing MH helper programs.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
64 This directory contains, among other things, the mhl program.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
65
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
66 (defvar mh-flists-present-flag nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
67 "Non-nil means that we have `flists'.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
68
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
69 ;;;###autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
70 (put 'mh-progs 'risky-local-variable t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
71 ;;;###autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
72 (put 'mh-lib 'risky-local-variable t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
73 ;;;###autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
74 (put 'mh-lib-progs 'risky-local-variable t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
75
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
76 (defvar mh-variant-in-use nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
77 "The MH variant currently in use; a string with variant and version number.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
78 This differs from `mh-variant' when the latter is set to `autodetect'.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
79
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
80 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
81 (defun mh-variant-set (variant)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
82 "Set the MH variant to VARIANT.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
83 Sets `mh-progs', `mh-lib', `mh-lib-progs' and `mh-flists-present-flag'.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
84 If the VARIANT is `autodetect', then first try nmh, then MH and finally
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
85 GNU mailutils."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
86 (interactive
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
87 (list (completing-read
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
88 "MH Variant: "
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
89 (mapcar (lambda (x) (list (car x))) (mh-variants))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
90 nil t)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
91 (let ((valid-list (mapcar (lambda (x) (car x)) (mh-variants))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
92 (cond
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
93 ((eq variant 'none))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
94 ((eq variant 'autodetect)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
95 (cond
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
96 ((mh-variant-set-variant 'nmh)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
97 (message "%s installed as MH variant" mh-variant-in-use))
56787
25da1d331c99 Upgraded to MH-E version 7.82.
Bill Wohler <wohler@newt.com>
parents: 56677
diff changeset
98 ((mh-variant-set-variant 'mh)
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
99 (message "%s installed as MH variant" mh-variant-in-use))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
100 ((mh-variant-set-variant 'mu-mh)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
101 (message "%s installed as MH variant" mh-variant-in-use))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
102 (t
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
103 (message "No MH variant found on the system!"))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
104 ((member variant valid-list)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
105 (when (not (mh-variant-set-variant variant))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
106 (message "Warning: %s variant not found. Autodetecting..." variant)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
107 (mh-variant-set 'autodetect)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
108 (t
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
109 (message "Unknown variant. Use %s"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
110 (mapconcat '(lambda (x) (format "%s" (car x)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
111 mh-variants " or "))))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
112
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
113 (defun mh-variant-set-variant (variant)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
114 "Setup the system variables for the MH variant named VARIANT.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
115 If VARIANT is a string, use that key in the variable `mh-variants'.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
116 If VARIANT is a symbol, select the first entry that matches that variant."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
117 (cond
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
118 ((stringp variant) ;e.g. "nmh 1.1-RC1"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
119 (when (assoc variant mh-variants)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
120 (let* ((alist (cdr (assoc variant mh-variants)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
121 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
122 (lib (cadr (assoc 'mh-lib alist)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
123 (progs (cadr (assoc 'mh-progs alist)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
124 (flists (cadr (assoc 'flists alist))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
125 ;;(set-default mh-variant variant)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
126 (setq mh-x-mailer-string nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
127 mh-flists-present-flag flists
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
128 mh-lib-progs lib-progs
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
129 mh-lib lib
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
130 mh-progs progs
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
131 mh-variant-in-use variant))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
132 ((symbolp variant) ;e.g. 'nmh (pick the first match)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
133 (loop for variant-list in mh-variants
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
134 when (eq variant (cadr (assoc 'variant (cdr variant-list))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
135 return (let* ((version (car variant-list))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
136 (alist (cdr variant-list))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
137 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
138 (lib (cadr (assoc 'mh-lib alist)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
139 (progs (cadr (assoc 'mh-progs alist)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
140 (flists (cadr (assoc 'flists alist))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
141 ;;(set-default mh-variant flavor)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
142 (setq mh-x-mailer-string nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
143 mh-flists-present-flag flists
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
144 mh-lib-progs lib-progs
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
145 mh-lib lib
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
146 mh-progs progs
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
147 mh-variant-in-use version)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
148 t)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
149
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
150 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
151 (defun mh-variant-p (&rest variants)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
152 "Return t if variant is any of VARIANTS.
56787
25da1d331c99 Upgraded to MH-E version 7.82.
Bill Wohler <wohler@newt.com>
parents: 56677
diff changeset
153 Currently known variants are 'MH, 'nmh, and 'mu-mh."
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
154 (let ((variant-in-use
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
155 (cadr (assoc 'variant (assoc mh-variant-in-use mh-variants)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
156 (not (null (member variant-in-use variants)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
157
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
158 (defvar mh-sys-path
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
159 '("/usr/local/nmh/bin" ; nmh default
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
160 "/usr/local/bin/mh/"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
161 "/usr/local/mh/"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
162 "/usr/bin/mh/" ; Ultrix 4.2, Linux
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
163 "/usr/new/mh/" ; Ultrix < 4.2
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164 "/usr/contrib/mh/bin/" ; BSDI
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
165 "/usr/pkg/bin/" ; NetBSD
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
166 "/usr/local/bin/"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
167 "/usr/local/bin/mu-mh/" ; GNU mailutils - default
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
168 "/usr/bin/mu-mh/") ; GNU mailutils - packaged
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
169 "List of directories to search for variants of the MH variant.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
170 The list `exec-path' is searched in addition to this list.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
171 There's no need for users to modify this list. Instead add extra
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
172 directories to the customizable variable `mh-path'.")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
173
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
174 (defcustom mh-path nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
175 "*List of directories to search for variants of the MH variant.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
176 The directories will be searched for `mhparam' in addition to directories
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
177 listed in `mh-sys-path' and `exec-path'."
65980
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
178 :group 'mh-e
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179 :type '(repeat (directory)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
180
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
181 (defvar mh-variants nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
182 "List describing known MH variants.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
183 Created by the function `mh-variants'")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
184
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
185 (defun mh-variant-mh-info (dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
186 "Return info for MH variant in DIR assuming a temporary buffer is setup."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
187 ;; MH does not have the -version option.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
188 ;; Its version number is included in the output of `-help' as:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
189 ;;
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
190 ;; version: MH 6.8.4 #2[UCI] (burrito) of Fri Jan 15 20:01:39 EST 1999
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
191 ;; options: [ATHENA] [BIND] [DUMB] [LIBLOCKFILE] [LOCALE] [MAILGROUP] [MHE]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
192 ;; [MHRC] [MIME] [MORE='"/usr/bin/sensible-pager"'] [NLINK_HACK]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
193 ;; [NORUSERPASS] [OVERHEAD] [POP] [POPSERVICE='"pop-3"'] [RENAME]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
194 ;; [RFC1342] [RPATHS] [RPOP] [SENDMTS] [SMTP] [SOCKETS]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
195 ;; [SPRINTFTYPE=int] [SVR4] [SYS5] [SYS5DIR] [TERMINFO]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
196 ;; [TYPESIG=void] [UNISTD] [UTK] [VSPRINTF]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
197 (let ((mhparam (expand-file-name "mhparam" dir)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
198 (when (and (file-exists-p mhparam) (file-executable-p mhparam))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
199 (erase-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
200 (call-process mhparam nil '(t nil) nil "-help")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
201 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
202 (when (search-forward-regexp "version: MH \\(\\S +\\)" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
203 (let ((version (format "MH %s" (match-string 1))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
204 (erase-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
205 (call-process mhparam nil '(t nil) nil "libdir")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
206 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
207 (when (search-forward-regexp "^.*$" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
208 (let ((libdir (match-string 0)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
209 `(,version
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
210 (variant mh)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
211 (mh-lib-progs ,libdir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
212 (mh-lib ,libdir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
213 (mh-progs ,dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
214 (flists nil)))))))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
215
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
216 (defun mh-variant-mu-mh-info (dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
217 "Return info for GNU mailutils variant in DIR.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
218 This assumes that a temporary buffer is setup."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
219 ;; 'mhparam -version' output:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
220 ;; mhparam (GNU mailutils 0.3.2)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
221 (let ((mhparam (expand-file-name "mhparam" dir)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
222 (when (and (file-exists-p mhparam) (file-executable-p mhparam))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
223 (erase-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
224 (call-process mhparam nil '(t nil) nil "-version")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
225 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
226 (when (search-forward-regexp "mhparam (\\(GNU [Mm]ailutils \\S +\\))"
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
227 nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
228 (let ((version (match-string 1)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
229 (erase-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
230 (call-process mhparam nil '(t nil) nil "libdir" "etcdir")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
231 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
232 (when (search-forward-regexp "^libdir:\\s-\\(\\S-+\\)\\s-*$" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
233 (let ((libdir (match-string 1)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
234 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
235 (when (search-forward-regexp
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
236 "^etcdir:\\s-\\(\\S-+\\)\\s-*$" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
237 (let ((etcdir (match-string 1))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
238 (flists (file-exists-p (expand-file-name "flists" dir))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
239 `(,version
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
240 (variant mu-mh)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
241 (mh-lib-progs ,libdir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
242 (mh-lib ,etcdir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
243 (mh-progs ,dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
244 (flists ,flists)))))))))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
245
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
246 (defun mh-variant-nmh-info (dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
247 "Return info for nmh variant in DIR assuming a temporary buffer is setup."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
248 ;; `mhparam -version' outputs:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
249 ;; mhparam -- nmh-1.1-RC1 [compiled on chaak at Fri Jun 20 11:03:28 PDT 2003]
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
250 (let ((mhparam (expand-file-name "mhparam" dir)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
251 (when (and (file-exists-p mhparam) (file-executable-p mhparam))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
252 (erase-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
253 (call-process mhparam nil '(t nil) nil "-version")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
254 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
255 (when (search-forward-regexp "mhparam -- nmh-\\(\\S +\\)" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
256 (let ((version (format "nmh %s" (match-string 1))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
257 (erase-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
258 (call-process mhparam nil '(t nil) nil "libdir" "etcdir")
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
259 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
260 (when (search-forward-regexp "^libdir:\\s-\\(\\S-+\\)\\s-*$" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
261 (let ((libdir (match-string 1)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
262 (goto-char (point-min))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
263 (when (search-forward-regexp
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
264 "^etcdir:\\s-\\(\\S-+\\)\\s-*$" nil t)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
265 (let ((etcdir (match-string 1))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
266 (flists (file-exists-p (expand-file-name "flists" dir))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
267 `(,version
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
268 (variant nmh)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
269 (mh-lib-progs ,libdir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
270 (mh-lib ,etcdir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
271 (mh-progs ,dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
272 (flists ,flists)))))))))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
273
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
274 (defun mh-variant-info (dir)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
275 "Return MH variant found in DIR, or nil if none present."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
276 (save-excursion
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
277 (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
278 (set-buffer tmp-buffer)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
279 (cond
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
280 ((mh-variant-mh-info dir))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
281 ((mh-variant-nmh-info dir))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
282 ((mh-variant-mu-mh-info dir))))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
283
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
284 ;;;###mh-autoload
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
285 (defun mh-variants ()
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
286 "Return a list of installed variants of MH on the system.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
287 This function looks for MH in `mh-sys-path', `mh-path' and
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
288 `exec-path'. The format of the list of variants that is returned is described
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
289 by the variable `mh-variants'."
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
290 (if mh-variants
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
291 mh-variants
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
292 (let ((list-unique))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
293 ;; Make a unique list of directories, keeping the given order.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
294 ;; We don't want the same MH variant to be listed multiple times.
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
295 (loop for dir in (append mh-path mh-sys-path exec-path) do
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
296 (setq dir (file-chase-links (directory-file-name dir)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
297 (add-to-list 'list-unique dir))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
298 (loop for dir in (nreverse list-unique) do
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
299 (when (and dir (file-directory-p dir) (file-readable-p dir))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
300 (let ((variant (mh-variant-info dir)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
301 (if variant
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
302 (add-to-list 'mh-variants variant)))))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
303 mh-variants)))
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
304
66716
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
305
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
306
66113
bfb1c3364c23 * mh-init.el (mh-image-load-path-called-flag): New variable which
Satyaki Das <satyaki@theforce.stanford.edu>
parents: 66087
diff changeset
307 (defvar mh-image-load-path-called-flag nil)
bfb1c3364c23 * mh-init.el (mh-image-load-path-called-flag): New variable which
Satyaki Das <satyaki@theforce.stanford.edu>
parents: 66087
diff changeset
308
65980
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
309 ;;;###mh-autoload
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
310 (defun mh-image-load-path ()
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
311 "Ensure that the MH-E images are accessible by `find-image'.
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
312 Images for MH-E are found in ../../etc/images relative to the files in
66087
88d998016498 * mh-e.el, mh-funcs.el, mh-init.el, mh-mime.el, mh-pick.el, mh-seq.el:
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
313 `lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images
65980
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
314 directory is added to it if isn't already there. Otherwise, the images
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
315 directory is added to the `load-path' if it isn't already there."
66113
bfb1c3364c23 * mh-init.el (mh-image-load-path-called-flag): New variable which
Satyaki Das <satyaki@theforce.stanford.edu>
parents: 66087
diff changeset
316 (unless mh-image-load-path-called-flag
66136
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
317 (let (mh-library-name mh-image-load-path)
66113
bfb1c3364c23 * mh-init.el (mh-image-load-path-called-flag): New variable which
Satyaki Das <satyaki@theforce.stanford.edu>
parents: 66087
diff changeset
318 ;; First, find mh-e in the load-path.
66136
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
319 (setq mh-library-name (locate-library "mh-e"))
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
320 (if (not mh-library-name)
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
321 (error "Can not find MH-E in load-path"))
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
322 (setq mh-image-load-path
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
323 (expand-file-name (concat (file-name-directory mh-library-name)
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
324 "../../etc/images")))
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
325 (if (not (file-exists-p mh-image-load-path))
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
326 (error "Can not find image directory %s" mh-image-load-path))
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
327 (if (boundp 'image-load-path)
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
328 (add-to-list 'image-load-path mh-image-load-path)
aacff8293f4b (mh-image-load-path): Use locate-library to find MH-E. This simplified
Bill Wohler <wohler@newt.com>
parents: 66128
diff changeset
329 (add-to-list 'load-path mh-image-load-path)))
66113
bfb1c3364c23 * mh-init.el (mh-image-load-path-called-flag): New variable which
Satyaki Das <satyaki@theforce.stanford.edu>
parents: 66087
diff changeset
330 (setq mh-image-load-path-called-flag t)))
65980
4520ae2624f2 * mh-init.el (mh-image-load-path): New function that adds the path to
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
331
66716
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
332
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
333
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
334 (defvar mh-min-colors-defined-flag (and (not mh-xemacs-flag)
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
335 (>= emacs-major-version 22))
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
336 "Non-nil means defface supports min-colors display requirement.")
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
337
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
338 (defun mh-defface-compat (spec)
67245
4b8cea82e2d9 (mh-defface-compat): Checkdoc fix.
Bill Wohler <wohler@newt.com>
parents: 66716
diff changeset
339 "Convert SPEC for defface if necessary to run on older platforms.
66716
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
340 See `defface' for the spec definition.
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
341
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
342 When `mh-min-colors-defined-flag' is nil, this function finds a display with a
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
343 single \"class\" requirement with a \"color\" item, renames the requirement to
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
344 \"tty\" and moves it to the beginning of the list. It then strips any
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
345 \"min-colors\" requirements."
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
346 (when (not mh-min-colors-defined-flag)
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
347 ;; Insert ((class tty)) display with ((class color)) attributes.
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
348 (let ((attributes (cdr (assoc '((class color)) spec))))
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
349 (cons (cons '((class tty)) attributes) spec))
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
350 ;; Delete ((class color)) display.
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
351 (delq (assoc '((class color)) spec) spec)
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
352 ;; Strip min-colors.
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
353 (loop for entry in spec do
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
354 (when (not (eq (car entry) t))
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
355 (if (assoc 'min-colors (car entry))
25ad3e63f2a1 * mh-customize.el (mh-min-colors-defined-flag, mh-defface-compat):
Bill Wohler <wohler@newt.com>
parents: 66136
diff changeset
356 (delq (assoc 'min-colors (car entry)) (car entry)))))))
67245
4b8cea82e2d9 (mh-defface-compat): Checkdoc fix.
Bill Wohler <wohler@newt.com>
parents: 66716
diff changeset
357
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
358 (provide 'mh-init)
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
359
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
360 ;;; Local Variables:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
361 ;;; indent-tabs-mode: nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
362 ;;; sentence-end-double-space: nil
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
363 ;;; End:
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
364
56677
5aafbbdd005f Add arch taglines
Miles Bader <miles@gnu.org>
parents: 56676
diff changeset
365 ;; arch-tag: e8372aeb-d803-42b1-9c95-3c93ad22f63c
56676
db6d7638a259 Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
366 ;;; mh-init.el ends here