diff options
| -rw-r--r-- | lisp/mh-e/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/mh-e/mh-init.el | 42 |
2 files changed, 18 insertions, 30 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index 093f5ee21ed..89f257ed2a3 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2005-10-16 Bill Wohler <wohler@newt.com> | ||
| 2 | |||
| 3 | * mh-init.el (mh-image-load-path): Use locate-library to find | ||
| 4 | MH-E. This simplified the code a lot. Flattened out nested | ||
| 5 | statements even more. | ||
| 6 | |||
| 1 | 2005-10-16 Satyaki Das <satyaki@theforce.stanford.edu> | 7 | 2005-10-16 Satyaki Das <satyaki@theforce.stanford.edu> |
| 2 | 8 | ||
| 3 | * mh-init.el (mh-image-load-path): Remove use of pushnew since it | 9 | * mh-init.el (mh-image-load-path): Remove use of pushnew since it |
diff --git a/lisp/mh-e/mh-init.el b/lisp/mh-e/mh-init.el index 4b84e525725..dcc9af84e41 100644 --- a/lisp/mh-e/mh-init.el +++ b/lisp/mh-e/mh-init.el | |||
| @@ -300,14 +300,6 @@ by the variable `mh-variants'." | |||
| 300 | (add-to-list 'mh-variants variant))))) | 300 | (add-to-list 'mh-variants variant))))) |
| 301 | mh-variants))) | 301 | mh-variants))) |
| 302 | 302 | ||
| 303 | ;;; XXX The two calls to message in this function should really be calls to | ||
| 304 | ;;; error. However, when this function is compiled via the top-level call in | ||
| 305 | ;;; mh-customize.el, it is actually called, and in a compile environment, the | ||
| 306 | ;;; errors are triggered which botches the compile. As a workaround, the calls | ||
| 307 | ;;; to error have been changed to calls to message, and code following was | ||
| 308 | ;;; inserted as an else clause. This is not robust, so if you can fix this, | ||
| 309 | ;;; please do! | ||
| 310 | |||
| 311 | (defvar mh-image-load-path-called-flag nil) | 303 | (defvar mh-image-load-path-called-flag nil) |
| 312 | 304 | ||
| 313 | ;;;###mh-autoload | 305 | ;;;###mh-autoload |
| @@ -317,30 +309,20 @@ Images for MH-E are found in ../../etc/images relative to the files in | |||
| 317 | `lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images | 309 | `lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images |
| 318 | directory is added to it if isn't already there. Otherwise, the images | 310 | directory is added to it if isn't already there. Otherwise, the images |
| 319 | directory is added to the `load-path' if it isn't already there." | 311 | directory is added to the `load-path' if it isn't already there." |
| 320 | (message "mh-image-load-path called") ;XXX: for debugging | ||
| 321 | (unless mh-image-load-path-called-flag | 312 | (unless mh-image-load-path-called-flag |
| 322 | (let (mh-load-path mh-image-load-path) | 313 | (let (mh-library-name mh-image-load-path) |
| 323 | ;; First, find mh-e in the load-path. | 314 | ;; First, find mh-e in the load-path. |
| 324 | (setq mh-load-path | 315 | (setq mh-library-name (locate-library "mh-e")) |
| 325 | (loop for dir in load-path | 316 | (if (not mh-library-name) |
| 326 | for dir-name = (directory-file-name dir) | 317 | (error "Can not find MH-E in load-path")) |
| 327 | when (and (equal (file-name-nondirectory dir-name) "mh-e") | 318 | (setq mh-image-load-path |
| 328 | (file-exists-p dir-name)) | 319 | (expand-file-name (concat (file-name-directory mh-library-name) |
| 329 | return dir-name)) | 320 | "../../etc/images"))) |
| 330 | (if mh-load-path | 321 | (if (not (file-exists-p mh-image-load-path)) |
| 331 | (setq mh-image-load-path | 322 | (error "Can not find image directory %s" mh-image-load-path)) |
| 332 | (expand-file-name (concat (file-name-directory mh-load-path) | 323 | (if (boundp 'image-load-path) |
| 333 | "../etc/images"))) | 324 | (add-to-list 'image-load-path mh-image-load-path) |
| 334 | (error "Can not find mh-e in load-path")) | 325 | (add-to-list 'load-path mh-image-load-path))) |
| 335 | (cond ((or (not mh-image-load-path) | ||
| 336 | (not (file-exists-p mh-image-load-path))) | ||
| 337 | (error "Can not find image directory %s" | ||
| 338 | mh-image-load-path)) | ||
| 339 | ((boundp 'image-load-path) | ||
| 340 | (unless (member mh-image-load-path image-load-path) | ||
| 341 | (push mh-image-load-path image-load-path))) | ||
| 342 | ((not (member mh-image-load-path load-path)) | ||
| 343 | (push mh-image-load-path load-path)))) | ||
| 344 | (setq mh-image-load-path-called-flag t))) | 326 | (setq mh-image-load-path-called-flag t))) |
| 345 | 327 | ||
| 346 | (provide 'mh-init) | 328 | (provide 'mh-init) |