diff options
| author | Gerd Moellmann | 2000-04-26 17:34:09 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-04-26 17:34:09 +0000 |
| commit | 349c034d9e90a341e81a7c01df5e3af1495db093 (patch) | |
| tree | 33e838451f9125acbfc5e5b90d961495132d9ff5 | |
| parent | d7d47268cc8f5df63e1d68fedce83f91127d8074 (diff) | |
| download | emacs-349c034d9e90a341e81a7c01df5e3af1495db093.tar.gz emacs-349c034d9e90a341e81a7c01df5e3af1495db093.zip | |
(find-image): New function.
(defimage): Rewritten to find image at load time.
| -rw-r--r-- | lisp/image.el | 36 |
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 | ||
| 182 | SPECS is a list of image specifications. DOC is an optional | 182 | SPECS is a list of image specifications. DOC is an optional |
| 183 | documentation string. | 183 | documentation string. |
| @@ -189,12 +189,7 @@ least contain the properties `:type TYPE' and either `:file FILE' or | |||
| 189 | e.g. `xbm', FILE is the file to load the image from, and DATA is a | 189 | e.g. `xbm', FILE is the file to load the image from, and DATA is a |
| 190 | string containing the actual image data. The first image | 190 | string containing the actual image data. The first image |
| 191 | specification whose TYPE is supported, and FILE exists, is used to | 191 | specification whose TYPE is supported, and FILE exists, is used to |
| 192 | define SYMBOL. | 192 | define SYMBOL." |
| 193 | |||
| 194 | Example: | ||
| 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 | |||
| 221 | SPECS is a list of image specifications. DOC is an optional | ||
| 222 | documentation string. | ||
| 223 | |||
| 224 | Each image specification in SPECS is a property list. The contents of | ||
| 225 | a specification are image type dependent. All specifications must at | ||
| 226 | least contain the properties `:type TYPE' and either `:file FILE' or | ||
| 227 | `:data DATA', where TYPE is a symbol specifying the image type, | ||
| 228 | e.g. `xbm', FILE is the file to load the image from, and DATA is a | ||
| 229 | string containing the actual image data. The first image | ||
| 230 | specification whose TYPE is supported, and FILE exists, is used to | ||
| 231 | define SYMBOL. | ||
| 232 | |||
| 233 | Example: | ||
| 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) |