emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ede8ad507d: Allow using image-convert to view .bmp images


From: Lars Ingebrigtsen
Subject: master ede8ad507d: Allow using image-convert to view .bmp images
Date: Mon, 21 Mar 2022 12:19:40 -0400 (EDT)

branch: master
commit ede8ad507d06a336ce8202927f214aecbaf15d6b
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Allow using image-convert to view .bmp images
    
    * lisp/image.el (image-type-from-file-name): Allow Emacs to fall
    back on image-convert to display .bmp images (bug#54492).
---
 lisp/image.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/image.el b/lisp/image.el
index ec4ee06eb1..fd0b5b6783 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -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."
-  (let (type first (case-fold-search t))
+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)
     (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))))))))
+      (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))))))
 
 (declare-function image-convert-p "image-converter.el"
                   (source &optional image-format))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]