From c0ea1c8863ea8d9b39a3810435eb4b67e91c2f91 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 24 Oct 2021 18:18:43 +0200 Subject: [PATCH] ; Unbreak creating thumbnails in image-dired * lisp/image-dired.el (image-dired-insert-thumbnail): Unbreak creating thumbnails after my previous commit. --- lisp/image-dired.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 19bd97192d7..6d94624a0a8 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -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 -- 2.39.5