aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wohler2006-03-11 01:59:13 +0000
committerBill Wohler2006-03-11 01:59:13 +0000
commit08f99a547c509e958a25782893251da277ea606f (patch)
treeb3b3aa566d4b01917d984fb4eb1e5a9e39f935d6
parent4a732ae9652dfdbb83530b1bb6221de06b4b0e61 (diff)
downloademacs-08f99a547c509e958a25782893251da277ea606f.tar.gz
emacs-08f99a547c509e958a25782893251da277ea606f.zip
(mh-image-load-path-for-library): Merged changes from Reiner. Add
no-error argument. If path t, just return directory.
-rw-r--r--lisp/mh-e/ChangeLog2
-rw-r--r--lisp/mh-e/mh-compat.el22
2 files changed, 19 insertions, 5 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index eecba3767f4..ffb73d5425d 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -4,6 +4,8 @@
4 flag to replace-in-string. This was badly needed by 4 flag to replace-in-string. This was badly needed by
5 mh-quote-pick-expr in order to properly quote subjects when using 5 mh-quote-pick-expr in order to properly quote subjects when using
6 / s on XEmacs (closes SF #1447598). 6 / s on XEmacs (closes SF #1447598).
7 (mh-image-load-path-for-library): Merged changes from Reiner. Add
8 no-error argument. If path t, just return directory.
7 9
8 * mh-e.el (mh-profile-component): Drop `s' from mhparam 10 * mh-e.el (mh-profile-component): Drop `s' from mhparam
9 -components for Mailutils compatibility (closes SF #1446985). 11 -components for Mailutils compatibility (closes SF #1446985).
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el
index f048308ae30..d6bded8726e 100644
--- a/lisp/mh-e/mh-compat.el
+++ b/lisp/mh-e/mh-compat.el
@@ -116,7 +116,7 @@ introduced in Emacs 22."
116 `(face-background ,face ,frame ,inherit))) 116 `(face-background ,face ,frame ,inherit)))
117 117
118(mh-defun-compat mh-image-load-path-for-library 118(mh-defun-compat mh-image-load-path-for-library
119 image-load-path-for-library (library image &optional path) 119 image-load-path-for-library (library image &optional path no-error)
120 "Return a suitable search path for images relative to LIBRARY. 120 "Return a suitable search path for images relative to LIBRARY.
121 121
122Images for LIBRARY are searched for in \"../../etc/images\" and 122Images for LIBRARY are searched for in \"../../etc/images\" and
@@ -124,8 +124,12 @@ Images for LIBRARY are searched for in \"../../etc/images\" and
124well as in `image-load-path' and `load-path'. 124well as in `image-load-path' and `load-path'.
125 125
126This function returns the value of `load-path' augmented with the 126This function returns the value of `load-path' augmented with the
127path to IMAGE. If PATH is given, it is used instead of 127directory containing IMAGE. If PATH is given, it is used instead
128`load-path'. 128of `load-path'. If PATH is t, just return the directory that
129contains IMAGE.
130
131If NO-ERROR is non-nil, return nil if a suitable path can't be
132found rather than signaling an error.
129 133
130Here is an example that uses a common idiom to provide 134Here is an example that uses a common idiom to provide
131compatibility with versions of Emacs that lack the variable 135compatibility with versions of Emacs that lack the variable
@@ -179,11 +183,19 @@ This function is used by Emacs versions that don't have
179 (setq img (directory-file-name parent) 183 (setq img (directory-file-name parent)
180 dir (expand-file-name "../" dir))) 184 dir (expand-file-name "../" dir)))
181 (setq image-directory dir))))) 185 (setq image-directory dir)))))
186 (no-error
187 ;; In this case we will return nil.
188 (message "Could not find image %s for library %s" image library))
182 (t 189 (t
183 (error "Could not find image %s for library %s" image library))) 190 (error "Could not find image %s for library %s" image library)))
184 191
185 ;; Return augmented `image-load-path' or `load-path'. 192 ;; Return the directory, nil if no-error was non-nil and a
186 (cond ((and path (symbolp path)) 193 ;; suitable path could not be found, or an augmented
194 ;; `image-load-path' or `load-path'.
195 (cond ((or (null image-directory)
196 (eq path t))
197 image-directory)
198 ((and path (symbolp path))
187 (nconc (list image-directory) 199 (nconc (list image-directory)
188 (delete image-directory 200 (delete image-directory
189 (if (boundp path) 201 (if (boundp path)