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