X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d8fb8cce84b923a3289b69549e30958710ac3ebb..0877d0dc24ee792b9b14592869ea1aa0934aee58:/lisp/image.el diff --git a/lisp/image.el b/lisp/image.el index 9be1d6a163..73b25f6da6 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -309,16 +309,13 @@ be determined." Value is a symbol specifying the image type, or nil if type cannot be determined." (let (type first) - (or - (catch 'found - (dolist (elem image-type-file-name-regexps) - (when (string-match-p (car elem) file) - (setq type (cdr elem)) - (or first (setq first type)) - (if (image-type-available-p type) - (throw 'found type))))) - ;; If nothing seems to be supported, return the first type that matched. - first))) + (catch 'found + (dolist (elem image-type-file-name-regexps first) + (when (string-match-p (car elem) file) + (if (image-type-available-p (setq type (cdr elem))) + (throw 'found type) + ;; If nothing seems to be supported, return first type that matched. + (or first (setq first type)))))))) ;;;###autoload (defun image-type (source &optional type data-p)