summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-10-24 18:18:43 +0200
committerStefan Kangas <stefan@marxist.se>2021-10-24 18:21:22 +0200
commitc0ea1c8863ea8d9b39a3810435eb4b67e91c2f91 (patch)
treed216a38d4f096e737fb5a8070a291303791d0356
parent3dd19f2af0830e9bc4fef485ccb4498e54397c06 (diff)
downloademacs-c0ea1c8863ea8d9b39a3810435eb4b67e91c2f91.tar.gz
emacs-c0ea1c8863ea8d9b39a3810435eb4b67e91c2f91.tar.bz2
emacs-c0ea1c8863ea8d9b39a3810435eb4b67e91c2f91.zip
; Unbreak creating thumbnails in image-dired
* lisp/image-dired.el (image-dired-insert-thumbnail): Unbreak creating thumbnails after my previous commit.
-rw-r--r--lisp/image-dired.el17
1 files 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