]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't hard-code image-dired thumbnail type
authorStefan Kangas <stefan@marxist.se>
Sun, 24 Oct 2021 10:26:39 +0000 (12:26 +0200)
committerStefan Kangas <stefan@marxist.se>
Sun, 24 Oct 2021 10:26:58 +0000 (12:26 +0200)
* lisp/image-dired.el (image-dired-insert-thumbnail): Detect thumbnail
image type instead of hard-coding it.

lisp/image-dired.el

index 863cd0fde2f03544e18fc667dca9a10ee5bca385..19bd97192d7e885218dc7d5b98821cb54aabd379 100644 (file)
@@ -543,11 +543,7 @@ Create the thumbnails directory if it does not exist."
                           (file-attribute-modification-time
                            (file-attributes file))))
       (image-dired-create-thumb file thumb-file))
-    (create-image thumb-file)
-;;     (list 'image :type 'jpeg
-;;           :file thumb-file
-;;       :relief image-dired-thumb-relief :margin image-dired-thumb-margin)
-    ))
+    (create-image thumb-file)))
 
 (defun image-dired-insert-thumbnail (file original-file-name
                                      associated-dired-buffer)
@@ -556,10 +552,7 @@ Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER."
   (let (beg end)
     (setq beg (point))
     (image-dired-insert-image file
-                        ;; TODO: this should depend on the real file type
-                        (if (memq image-dired-thumbnail-storage
-                                  '(standard standard-large))
-                            'png 'jpeg)
+                        (image-type-from-file-header file)
                         image-dired-thumb-relief
                         image-dired-thumb-margin)
     (setq end (point))