From: Stefan Kangas Date: Sun, 24 Oct 2021 16:18:43 +0000 (+0200) Subject: ; Unbreak creating thumbnails in image-dired X-Git-Tag: emacs-29.0.90~3671^2~442 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0ea1c8863ea8d9b39a3810435eb4b67e91c2f91;p=emacs.git ; Unbreak creating thumbnails in image-dired * lisp/image-dired.el (image-dired-insert-thumbnail): Unbreak creating thumbnails after my previous commit. --- 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