diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2022-09-28 00:41:01 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2022-09-28 12:36:42 +0200 |
commit | 6cffaa3b6daf767808a9d9ae549fc2aea5c5c07e (patch) | |
tree | 6e7eb37733a87b8eabb2ba1b3657b329825ce4ba /lisp/image/image-dired-util.el | |
parent | b5b59d1b8afe1e13f63190b9688ddfd9605f2945 (diff) | |
download | emacs-6cffaa3b6daf767808a9d9ae549fc2aea5c5c07e.tar.gz emacs-6cffaa3b6daf767808a9d9ae549fc2aea5c5c07e.tar.bz2 emacs-6cffaa3b6daf767808a9d9ae549fc2aea5c5c07e.zip |
image-dired: End thumbnail file names with ".jpg"
* lisp/image/image-dired-util.el (image-dired-thumb-name): Always
end thumbnail name in ".jpg" and simplify naming to just use the
SHA-1 hash. (Bug#57961)
* test/lisp/image/image-dired-util-tests.el
(image-dired-thumb-name/image-dired): Adjust test for the above
change.
* etc/NEWS: Announce the above change.
Diffstat (limited to 'lisp/image/image-dired-util.el')
-rw-r--r-- | lisp/image/image-dired-util.el | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index e7d116d90ba..dd746886a43 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -70,37 +70,28 @@ file name of the thumbnail will vary: of the image file's directory name will be added to the filename. See also `image-dired-thumbnail-storage'." - (cond ((memq image-dired-thumbnail-storage - image-dired--thumbnail-standard-sizes) - (let ((thumbdir (cl-case image-dired-thumbnail-storage - (standard "thumbnails/normal") - (standard-large "thumbnails/large") - (standard-x-large "thumbnails/x-large") - (standard-xx-large "thumbnails/xx-large")))) - (expand-file-name - ;; MD5 is mandated by the Thumbnail Managing Standard. - (concat (md5 (concat "file://" (expand-file-name file))) ".png") - (expand-file-name thumbdir (xdg-cache-home))))) - ((or (eq 'image-dired image-dired-thumbnail-storage) - ;; Maintained for backwards compatibility: - (eq 'use-image-dired-dir image-dired-thumbnail-storage)) - (let* ((f (expand-file-name file)) - (hash (md5 (file-name-as-directory (file-name-directory f))))) - (expand-file-name - (format "%s%s.thumb.%s" - (file-name-base f) - (if hash (concat "_" hash) "") - (file-name-extension f)) - (image-dired-dir)))) - ((eq 'per-directory image-dired-thumbnail-storage) - (let ((f (expand-file-name file))) - (expand-file-name - (format "%s.thumb.%s" - (file-name-base f) - (file-name-extension f)) - (expand-file-name - ".image-dired" - (file-name-directory f))))))) + (let ((file (expand-file-name file))) + (cond ((memq image-dired-thumbnail-storage + image-dired--thumbnail-standard-sizes) + (let ((thumbdir (cl-case image-dired-thumbnail-storage + (standard "thumbnails/normal") + (standard-large "thumbnails/large") + (standard-x-large "thumbnails/x-large") + (standard-xx-large "thumbnails/xx-large")))) + (expand-file-name + ;; MD5 is mandated by the Thumbnail Managing Standard. + (concat (md5 (concat "file://" file)) ".png") + (expand-file-name thumbdir (xdg-cache-home))))) + ((or (eq 'image-dired image-dired-thumbnail-storage) + ;; Maintained for backwards compatibility: + (eq 'use-image-dired-dir image-dired-thumbnail-storage)) + (expand-file-name (format "%s.jpg" (sha1 file)) + (image-dired-dir))) + ((eq 'per-directory image-dired-thumbnail-storage) + (expand-file-name (format "%s.thumb.jpg" file) + (expand-file-name + ".image-dired" + (file-name-directory file))))))) (defvar image-dired-thumbnail-buffer "*image-dired*" "Image-Dired's thumbnail buffer.") |