aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-04-26 17:34:09 +0000
committerGerd Moellmann2000-04-26 17:34:09 +0000
commit349c034d9e90a341e81a7c01df5e3af1495db093 (patch)
tree33e838451f9125acbfc5e5b90d961495132d9ff5
parentd7d47268cc8f5df63e1d68fedce83f91127d8074 (diff)
downloademacs-349c034d9e90a341e81a7c01df5e3af1495db093.tar.gz
emacs-349c034d9e90a341e81a7c01df5e3af1495db093.zip
(find-image): New function.
(defimage): Rewritten to find image at load time.
-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."
176 176
177 177
178;;;###autoload 178;;;###autoload
179(defmacro defimage (symbol specs &optional doc) 179(defun find-image (specs)
180 "Define SYMBOL as an image. 180 "Find an image, choosing one of a list of image specifications.
181 181
182SPECS is a list of image specifications. DOC is an optional 182SPECS is a list of image specifications. DOC is an optional
183documentation string. 183documentation string.
@@ -189,12 +189,7 @@ least contain the properties `:type TYPE' and either `:file FILE' or
189e.g. `xbm', FILE is the file to load the image from, and DATA is a 189e.g. `xbm', FILE is the file to load the image from, and DATA is a
190string containing the actual image data. The first image 190string containing the actual image data. The first image
191specification whose TYPE is supported, and FILE exists, is used to 191specification whose TYPE is supported, and FILE exists, is used to
192define SYMBOL. 192define SYMBOL."
193
194Example:
195
196 (defimage test-image ((:type xpm :file \"~/test1.xpm\")
197 (:type xbm :file \"~/test1.xbm\")))"
198 (let (image) 193 (let (image)
199 (while (and specs (null image)) 194 (while (and specs (null image))
200 (let* ((spec (car specs)) 195 (let* ((spec (car specs))
@@ -216,7 +211,30 @@ Example:
216 ((not (null data)) 211 ((not (null data))
217 (setq image (cons 'image spec))))) 212 (setq image (cons 'image spec)))))
218 (setq specs (cdr specs)))) 213 (setq specs (cdr specs))))
219 `(defvar ,symbol ',image ,doc))) 214 image))
215
216
217;;;###autoload
218(defmacro defimage (symbol specs &optional doc)
219 "Define SYMBOL as an image.
220
221SPECS is a list of image specifications. DOC is an optional
222documentation string.
223
224Each image specification in SPECS is a property list. The contents of
225a specification are image type dependent. All specifications must at
226least contain the properties `:type TYPE' and either `:file FILE' or
227`:data DATA', where TYPE is a symbol specifying the image type,
228e.g. `xbm', FILE is the file to load the image from, and DATA is a
229string containing the actual image data. The first image
230specification whose TYPE is supported, and FILE exists, is used to
231define SYMBOL.
232
233Example:
234
235 (defimage test-image ((:type xpm :file \"~/test1.xpm\")
236 (:type xbm :file \"~/test1.xbm\")))"
237 `(defvar ,symbol (find-image ',specs) ,doc))
220 238
221 239
222(provide 'image) 240(provide 'image)