]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "Allow using image-convert to view .bmp images"
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 22 Mar 2022 13:45:19 +0000 (14:45 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 22 Mar 2022 13:45:19 +0000 (14:45 +0100)
This reverts commit ede8ad507d06a336ce8202927f214aecbaf15d6b.

This leads to failures for usages of the function where
Emacs doesn't have support for the formats.

lisp/image.el

index bad8ba7cd719e269d0fb7cea2cd298882627d3f9..7306f4762773a386ce3a1748e8dfa497147d80e8 100644 (file)
@@ -378,16 +378,16 @@ be determined."
 ;;;###autoload
 (defun image-type-from-file-name (file)
   "Determine the type of image file FILE from its name.
-Value is a symbol specifying the image type, or nil if type
-cannot be determined (or if Emacs doesn't have built-in support
-for the image type)."
-  (let ((case-fold-search t)
-        type)
+Value is a symbol specifying the image type, or nil if type cannot
+be determined."
+  (let (type first (case-fold-search t))
     (catch 'found
-      (dolist (elem image-type-file-name-regexps)
-       (when (and (string-match-p (car elem) file)
-                   (image-type-available-p (setq type (cdr elem))))
-         (throw 'found type))))))
+      (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))))))))
 
 (declare-function image-convert-p "image-converter.el"
                   (source &optional image-format))