]> git.eshelyaron.com Git - emacs.git/commitdiff
; Unbreak creating thumbnails in image-dired
authorStefan Kangas <stefan@marxist.se>
Sun, 24 Oct 2021 16:18:43 +0000 (18:18 +0200)
committerStefan Kangas <stefan@marxist.se>
Sun, 24 Oct 2021 16:21:22 +0000 (18:21 +0200)
* lisp/image-dired.el (image-dired-insert-thumbnail): Unbreak
creating thumbnails after my previous commit.

lisp/image-dired.el

index 19bd97192d7e885218dc7d5b98821cb54aabd379..6d94624a0a87be30ed6693930d144eb9c3f7e82c 100644 (file)
@@ -551,10 +551,19 @@ Create the thumbnails directory if it does not exist."
 Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER."
   (let (beg end)
     (setq beg (point))
-    (image-dired-insert-image file
-                        (image-type-from-file-header file)
-                        image-dired-thumb-relief
-                        image-dired-thumb-margin)
+    (image-dired-insert-image
+     file
+     ;; Thumbnails are created asynchronously, so we might not yet
+     ;; have a file.  But if it exists, it might have been cached from
+     ;; before and we should use it instead of our current settings.
+     (or (and (file-exists-p file)
+              (image-type-from-file-header file))
+         (and (memq image-dired-thumbnail-storage
+                    '(standard standard-large))
+              'png)
+         'jpeg)
+     image-dired-thumb-relief
+     image-dired-thumb-margin)
     (setq end (point))
     (add-text-properties
      beg end