diff options
| author | Stefan Kangas | 2022-09-17 21:06:30 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-09-18 00:18:22 +0200 |
| commit | 44457b3977539fb8c8c18d804c2dbfb6fbb0794f (patch) | |
| tree | aba372acb4948135686eb3f89973772f9078dc19 | |
| parent | 704cdf5e6c414928cb5b4f0b08d627a96b447e0b (diff) | |
| download | emacs-44457b3977539fb8c8c18d804c2dbfb6fbb0794f.tar.gz emacs-44457b3977539fb8c8c18d804c2dbfb6fbb0794f.zip | |
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.
| -rw-r--r-- | lisp/image/image-dired-util.el | 4 | ||||
| -rw-r--r-- | 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'." | |||
| 81 | ;; MD5 is mandated by the Thumbnail Managing Standard. | 81 | ;; MD5 is mandated by the Thumbnail Managing Standard. |
| 82 | (concat (md5 (concat "file://" (expand-file-name file))) ".png") | 82 | (concat (md5 (concat "file://" (expand-file-name file))) ".png") |
| 83 | (expand-file-name thumbdir (xdg-cache-home))))) | 83 | (expand-file-name thumbdir (xdg-cache-home))))) |
| 84 | ((eq 'use-image-dired-dir image-dired-thumbnail-storage) | 84 | ((or (eq 'image-dired image-dired-thumbnail-storage) |
| 85 | ;; Maintained for backwards compatibility: | ||
| 86 | (eq 'use-image-dired-dir image-dired-thumbnail-storage)) | ||
| 85 | (let* ((f (expand-file-name file)) | 87 | (let* ((f (expand-file-name file)) |
| 86 | (hash | 88 | (hash |
| 87 | (md5 (file-name-as-directory (file-name-directory f))))) | 89 | (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 @@ | |||
| 158 | (defcustom image-dired-dir (locate-user-emacs-file "image-dired/") | 158 | (defcustom image-dired-dir (locate-user-emacs-file "image-dired/") |
| 159 | "Directory where thumbnail images are stored. | 159 | "Directory where thumbnail images are stored. |
| 160 | 160 | ||
| 161 | The value of this option will be ignored if Image-Dired is | 161 | The value of this option is ignored if Image-Dired is customized |
| 162 | customized to use the Thumbnail Managing Standard; they will be | 162 | to use the Thumbnail Managing Standard; they will be saved in |
| 163 | saved in \"$XDG_CACHE_HOME/thumbnails/\" instead. See | 163 | \"$XDG_CACHE_HOME/thumbnails/\" instead. See |
| 164 | `image-dired-thumbnail-storage'." | 164 | `image-dired-thumbnail-storage'." |
| 165 | :type 'directory) | 165 | :type 'directory) |
| 166 | 166 | ||
| 167 | (defcustom image-dired-thumbnail-storage 'use-image-dired-dir | 167 | (defcustom image-dired-thumbnail-storage 'image-dired |
| 168 | "How `image-dired' stores thumbnail files. | 168 | "How `image-dired' stores thumbnail files. |
| 169 | There are two ways that Image-Dired can store and generate | 169 | There are three ways that Image-Dired can store and generate |
| 170 | thumbnails. If you set this variable to one of the two following | 170 | thumbnails: |
| 171 | values, they will be stored in the JPEG format: | 171 | |
| 172 | 172 | 1. According to the \"Thumbnail Managing Standard\", which allows | |
| 173 | - `use-image-dired-dir' means that the thumbnails are stored in a | 173 | sharing of thumbnails across different programs. Thumbnails |
| 174 | central directory. | 174 | will be stored in \"$XDG_CACHE_HOME/thumbnails/\" |
| 175 | 175 | ||
| 176 | - `per-directory' means that each thumbnail is stored in a | 176 | Set this user option to one of the following values: |
| 177 | subdirectory called \".image-dired\" in the same directory | 177 | |
| 178 | where the image file is. | 178 | - `standard' means use thumbnails sized 128x128. |
| 179 | 179 | - `standard-large' means use thumbnails sized 256x256. | |
| 180 | It can also use the \"Thumbnail Managing Standard\", which allows | 180 | - `standard-x-large' means use thumbnails sized 512x512. |
| 181 | sharing of thumbnails across different programs. Thumbnails will | 181 | - `standard-xx-large' means use thumbnails sized 1024x1024. |
| 182 | be stored in \"$XDG_CACHE_HOME/thumbnails/\" instead of in | 182 | |
| 183 | `image-dired-dir'. Thumbnails are saved in the PNG format, and | 183 | 2. In the Image-Dired specific directory indicated by |
| 184 | can be one of the following sizes: | 184 | `image-dired-dir'. |
| 185 | 185 | ||
| 186 | - `standard' means use thumbnails sized 128x128. | 186 | Set this user option to `image-dired' to use it (or |
| 187 | - `standard-large' means use thumbnails sized 256x256. | 187 | `use-image-dired-dir', which means the same thing for |
| 188 | - `standard-x-large' means use thumbnails sized 512x512. | 188 | backwards-compatibility reasons). |
| 189 | - `standard-xx-large' means use thumbnails sized 1024x1024. | 189 | |
| 190 | 3. In a subdirectory \".image-dired\" in the same directory | ||
| 191 | where the image files are. | ||
| 192 | |||
| 193 | Set this user option to `per-directory' to use it. | ||
| 194 | |||
| 195 | To change the default size of thumbnails with (2) and (3) above, | ||
| 196 | customize `image-dired-thumb-size'. | ||
| 197 | |||
| 198 | With Thumbnail Managing Standard, save thumbnails in the PNG | ||
| 199 | format, as mandated by that standard, and otherwise as JPEG. | ||
| 190 | 200 | ||
| 191 | For more information on the Thumbnail Managing Standard, see: | 201 | For more information on the Thumbnail Managing Standard, see: |
| 192 | https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html" | 202 | https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html" |