From: Bill Wohler Date: Sat, 11 Mar 2006 22:39:35 +0000 (+0000) Subject: (Defining Images): Add image-load-path-for-library. X-Git-Tag: emacs-pretest-22.0.90~3662 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2c676341953c28fb8194b197966d90e2277fe920;p=emacs.git (Defining Images): Add image-load-path-for-library. --- diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 9dbcd41f5a0..23e6b78b130 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2006-03-11 Bill Wohler + + * display.texi (Defining Images): Add image-load-path-for-library. + 2006-03-11 Luc Teirlinck * text.texi (Adaptive Fill): Fix Texinfo usage. diff --git a/lispref/display.texi b/lispref/display.texi index b9d949a01dd..5053d7def39 100644 --- a/lispref/display.texi +++ b/lispref/display.texi @@ -4125,6 +4125,35 @@ should specify the image as follows: @end example @end defvar +@defun image-load-path-for-library library image &optional path no-error +Return a suitable search path for images relative to @var{library}. + +Images for @var{library} are searched for in @file{../../etc/images} +and @file{../etc/images} relative to the files in +@file{lisp/@var{library}} as well as in @code{image-load-path} and +@var{load-path}. + +This function returns the value of @code{load-path} augmented with the +directory containing @var{image}. If @var{path} is given, it is used +instead of @code{load-path}. If @code{path} is @code{t}, just return +the directory that contains @var{image}. + +If @var{no-error} is non-nil, this function returns @code{nil} if a +suitable path can't be found rather than signaling an error. + +Here is an example that uses a common idiom to provide compatibility +with versions of Emacs that lack the variable @code{image-load-path}: + +@example +(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)) +@end example +@end defun + @node Showing Images @subsection Showing Images