summaryrefslogtreecommitdiff
path: root/lisp/image.el
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-04-26 17:34:09 +0000
committerGerd Moellmann <gerd@gnu.org>2000-04-26 17:34:09 +0000
commit349c034d9e90a341e81a7c01df5e3af1495db093 (patch)
tree33e838451f9125acbfc5e5b90d961495132d9ff5 /lisp/image.el
parentd7d47268cc8f5df63e1d68fedce83f91127d8074 (diff)
downloademacs-349c034d9e90a341e81a7c01df5e3af1495db093.tar.gz
(find-image): New function.
(defimage): Rewritten to find image at load time.
Diffstat (limited to 'lisp/image.el')
-rw-r--r--lisp/image.el36
1 files changed, 27 insertions, 9 deletions
diff --git a/lisp/image.el b/lisp/image.el
index 534cafe1e9b..78ca54add95 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -176,8 +176,8 @@ BUFFER nil or omitted means use the current buffer."
;;;###autoload
-(defmacro defimage (symbol specs &optional doc)
- "Define SYMBOL as an image.
+(defun find-image (specs)
+ "Find an image, choosing one of a list of image specifications.
SPECS is a list of image specifications. DOC is an optional
documentation string.
@@ -189,12 +189,7 @@ least contain the properties `:type TYPE' and either `:file FILE' or
e.g. `xbm', FILE is the file to load the image from, and DATA is a
string containing the actual image data. The first image
specification whose TYPE is supported, and FILE exists, is used to
-define SYMBOL.
-
-Example:
-
- (defimage test-image ((:type xpm :file \"~/test1.xpm\")
- (:type xbm :file \"~/test1.xbm\")))"
+define SYMBOL."
(let (image)
(while (and specs (null image))
(let* ((spec (car specs))
@@ -216,7 +211,30 @@ Example:
((not (null data))
(setq image (cons 'image spec)))))
(setq specs (cdr specs))))
- `(defvar ,symbol ',image ,doc)))
+ image))
+
+
+;;;###autoload
+(defmacro defimage (symbol specs &optional doc)
+ "Define SYMBOL as an image.
+
+SPECS is a list of image specifications. DOC is an optional
+documentation string.
+
+Each image specification in SPECS is a property list. The contents of
+a specification are image type dependent. All specifications must at
+least contain the properties `:type TYPE' and either `:file FILE' or
+`:data DATA', where TYPE is a symbol specifying the image type,
+e.g. `xbm', FILE is the file to load the image from, and DATA is a
+string containing the actual image data. The first image
+specification whose TYPE is supported, and FILE exists, is used to
+define SYMBOL.
+
+Example:
+
+ (defimage test-image ((:type xpm :file \"~/test1.xpm\")
+ (:type xbm :file \"~/test1.xbm\")))"
+ `(defvar ,symbol (find-image ',specs) ,doc))
(provide 'image)