Mercurial > emacs
changeset 79835:f4af1399e6f6
(image-type): Use image-type-from-file-name (from trunk
2007-05-21 Chong Yidong <cyd@stupidchicken.com>).
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Mon, 14 Jan 2008 13:19:28 +0000 |
parents | 59059317a011 |
children | b25af1b3c086 |
files | lisp/image.el |
diffstat | 1 files changed, 7 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/image.el Sat Jan 12 23:21:43 2008 +0000 +++ b/lisp/image.el Mon Jan 14 13:19:28 2008 +0000 @@ -313,22 +313,14 @@ Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data." (when (and (not data-p) (not (stringp file-or-data))) (error "Invalid image file name `%s'" file-or-data)) - (cond ((null data-p) - ;; FILE-OR-DATA is a file name. - (unless (or type - (setq type (image-type-from-file-header file-or-data))) - (let ((extension (file-name-extension file-or-data))) - (unless extension - (error "Cannot determine image type")) - (setq type (intern extension))))) - (t - ;; FILE-OR-DATA contains image data. - (unless type - (setq type (image-type-from-data file-or-data))))) (unless type - (error "Cannot determine image type")) - (unless (symbolp type) - (error "Invalid image type `%s'" type)) + (setq type (if data-p + (image-type-from-data file-or-data) + (or (image-type-from-file-header file-or-data) + (image-type-from-file-name file-or-data)))) + (or type(error "Cannot determine image type"))) + (or (memq type (and (boundp 'image-types) image-types)) + (error "Invalid image type `%s'" type)) type)