diff options
| author | Mark Oteiza | 2016-12-16 10:14:01 -0500 |
|---|---|---|
| committer | Mark Oteiza | 2016-12-16 10:14:01 -0500 |
| commit | 6bf83218314db1c63ce34564edfb994d9431b28a (patch) | |
| tree | 1360ee5de4536bcee0f2ad0461944211475a17d7 | |
| parent | b3cf281174674ced4e167081e6908b2b0ee29deb (diff) | |
| download | emacs-6bf83218314db1c63ce34564edfb994d9431b28a.tar.gz emacs-6bf83218314db1c63ce34564edfb994d9431b28a.zip | |
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.
| -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 | |||
| 1549 | ;; If the user overrides the exist check, we must clear the | 1549 | ;; If the user overrides the exist check, we must clear the |
| 1550 | ;; image cache so that if the user wants to display the | 1550 | ;; image cache so that if the user wants to display the |
| 1551 | ;; thumbnail, it is not fetched from cache. | 1551 | ;; thumbnail, it is not fetched from cache. |
| 1552 | (if arg | 1552 | (when arg |
| 1553 | (clear-image-cache)) | 1553 | (clear-image-cache (expand-file-name thumb-name))) |
| 1554 | (when (or (not (file-exists-p thumb-name)) | 1554 | (when (or (not (file-exists-p thumb-name)) |
| 1555 | arg) | 1555 | arg) |
| 1556 | (when (not (= 0 (image-dired-create-thumb curr-file thumb-name))) | 1556 | (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." | |||
| 1808 | 'image-dired-cmd-rotate-thumbnail-program) | 1808 | 'image-dired-cmd-rotate-thumbnail-program) |
| 1809 | (if (not (image-dired-image-at-point-p)) | 1809 | (if (not (image-dired-image-at-point-p)) |
| 1810 | (message "No thumbnail at point") | 1810 | (message "No thumbnail at point") |
| 1811 | (let ((file (image-dired-thumb-name (image-dired-original-file-name))) | 1811 | (let* ((file (image-dired-thumb-name (image-dired-original-file-name))) |
| 1812 | command) | 1812 | (thumb (expand-file-name file)) |
| 1813 | command) | ||
| 1813 | (setq command (format-spec | 1814 | (setq command (format-spec |
| 1814 | image-dired-cmd-rotate-thumbnail-options | 1815 | image-dired-cmd-rotate-thumbnail-options |
| 1815 | (list | 1816 | (list |
| 1816 | (cons ?p image-dired-cmd-rotate-thumbnail-program) | 1817 | (cons ?p image-dired-cmd-rotate-thumbnail-program) |
| 1817 | (cons ?d degrees) | 1818 | (cons ?d degrees) |
| 1818 | (cons ?t (expand-file-name file))))) | 1819 | (cons ?t thumb)))) |
| 1819 | (call-process shell-file-name nil nil nil shell-command-switch command) | 1820 | (call-process shell-file-name nil nil nil shell-command-switch command) |
| 1820 | ;; Clear the cache to refresh image. I wish I could just refresh | 1821 | (clear-image-cache thumb)))) |
| 1821 | ;; the current file but I do not know how to do that. Yet... | ||
| 1822 | (clear-image-cache)))) | ||
| 1823 | 1822 | ||
| 1824 | (defun image-dired-rotate-thumbnail-left () | 1823 | (defun image-dired-rotate-thumbnail-left () |
| 1825 | "Rotate thumbnail left (counter clockwise) 90 degrees. | 1824 | "Rotate thumbnail left (counter clockwise) 90 degrees. |
| @@ -1842,9 +1841,10 @@ overwritten. This confirmation can be turned off using | |||
| 1842 | (defun image-dired-refresh-thumb () | 1841 | (defun image-dired-refresh-thumb () |
| 1843 | "Force creation of new image for current thumbnail." | 1842 | "Force creation of new image for current thumbnail." |
| 1844 | (interactive) | 1843 | (interactive) |
| 1845 | (let ((file (image-dired-original-file-name))) | 1844 | (let* ((file (image-dired-original-file-name)) |
| 1846 | (clear-image-cache) | 1845 | (thumb (expand-file-name (image-dired-thumb-name file)))) |
| 1847 | (image-dired-create-thumb file (image-dired-thumb-name file)))) | 1846 | (clear-image-cache (expand-file-name thumb)) |
| 1847 | (image-dired-create-thumb file thumb))) | ||
| 1848 | 1848 | ||
| 1849 | (defun image-dired-rotate-original (degrees) | 1849 | (defun image-dired-rotate-original (degrees) |
| 1850 | "Rotate original image DEGREES degrees." | 1850 | "Rotate original image DEGREES degrees." |