diff options
| author | Bill Wohler | 2006-02-16 18:32:15 +0000 |
|---|---|---|
| committer | Bill Wohler | 2006-02-16 18:32:15 +0000 |
| commit | dccd067f3a744752bba4542d91d704de66fa889f (patch) | |
| tree | 45faa28fb2f604d65322417039d8dde9cb3466cf | |
| parent | bc7b6e08e28c81c710949540a0f0c2426b3b6e5c (diff) | |
| download | emacs-dccd067f3a744752bba4542d91d704de66fa889f.tar.gz emacs-dccd067f3a744752bba4542d91d704de66fa889f.zip | |
(mh-image-load-path): The variables image-load-path or load-path would
not get updated if user set mh-image-load-path. Moved tests and
add-to-list calls outside of cond so they are applied consistently,
even if they are redundant in some circumstances. Efficiency isn't a
concern here. Made error messages more user-friendly.
| -rw-r--r-- | lisp/mh-e/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/mh-e/mh-utils.el | 45 |
2 files changed, 31 insertions, 23 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index 3dcf689767a..67fd051fda8 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2006-02-16 Bill Wohler <wohler@newt.com> | ||
| 2 | |||
| 3 | * mh-utils.el (mh-image-load-path): The variables image-load-path | ||
| 4 | or load-path would not get updated if user set mh-image-load-path. | ||
| 5 | Moved tests and add-to-list calls outside of cond so they are | ||
| 6 | applied consistently, even if they are redundant in some | ||
| 7 | circumstances. Efficiency isn't a concern here. Made error | ||
| 8 | messages more user-friendly. | ||
| 9 | |||
| 1 | 2006-02-15 Peter S Galbraith <psg@debian.org> | 10 | 2006-02-15 Peter S Galbraith <psg@debian.org> |
| 2 | 11 | ||
| 3 | * mh-compat.el (mh-image-search-load-path): Compatibility code. | 12 | * mh-compat.el (mh-image-search-load-path): Compatibility code. |
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index bf0d29fd2a7..58d29bc5d1c 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.") | |||
| 96 | "Ensure that the MH-E images are accessible by `find-image'. | 96 | "Ensure that the MH-E images are accessible by `find-image'. |
| 97 | 97 | ||
| 98 | Images for MH-E are found in \"../../etc/images\" relative to the | 98 | Images for MH-E are found in \"../../etc/images\" relative to the |
| 99 | files in \"lisp/mh-e\". This function saves the actual location | 99 | files in \"lisp/mh-e\", in `image-load-path', or in `load-path'. |
| 100 | found in the variable `mh-image-load-path'. If the images on your | 100 | This function saves the actual location found in the variable |
| 101 | system are actually located elsewhere, then set the variable | 101 | `mh-image-load-path'. If the images on your system are actually |
| 102 | `mh-image-load-path' before starting MH-E. | 102 | located elsewhere, then set the variable `mh-image-load-path' |
| 103 | before starting MH-E. | ||
| 103 | 104 | ||
| 104 | If `image-load-path' exists (since Emacs 22), then the contents | 105 | If `image-load-path' exists (since Emacs 22), then the contents |
| 105 | of the variable `mh-image-load-path' is added to it if isn't | 106 | of the variable `mh-image-load-path' is added to it if isn't |
| @@ -110,40 +111,38 @@ already there. | |||
| 110 | See also variable `mh-image-load-path-called-flag'." | 111 | See also variable `mh-image-load-path-called-flag'." |
| 111 | (unless mh-image-load-path-called-flag | 112 | (unless mh-image-load-path-called-flag |
| 112 | (cond | 113 | (cond |
| 113 | ((and mh-image-load-path | 114 | (mh-image-load-path) ; user setting exists; we're done |
| 114 | (file-exists-p (expand-file-name "mh-logo.xpm" | ||
| 115 | mh-image-load-path)))) | ||
| 116 | ;; User setting exists. We're done. | ||
| 117 | ((and mh-image-load-path | ||
| 118 | (not (file-exists-p (expand-file-name "mh-logo.xpm" | ||
| 119 | mh-image-load-path)))) | ||
| 120 | ;; User setting does not exist. | ||
| 121 | (message "Variable mh-image-load-path %s does not contain MH-E images" | ||
| 122 | mh-image-load-path)) | ||
| 123 | ((mh-image-search-load-path "mh-logo.xpm") | 115 | ((mh-image-search-load-path "mh-logo.xpm") |
| 124 | ;; Emacs 22 already knows where the images are. | 116 | ;; Images already in image-load-path. |
| 125 | (setq mh-image-load-path | 117 | (setq mh-image-load-path |
| 126 | (file-name-directory (mh-image-search-load-path "mh-logo.xpm")))) | 118 | (file-name-directory (mh-image-search-load-path "mh-logo.xpm")))) |
| 127 | ((locate-library "mh-logo.xpm") | 119 | ((locate-library "mh-logo.xpm") |
| 128 | ;; Other Emacs already knows where the images are... | 120 | ;; Images already in load-path. |
| 129 | (setq mh-image-load-path | 121 | (setq mh-image-load-path |
| 130 | (file-name-directory (locate-library "mh-logo.xpm")))) | 122 | (file-name-directory (locate-library "mh-logo.xpm")))) |
| 131 | (t | 123 | (t |
| 132 | ;; Guess `mh-image-load-path' if it wasn't provided by the user. | 124 | ;; Guess `mh-image-load-path' if it wasn't provided by the user. |
| 133 | (let (mh-library-name) | 125 | (let (mh-library-name) |
| 134 | ;; First, find mh-e in the load-path. | 126 | ;; First, find mh-e in the load-path. |
| 135 | (setq mh-library-name (locate-library "mh-e")) | 127 | (setq mh-library-name (locate-library "mh-e")) |
| 136 | (if (not mh-library-name) | 128 | (if (not mh-library-name) |
| 137 | (error "Can not find MH-E in load-path")) | 129 | (error "Can not find MH-E in load-path")) |
| 130 | ;; And then set mh-image-load-path relative to that. | ||
| 138 | (setq mh-image-load-path | 131 | (setq mh-image-load-path |
| 139 | (expand-file-name (concat | 132 | (expand-file-name (concat |
| 140 | (file-name-directory mh-library-name) | 133 | (file-name-directory mh-library-name) |
| 141 | "../../etc/images")))) | 134 | "../../etc/images")))))) |
| 142 | (if (not (file-exists-p mh-image-load-path)) | 135 | (if (not (file-exists-p mh-image-load-path)) |
| 143 | (error "Can not find image directory %s" mh-image-load-path)) | 136 | (error "Directory %s in mh-image-load-path does not exist" |
| 144 | (if (boundp 'image-load-path) | 137 | mh-image-load-path)) |
| 145 | (add-to-list 'image-load-path mh-image-load-path) | 138 | (if (not (file-exists-p |
| 146 | (add-to-list 'load-path mh-image-load-path)))) | 139 | (expand-file-name "mh-logo.xpm" mh-image-load-path))) |
| 140 | (error "Directory %s in mh-image-load-path does not contain MH-E images" | ||
| 141 | mh-image-load-path)) | ||
| 142 | (if (boundp 'image-load-path) | ||
| 143 | (add-to-list 'image-load-path mh-image-load-path) | ||
| 144 | (add-to-list 'load-path mh-image-load-path)) | ||
| 145 | |||
| 147 | (setq mh-image-load-path-called-flag t))) | 146 | (setq mh-image-load-path-called-flag t))) |
| 148 | 147 | ||
| 149 | ;;;###mh-autoload | 148 | ;;;###mh-autoload |