From 44457b3977539fb8c8c18d804c2dbfb6fbb0794f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 17 Sep 2022 21:06:30 +0200 Subject: [PATCH] Simplify image-dired-thumbnail-storage customization * lisp/image/image-dired.el (image-dired-dir): Improve docstring. (image-dired-thumbnail-storage): Change default to `image-dired', maintain `use-image-dired-dir' for backwards compatibility. * lisp/image/image-dired-util.el (image-dired-thumb-name): Handle above new default value. --- lisp/image/image-dired-util.el | 4 ++- lisp/image/image-dired.el | 60 ++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index cbe040128e8..dcf0b22cfe2 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -81,7 +81,9 @@ See also `image-dired-thumbnail-storage'." ;; MD5 is mandated by the Thumbnail Managing Standard. (concat (md5 (concat "file://" (expand-file-name file))) ".png") (expand-file-name thumbdir (xdg-cache-home))))) - ((eq 'use-image-dired-dir image-dired-thumbnail-storage) + ((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))))) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 4dee951eb37..3bfb388db3c 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -158,35 +158,45 @@ (defcustom image-dired-dir (locate-user-emacs-file "image-dired/") "Directory where thumbnail images are stored. -The value of this option will be ignored if Image-Dired is -customized to use the Thumbnail Managing Standard; they will be -saved in \"$XDG_CACHE_HOME/thumbnails/\" instead. See +The value of this option is ignored if Image-Dired is customized +to use the Thumbnail Managing Standard; they will be saved in +\"$XDG_CACHE_HOME/thumbnails/\" instead. See `image-dired-thumbnail-storage'." :type 'directory) -(defcustom image-dired-thumbnail-storage 'use-image-dired-dir +(defcustom image-dired-thumbnail-storage 'image-dired "How `image-dired' stores thumbnail files. -There are two ways that Image-Dired can store and generate -thumbnails. If you set this variable to one of the two following -values, they will be stored in the JPEG format: - -- `use-image-dired-dir' means that the thumbnails are stored in a - central directory. - -- `per-directory' means that each thumbnail is stored in a - subdirectory called \".image-dired\" in the same directory - where the image file is. - -It can also use the \"Thumbnail Managing Standard\", which allows -sharing of thumbnails across different programs. Thumbnails will -be stored in \"$XDG_CACHE_HOME/thumbnails/\" instead of in -`image-dired-dir'. Thumbnails are saved in the PNG format, and -can be one of the following sizes: - -- `standard' means use thumbnails sized 128x128. -- `standard-large' means use thumbnails sized 256x256. -- `standard-x-large' means use thumbnails sized 512x512. -- `standard-xx-large' means use thumbnails sized 1024x1024. +There are three ways that Image-Dired can store and generate +thumbnails: + + 1. According to the \"Thumbnail Managing Standard\", which allows + sharing of thumbnails across different programs. Thumbnails + will be stored in \"$XDG_CACHE_HOME/thumbnails/\" + + Set this user option to one of the following values: + + - `standard' means use thumbnails sized 128x128. + - `standard-large' means use thumbnails sized 256x256. + - `standard-x-large' means use thumbnails sized 512x512. + - `standard-xx-large' means use thumbnails sized 1024x1024. + + 2. In the Image-Dired specific directory indicated by + `image-dired-dir'. + + Set this user option to `image-dired' to use it (or + `use-image-dired-dir', which means the same thing for + backwards-compatibility reasons). + + 3. In a subdirectory \".image-dired\" in the same directory + where the image files are. + + Set this user option to `per-directory' to use it. + +To change the default size of thumbnails with (2) and (3) above, +customize `image-dired-thumb-size'. + +With Thumbnail Managing Standard, save thumbnails in the PNG +format, as mandated by that standard, and otherwise as JPEG. For more information on the Thumbnail Managing Standard, see: https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html" -- 2.39.2