mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-05 15:11:30 -08:00
(mh-image-load-path): Use locate-library to find MH-E. This simplified
the code a lot. Flattened out nested statements even more.
This commit is contained in:
parent
c1253aade3
commit
8f552dc868
2 changed files with 18 additions and 30 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2005-10-16 Bill Wohler <wohler@newt.com>
|
||||
|
||||
* mh-init.el (mh-image-load-path): Use locate-library to find
|
||||
MH-E. This simplified the code a lot. Flattened out nested
|
||||
statements even more.
|
||||
|
||||
2005-10-16 Satyaki Das <satyaki@theforce.stanford.edu>
|
||||
|
||||
* mh-init.el (mh-image-load-path): Remove use of pushnew since it
|
||||
|
|
|
|||
|
|
@ -300,14 +300,6 @@ by the variable `mh-variants'."
|
|||
(add-to-list 'mh-variants variant)))))
|
||||
mh-variants)))
|
||||
|
||||
;;; XXX The two calls to message in this function should really be calls to
|
||||
;;; error. However, when this function is compiled via the top-level call in
|
||||
;;; mh-customize.el, it is actually called, and in a compile environment, the
|
||||
;;; errors are triggered which botches the compile. As a workaround, the calls
|
||||
;;; to error have been changed to calls to message, and code following was
|
||||
;;; inserted as an else clause. This is not robust, so if you can fix this,
|
||||
;;; please do!
|
||||
|
||||
(defvar mh-image-load-path-called-flag nil)
|
||||
|
||||
;;;###mh-autoload
|
||||
|
|
@ -317,30 +309,20 @@ Images for MH-E are found in ../../etc/images relative to the files in
|
|||
`lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images
|
||||
directory is added to it if isn't already there. Otherwise, the images
|
||||
directory is added to the `load-path' if it isn't already there."
|
||||
(message "mh-image-load-path called") ;XXX: for debugging
|
||||
(unless mh-image-load-path-called-flag
|
||||
(let (mh-load-path mh-image-load-path)
|
||||
(let (mh-library-name mh-image-load-path)
|
||||
;; First, find mh-e in the load-path.
|
||||
(setq mh-load-path
|
||||
(loop for dir in load-path
|
||||
for dir-name = (directory-file-name dir)
|
||||
when (and (equal (file-name-nondirectory dir-name) "mh-e")
|
||||
(file-exists-p dir-name))
|
||||
return dir-name))
|
||||
(if mh-load-path
|
||||
(setq mh-image-load-path
|
||||
(expand-file-name (concat (file-name-directory mh-load-path)
|
||||
"../etc/images")))
|
||||
(error "Can not find mh-e in load-path"))
|
||||
(cond ((or (not mh-image-load-path)
|
||||
(not (file-exists-p mh-image-load-path)))
|
||||
(error "Can not find image directory %s"
|
||||
mh-image-load-path))
|
||||
((boundp 'image-load-path)
|
||||
(unless (member mh-image-load-path image-load-path)
|
||||
(push mh-image-load-path image-load-path)))
|
||||
((not (member mh-image-load-path load-path))
|
||||
(push mh-image-load-path load-path))))
|
||||
(setq mh-library-name (locate-library "mh-e"))
|
||||
(if (not mh-library-name)
|
||||
(error "Can not find MH-E in load-path"))
|
||||
(setq mh-image-load-path
|
||||
(expand-file-name (concat (file-name-directory mh-library-name)
|
||||
"../../etc/images")))
|
||||
(if (not (file-exists-p mh-image-load-path))
|
||||
(error "Can not find image directory %s" mh-image-load-path))
|
||||
(if (boundp 'image-load-path)
|
||||
(add-to-list 'image-load-path mh-image-load-path)
|
||||
(add-to-list 'load-path mh-image-load-path)))
|
||||
(setq mh-image-load-path-called-flag t)))
|
||||
|
||||
(provide 'mh-init)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue