Mercurial > emacs
comparison lisp/mh-e/mh-utils.el @ 68975:90801dac7d88
(mh-image-load-path): Fix problem that images on load-path or
image-load-path would win over relative paths (newer MH-E or Emacs
distribution).
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Fri, 17 Feb 2006 18:36:03 +0000 |
parents | 133a58334c29 |
children | 18babada4b1e |
comparison
equal
deleted
inserted
replaced
68974:977852fb2e3b | 68975:90801dac7d88 |
---|---|
109 already there. | 109 already there. |
110 | 110 |
111 See also variable `mh-image-load-path-called-flag'." | 111 See also variable `mh-image-load-path-called-flag'." |
112 (unless mh-image-load-path-called-flag | 112 (unless mh-image-load-path-called-flag |
113 (cond | 113 (cond |
114 (mh-image-load-path) ; user setting exists; we're done | 114 (mh-image-load-path) ; user setting exists |
115 ((mh-image-search-load-path "mh-logo.xpm") | 115 ((let (mh-library-name) ; try relative setting |
116 ;; Images already in image-load-path. | |
117 (setq mh-image-load-path | |
118 (file-name-directory (mh-image-search-load-path "mh-logo.xpm")))) | |
119 ((locate-library "mh-logo.xpm") | |
120 ;; Images already in load-path. | |
121 (setq mh-image-load-path | |
122 (file-name-directory (locate-library "mh-logo.xpm")))) | |
123 (t | |
124 ;; Guess `mh-image-load-path' if it wasn't provided by the user. | |
125 (let (mh-library-name) | |
126 ;; First, find mh-e in the load-path. | 116 ;; First, find mh-e in the load-path. |
127 (setq mh-library-name (locate-library "mh-e")) | 117 (setq mh-library-name (locate-library "mh-e")) |
128 (if (not mh-library-name) | 118 (if (not mh-library-name) |
129 (error "Can not find MH-E in load-path")) | 119 (error "Can not find MH-E in load-path")) |
130 ;; And then set mh-image-load-path relative to that. | 120 ;; And then set mh-image-load-path relative to that. |
131 (setq mh-image-load-path | 121 (setq mh-image-load-path |
132 (expand-file-name (concat | 122 (expand-file-name (concat |
133 (file-name-directory mh-library-name) | 123 (file-name-directory mh-library-name) |
134 "../../etc/images")))))) | 124 "../../etc/images"))) |
125 (file-exists-p (expand-file-name "mh-logo.xpm" mh-image-load-path)))) | |
126 ((mh-image-search-load-path "mh-logo.xpm") | |
127 ;; Images in image-load-path. | |
128 (setq mh-image-load-path | |
129 (file-name-directory (mh-image-search-load-path "mh-logo.xpm")))) | |
130 ((locate-library "mh-logo.xpm") | |
131 ;; Images in load-path. | |
132 (setq mh-image-load-path | |
133 (file-name-directory (locate-library "mh-logo.xpm"))))) | |
134 | |
135 (if (not (file-exists-p mh-image-load-path)) | 135 (if (not (file-exists-p mh-image-load-path)) |
136 (error "Directory %s in mh-image-load-path does not exist" | 136 (error "Directory %s in mh-image-load-path does not exist" |
137 mh-image-load-path)) | 137 mh-image-load-path)) |
138 (if (not (file-exists-p | 138 (if (not (file-exists-p |
139 (expand-file-name "mh-logo.xpm" mh-image-load-path))) | 139 (expand-file-name "mh-logo.xpm" mh-image-load-path))) |