diff options
author | Mark Oteiza <mvoteiza@udel.edu> | 2016-12-16 10:14:01 -0500 |
---|---|---|
committer | Mark Oteiza <mvoteiza@udel.edu> | 2016-12-16 10:14:01 -0500 |
commit | 6bf83218314db1c63ce34564edfb994d9431b28a (patch) | |
tree | 1360ee5de4536bcee0f2ad0461944211475a17d7 /lisp/image-dired.el | |
parent | b3cf281174674ced4e167081e6908b2b0ee29deb (diff) | |
download | emacs-6bf83218314db1c63ce34564edfb994d9431b28a.tar.gz |
Be more selective clearing the image cache
* lisp/image-dired.el (image-dired-create-thumbs):
(image-dired-rotate-thumbnail, image-dired-refresh-thumb): Only clear
the current thumbnail file from the image cache.
Diffstat (limited to 'lisp/image-dired.el')
-rw-r--r-- | lisp/image-dired.el | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 2925d0cb64a..96570a503f8 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1549,8 +1549,8 @@ With prefix argument ARG, create thumbnails even if they already exist ;; If the user overrides the exist check, we must clear the ;; image cache so that if the user wants to display the ;; thumbnail, it is not fetched from cache. - (if arg - (clear-image-cache)) + (when arg + (clear-image-cache (expand-file-name thumb-name))) (when (or (not (file-exists-p thumb-name)) arg) (when (not (= 0 (image-dired-create-thumb curr-file thumb-name))) @@ -1808,18 +1808,17 @@ With prefix argument ARG, display image in its original size." 'image-dired-cmd-rotate-thumbnail-program) (if (not (image-dired-image-at-point-p)) (message "No thumbnail at point") - (let ((file (image-dired-thumb-name (image-dired-original-file-name))) - command) + (let* ((file (image-dired-thumb-name (image-dired-original-file-name))) + (thumb (expand-file-name file)) + command) (setq command (format-spec image-dired-cmd-rotate-thumbnail-options (list (cons ?p image-dired-cmd-rotate-thumbnail-program) (cons ?d degrees) - (cons ?t (expand-file-name file))))) + (cons ?t thumb)))) (call-process shell-file-name nil nil nil shell-command-switch command) - ;; Clear the cache to refresh image. I wish I could just refresh - ;; the current file but I do not know how to do that. Yet... - (clear-image-cache)))) + (clear-image-cache thumb)))) (defun image-dired-rotate-thumbnail-left () "Rotate thumbnail left (counter clockwise) 90 degrees. @@ -1842,9 +1841,10 @@ overwritten. This confirmation can be turned off using (defun image-dired-refresh-thumb () "Force creation of new image for current thumbnail." (interactive) - (let ((file (image-dired-original-file-name))) - (clear-image-cache) - (image-dired-create-thumb file (image-dired-thumb-name file)))) + (let* ((file (image-dired-original-file-name)) + (thumb (expand-file-name (image-dired-thumb-name file)))) + (clear-image-cache (expand-file-name thumb)) + (image-dired-create-thumb file thumb))) (defun image-dired-rotate-original (degrees) "Rotate original image DEGREES degrees." |