aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2008-01-14 13:20:31 +0000
committerJason Rumney2008-01-14 13:20:31 +0000
commitf6f844ab240a51db881a409c1f8449dffc71b487 (patch)
tree4aae7042ae2349883072327d792e4398c5bbb839
parent2769422068be44ed3b8af00e23beb6ede145d6bb (diff)
downloademacs-f6f844ab240a51db881a409c1f8449dffc71b487.tar.gz
emacs-f6f844ab240a51db881a409c1f8449dffc71b487.zip
(image-type): Use image-type-from-file-name (from trunk
2007-05-21 Chong Yidong <cyd@stupidchicken.com>).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/image.el22
2 files changed, 12 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5f19204e0b5..86a9c4dc2ec 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-01-14 Jason Rumney <jasonr@gnu.org>
2
3 * image.el (image-type): Use image-type-from-file-name (from trunk
4 2007-05-21 Chong Yidong <cyd@stupidchicken.com>).
5
12008-01-12 Glenn Morris <rgm@gnu.org> 62008-01-12 Glenn Morris <rgm@gnu.org>
2 7
3 * woman.el (woman-parse-numeric-arg): Change handling of `==': 8 * woman.el (woman-parse-numeric-arg): Change handling of `==':
diff --git a/lisp/image.el b/lisp/image.el
index 2deaf0a5ebf..d111f7e82a8 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -313,22 +313,14 @@ use its file extension as image type.
313Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data." 313Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data."
314 (when (and (not data-p) (not (stringp file-or-data))) 314 (when (and (not data-p) (not (stringp file-or-data)))
315 (error "Invalid image file name `%s'" file-or-data)) 315 (error "Invalid image file name `%s'" file-or-data))
316 (cond ((null data-p)
317 ;; FILE-OR-DATA is a file name.
318 (unless (or type
319 (setq type (image-type-from-file-header file-or-data)))
320 (let ((extension (file-name-extension file-or-data)))
321 (unless extension
322 (error "Cannot determine image type"))
323 (setq type (intern extension)))))
324 (t
325 ;; FILE-OR-DATA contains image data.
326 (unless type
327 (setq type (image-type-from-data file-or-data)))))
328 (unless type 316 (unless type
329 (error "Cannot determine image type")) 317 (setq type (if data-p
330 (unless (symbolp type) 318 (image-type-from-data file-or-data)
331 (error "Invalid image type `%s'" type)) 319 (or (image-type-from-file-header file-or-data)
320 (image-type-from-file-name file-or-data))))
321 (or type(error "Cannot determine image type")))
322 (or (memq type (and (boundp 'image-types) image-types))
323 (error "Invalid image type `%s'" type))
332 type) 324 type)
333 325
334 326