diff options
| author | William M. Perry | 1999-12-31 15:54:44 +0000 |
|---|---|---|
| committer | William M. Perry | 1999-12-31 15:54:44 +0000 |
| commit | bc28370787eb85b1df6dfa89b015750b60fb69d5 (patch) | |
| tree | 7b6d98c301025ee102d457def8728472d68be6a0 | |
| parent | 63448a4dc2fbe334435eeef39fa03e3b350a866a (diff) | |
| download | emacs-bc28370787eb85b1df6dfa89b015750b60fb69d5.tar.gz emacs-bc28370787eb85b1df6dfa89b015750b60fb69d5.zip | |
* image.el (defimage): Images with the :data keyword should be considered valid as well.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/image.el | 26 |
2 files changed, 21 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index db484cfa2b3..226376bdba1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 1999-12-31 William M. Perry <wmperry@aventail.com> | ||
| 2 | |||
| 3 | * image.el (defimage): Images with the `:data' keyword should be | ||
| 4 | considered valid as well. | ||
| 5 | |||
| 1 | 1999-12-31 Richard M. Stallman <rms@caffeine.ai.mit.edu> | 6 | 1999-12-31 Richard M. Stallman <rms@caffeine.ai.mit.edu> |
| 2 | 7 | ||
| 3 | * dired.el (dired-get-filename): Don't call file-name-absolute-p | 8 | * dired.el (dired-get-filename): Don't call file-name-absolute-p |
diff --git a/lisp/image.el b/lisp/image.el index 1e4aea4d709..9b28d4f2eb2 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -72,7 +72,7 @@ Image types are symbols like `xbm' or `jpeg'." | |||
| 72 | "Create an image which will be loaded from FILE. | 72 | "Create an image which will be loaded from FILE. |
| 73 | Optional TYPE is a symbol describing the image type. If TYPE is omitted | 73 | Optional TYPE is a symbol describing the image type. If TYPE is omitted |
| 74 | or nil, try to determine the image file type from its first few bytes. | 74 | or nil, try to determine the image file type from its first few bytes. |
| 75 | If that doesn't work, use FILE's extension.as image type. | 75 | If that doesn't work, use FILE's extension as image type. |
| 76 | Optional PROPS are additional image attributes to assign to the image, | 76 | Optional PROPS are additional image attributes to assign to the image, |
| 77 | like, e.g. `:heuristic-mask t'. | 77 | like, e.g. `:heuristic-mask t'. |
| 78 | Value is the image created, or nil if images of type TYPE are not supported." | 78 | Value is the image created, or nil if images of type TYPE are not supported." |
| @@ -164,10 +164,12 @@ documentation string. | |||
| 164 | 164 | ||
| 165 | Each image specification in SPECS is a property list. The contents of | 165 | Each image specification in SPECS is a property list. The contents of |
| 166 | a specification are image type dependent. All specifications must at | 166 | a specification are image type dependent. All specifications must at |
| 167 | least contain the properties `:type TYPE' and `:file FILE', where TYPE | 167 | least contain the properties `:type TYPE' and either `:file FILE' or |
| 168 | is a symbol specifying the image type, e.g. `xbm', and FILE is the | 168 | `:data DATA', where TYPE is a symbol specifying the image type, |
| 169 | file to load the image from. The first image specification whose TYPE | 169 | e.g. `xbm', FILE is the file to load the image from, and DATA is a |
| 170 | is supported, and FILE exists, is used to define SYMBOL. | 170 | string containing the actual image data. The first image |
| 171 | specification whose TYPE is supported, and FILE exists, is used to | ||
| 172 | define SYMBOL. | ||
| 171 | 173 | ||
| 172 | Example: | 174 | Example: |
| 173 | 175 | ||
| @@ -176,13 +178,17 @@ Example: | |||
| 176 | (let (image) | 178 | (let (image) |
| 177 | (while (and specs (null image)) | 179 | (while (and specs (null image)) |
| 178 | (let* ((spec (car specs)) | 180 | (let* ((spec (car specs)) |
| 181 | (data (plist-get spec :data)) | ||
| 179 | (type (plist-get spec :type)) | 182 | (type (plist-get spec :type)) |
| 180 | (file (plist-get spec :file))) | 183 | (file (plist-get spec :file))) |
| 181 | (when (and (image-type-available-p type) (stringp file)) | 184 | (when (and (image-type-available-p type) ; Image type is supported |
| 182 | (setq file (expand-file-name file data-directory)) | 185 | (or data (stringp file))) ; Data or file was specified |
| 183 | (when (file-readable-p file) | 186 | (if data |
| 184 | (setq image (cons 'image (plist-put spec :file file))))) | 187 | (setq image (cons 'image spec)) |
| 185 | (setq specs (cdr specs)))) | 188 | (setq file (expand-file-name file data-directory)) |
| 189 | (when (file-readable-p file) | ||
| 190 | (setq image (cons 'image (plist-put spec :file file))))) | ||
| 191 | (setq specs (cdr specs))))) | ||
| 186 | `(defvar ,symbol ',image ,doc))) | 192 | `(defvar ,symbol ',image ,doc))) |
| 187 | 193 | ||
| 188 | 194 | ||