From: Glenn Morris Date: Fri, 2 Nov 2012 22:41:35 +0000 (-0400) Subject: * lisp/image.el (image-type-from-file-name): Trivial simplification. X-Git-Tag: emacs-24.3.90~173^2~9^2~185 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=11fef14abb1fdd7424295c3c50d59bf18bb6c4e7;p=emacs.git * lisp/image.el (image-type-from-file-name): Trivial simplification. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 747bbba97c4..a6c9482c5aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-11-02 Glenn Morris + * image.el (image-type-from-file-name): Trivial simplification. + * emacs-lisp/bytecomp.el (byte-compile-eval): Decouple "noruntime" and "cl-functions" warnings. diff --git a/lisp/image.el b/lisp/image.el index aef44fc3701..bd2f5c3a3ca 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)