diff options
author | Bill Wohler <wohler@newt.com> | 2006-03-14 19:21:48 +0000 |
---|---|---|
committer | Bill Wohler <wohler@newt.com> | 2006-03-14 19:21:48 +0000 |
commit | 44e3f44013ee5d526d2666e2ec8ed4962f9a6c77 (patch) | |
tree | 159a8f63cdce362b039861c2e196fe0749ab38b4 /lisp/mh-e/mh-compat.el | |
parent | 5248a565cad8ca4a489fb8e8cd1bd21a2cf8f006 (diff) | |
download | emacs-44e3f44013ee5d526d2666e2ec8ed4962f9a6c77.tar.gz |
* mh-compat.el (mh-image-load-path-for-library): Incorporate changes
from image-load-path-for-library, which are:
(image-load-path-for-library): Pass value of path rather than symbol.
Always return list of directories. Guarantee that image directory
comes first.
* mh-e.el (image-load-path): Define on those Emacsen that lack it to
avoid compile and run-time errors.
* mh-folder.el (mh-folder-mode): Use new idiom for setting
image-load-path.
* mh-letter.el (mh-letter-mode): Ditto.
* mh-utils.el (mh-logo-display): Ditto.
Diffstat (limited to 'lisp/mh-e/mh-compat.el')
-rw-r--r-- | lisp/mh-e/mh-compat.el | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index d6bded8726e..50542d67f4e 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -119,30 +119,30 @@ introduced in Emacs 22." image-load-path-for-library (library image &optional path no-error) "Return a suitable search path for images relative to LIBRARY. -Images for LIBRARY are searched for in \"../../etc/images\" and -\"../etc/images\" relative to the files in \"lisp/LIBRARY\" as -well as in `image-load-path' and `load-path'. +First it searches for IMAGE in a path suitable for LIBRARY, which +includes \"../../etc/images\" and \"../etc/images\" relative to +the library file itself, followed by `image-load-path' and +`load-path'. -This function returns the value of `load-path' augmented with the -directory containing IMAGE. If PATH is given, it is used instead -of `load-path'. If PATH is t, just return the directory that -contains IMAGE. +Then this function returns a list of directories which contains +first the directory in which IMAGE was found, followed by the +value of `load-path'. If PATH is given, it is used instead of +`load-path'. -If NO-ERROR is non-nil, return nil if a suitable path can't be -found rather than signaling an error. +If NO-ERROR is non-nil and a suitable path can't be found, don't +signal an error. Instead, return a list of directories as before, +except that nil appears in place of the image directory. Here is an example that uses a common idiom to provide compatibility with versions of Emacs that lack the variable `image-load-path': - (let ((load-path - (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) - (image-load-path - (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\" 'image-load-path))) - (mh-tool-bar-folder-buttons-init)) + ;; Avoid errors on Emacsen without `image-load-path'. + (if (not (boundp 'image-load-path)) (defvar image-load-path nil)) -This function is used by Emacs versions that don't have -`image-load-path-for-library'." + (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) + (image-load-path (cons (car load-path) image-load-path))) + (mh-tool-bar-folder-buttons-init))" (unless library (error "No library specified")) (unless image (error "No image specified")) (let ((image-directory)) @@ -184,26 +184,13 @@ This function is used by Emacs versions that don't have dir (expand-file-name "../" dir))) (setq image-directory dir))))) (no-error - ;; In this case we will return nil. (message "Could not find image %s for library %s" image library)) (t (error "Could not find image %s for library %s" image library))) - ;; Return the directory, nil if no-error was non-nil and a - ;; suitable path could not be found, or an augmented - ;; `image-load-path' or `load-path'. - (cond ((or (null image-directory) - (eq path t)) - image-directory) - ((and path (symbolp path)) - (nconc (list image-directory) - (delete image-directory - (if (boundp path) - (copy-sequence (symbol-value path)) - nil)))) - (t - (nconc (list image-directory) - (delete image-directory (copy-sequence load-path))))))) + ;; Return an augmented `path' or `load-path'. + (nconc (list image-directory) + (delete image-directory (copy-sequence (or path load-path)))))) (mh-defun-compat mh-image-search-load-path image-search-load-path (file &optional path) |