diff options
Diffstat (limited to 'lisp/mh-e/mh-utils.el')
-rw-r--r-- | lisp/mh-e/mh-utils.el | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index bf0d29fd2a7..c00558860d1 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -96,10 +96,11 @@ This variable is used by that function to avoid doing the work repeatedly.") "Ensure that the MH-E images are accessible by `find-image'. Images for MH-E are found in \"../../etc/images\" relative to the -files in \"lisp/mh-e\". This function saves the actual location -found in the variable `mh-image-load-path'. If the images on your -system are actually located elsewhere, then set the variable -`mh-image-load-path' before starting MH-E. +files in \"lisp/mh-e\", in `image-load-path', or in `load-path'. +This function saves the actual location found in the variable +`mh-image-load-path'. If the images on your system are actually +located elsewhere, then set the variable `mh-image-load-path' +before starting MH-E. If `image-load-path' exists (since Emacs 22), then the contents of the variable `mh-image-load-path' is added to it if isn't @@ -110,40 +111,38 @@ already there. See also variable `mh-image-load-path-called-flag'." (unless mh-image-load-path-called-flag (cond - ((and mh-image-load-path - (file-exists-p (expand-file-name "mh-logo.xpm" - mh-image-load-path)))) - ;; User setting exists. We're done. - ((and mh-image-load-path - (not (file-exists-p (expand-file-name "mh-logo.xpm" - mh-image-load-path)))) - ;; User setting does not exist. - (message "Variable mh-image-load-path %s does not contain MH-E images" - mh-image-load-path)) - ((mh-image-search-load-path "mh-logo.xpm") - ;; Emacs 22 already knows where the images are. - (setq mh-image-load-path - (file-name-directory (mh-image-search-load-path "mh-logo.xpm")))) - ((locate-library "mh-logo.xpm") - ;; Other Emacs already knows where the images are... - (setq mh-image-load-path - (file-name-directory (locate-library "mh-logo.xpm")))) - (t - ;; Guess `mh-image-load-path' if it wasn't provided by the user. - (let (mh-library-name) + (mh-image-load-path) ; user setting exists + ((let (mh-library-name) ; try relative setting ;; First, find mh-e in the load-path. (setq mh-library-name (locate-library "mh-e")) (if (not mh-library-name) (error "Can not find MH-E in load-path")) + ;; And then set mh-image-load-path relative to that. (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)))) + "../../etc/images"))) + (file-exists-p (expand-file-name "mh-logo.xpm" mh-image-load-path)))) + ((mh-image-search-load-path "mh-logo.xpm") + ;; Images in image-load-path. + (setq mh-image-load-path + (file-name-directory (mh-image-search-load-path "mh-logo.xpm")))) + ((locate-library "mh-logo.xpm") + ;; Images in load-path. + (setq mh-image-load-path + (file-name-directory (locate-library "mh-logo.xpm"))))) + + (if (not (file-exists-p mh-image-load-path)) + (error "Directory %s in mh-image-load-path does not exist" + mh-image-load-path)) + (if (not (file-exists-p + (expand-file-name "mh-logo.xpm" mh-image-load-path))) + (error "Directory %s in mh-image-load-path does not contain MH-E images" + 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))) ;;;###mh-autoload |