diff options
| author | Stefan Kangas | 2022-08-31 05:52:11 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-08-31 05:52:11 +0200 |
| commit | f7a5591707566321e82f6120802a16d86bcca4d7 (patch) | |
| tree | a23121c6d9a59bdd6907a3ce2d94a5e83033307d /lisp/image | |
| parent | 5b857953a7affcfb01c24689c8bd85b072d2d186 (diff) | |
| download | emacs-scratch/image-dired.tar.gz emacs-scratch/image-dired.zip | |
image-dired: Minor cleanupsscratch/image-dired
* lisp/image/image-dired-dired.el
(image-dired-dired-after-readin-hook, image-dired-minor-mode):
Minor doc fixes.
(image-dired-dired-display-image): Don't accept ineffectual prefix
argument.
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point): Use when-let.
* lisp/image/image-dired-util.el
(image-dired-window-width-pixels): Make obsolete in favor of
window-body-width.
* lisp/image/image-dired.el (image-dired-line-up-dynamic)
(image-dired-display-window-width): Don't use above obsolete function.
Diffstat (limited to 'lisp/image')
| -rw-r--r-- | lisp/image/image-dired-dired.el | 13 | ||||
| -rw-r--r-- | lisp/image/image-dired-external.el | 6 | ||||
| -rw-r--r-- | lisp/image/image-dired-util.el | 14 | ||||
| -rw-r--r-- | lisp/image/image-dired.el | 16 |
4 files changed, 24 insertions, 25 deletions
diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el index 4ed861aeeb3..e9b8e426f9a 100644 --- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el | |||
| @@ -81,7 +81,8 @@ previous -ARG, if ARG<0) files." | |||
| 81 | (defun image-dired-dired-after-readin-hook () | 81 | (defun image-dired-dired-after-readin-hook () |
| 82 | "Relocate existing thumbnail overlays in Dired buffer after reverting. | 82 | "Relocate existing thumbnail overlays in Dired buffer after reverting. |
| 83 | Move them to their corresponding files if they still exist. | 83 | Move them to their corresponding files if they still exist. |
| 84 | Otherwise, delete overlays." | 84 | Otherwise, delete overlays. |
| 85 | Used by `image-dired-dired-toggle-marked-thumbs'." | ||
| 85 | (mapc (lambda (overlay) | 86 | (mapc (lambda (overlay) |
| 86 | (when (overlay-get overlay 'put-image) | 87 | (when (overlay-get overlay 'put-image) |
| 87 | (let* ((image-file (overlay-get overlay 'image-file)) | 88 | (let* ((image-file (overlay-get overlay 'image-file)) |
| @@ -289,12 +290,12 @@ With prefix argument ARG, create thumbnails even if they already exist | |||
| 289 | image-dired-external-viewer file))) | 290 | image-dired-external-viewer file))) |
| 290 | 291 | ||
| 291 | ;;;###autoload | 292 | ;;;###autoload |
| 292 | (defun image-dired-dired-display-image (&optional arg) | 293 | (defun image-dired-dired-display-image (&optional _) |
| 293 | "Display current image file. | 294 | "Display current image file. |
| 294 | See documentation for `image-dired-display-image' for more information. | 295 | See documentation for `image-dired-display-image' for more information." |
| 295 | With prefix argument ARG, display image in its original size." | 296 | (declare (advertised-calling-convention () "29.1")) |
| 296 | (interactive "P" dired-mode) | 297 | (interactive nil dired-mode) |
| 297 | (image-dired-display-image (dired-get-filename) arg)) | 298 | (image-dired-display-image (dired-get-filename))) |
| 298 | 299 | ||
| 299 | ;;;###autoload | 300 | ;;;###autoload |
| 300 | (defun image-dired-mark-tagged-files (regexp) | 301 | (defun image-dired-mark-tagged-files (regexp) |
diff --git a/lisp/image/image-dired-external.el b/lisp/image/image-dired-external.el index 6ee07f25c35..093f037d9a1 100644 --- a/lisp/image/image-dired-external.el +++ b/lisp/image/image-dired-external.el | |||
| @@ -142,8 +142,7 @@ Available format specifiers are the same as in | |||
| 142 | :version "26.1" | 142 | :version "26.1" |
| 143 | :type '(repeat (string :tag "Argument"))) | 143 | :type '(repeat (string :tag "Argument"))) |
| 144 | 144 | ||
| 145 | (defcustom image-dired-cmd-rotate-original-program | 145 | (defcustom image-dired-cmd-rotate-original-program "jpegtran" |
| 146 | "jpegtran" | ||
| 147 | "Executable used to rotate original image. | 146 | "Executable used to rotate original image. |
| 148 | Used together with `image-dired-cmd-rotate-original-options'." | 147 | Used together with `image-dired-cmd-rotate-original-options'." |
| 149 | :type 'file) | 148 | :type 'file) |
| @@ -171,8 +170,7 @@ original image file name and %t which is replaced by | |||
| 171 | Used together with `image-dired-cmd-write-exif-data-options'." | 170 | Used together with `image-dired-cmd-write-exif-data-options'." |
| 172 | :type 'file) | 171 | :type 'file) |
| 173 | 172 | ||
| 174 | (defcustom image-dired-cmd-write-exif-data-options | 173 | (defcustom image-dired-cmd-write-exif-data-options '("-%t=%v" "%f") |
| 175 | '("-%t=%v" "%f") | ||
| 176 | "Arguments of command used to write EXIF data. | 174 | "Arguments of command used to write EXIF data. |
| 177 | Used with `image-dired-cmd-write-exif-data-program'. | 175 | Used with `image-dired-cmd-write-exif-data-program'. |
| 178 | Available format specifiers are: %f which is replaced by | 176 | Available format specifiers are: %f which is replaced by |
diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index 1318b25a12a..cb1632e1be4 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el | |||
| @@ -104,9 +104,8 @@ See also `image-dired-thumbnail-storage'." | |||
| 104 | 104 | ||
| 105 | (defun image-dired-file-name-at-point () | 105 | (defun image-dired-file-name-at-point () |
| 106 | "Get abbreviated file name for thumbnail or display image at point." | 106 | "Get abbreviated file name for thumbnail or display image at point." |
| 107 | (let ((f (image-dired-original-file-name))) | 107 | (when-let ((f (image-dired-original-file-name))) |
| 108 | (when f | 108 | (abbreviate-file-name f))) |
| 109 | (abbreviate-file-name f)))) | ||
| 110 | 109 | ||
| 111 | (defun image-dired-associated-dired-buffer () | 110 | (defun image-dired-associated-dired-buffer () |
| 112 | "Get associated Dired buffer at point." | 111 | "Get associated Dired buffer at point." |
| @@ -119,10 +118,6 @@ See also `image-dired-thumbnail-storage'." | |||
| 119 | (equal (window-buffer window) buf)) | 118 | (equal (window-buffer window) buf)) |
| 120 | nil t)) | 119 | nil t)) |
| 121 | 120 | ||
| 122 | (defun image-dired-window-width-pixels (window) | ||
| 123 | "Calculate WINDOW width in pixels." | ||
| 124 | (* (window-width window) (frame-char-width))) | ||
| 125 | |||
| 126 | (defun image-dired-display-window () | 121 | (defun image-dired-display-window () |
| 127 | "Return window where `image-dired-display-image-buffer' is visible." | 122 | "Return window where `image-dired-display-image-buffer' is visible." |
| 128 | (get-window-with-predicate | 123 | (get-window-with-predicate |
| @@ -152,6 +147,11 @@ See also `image-dired-thumbnail-storage'." | |||
| 152 | "Return non-nil if there is an `image-dired' thumbnail at point." | 147 | "Return non-nil if there is an `image-dired' thumbnail at point." |
| 153 | (get-text-property (point) 'image-dired-thumbnail)) | 148 | (get-text-property (point) 'image-dired-thumbnail)) |
| 154 | 149 | ||
| 150 | (defun image-dired-window-width-pixels (window) | ||
| 151 | "Calculate WINDOW width in pixels." | ||
| 152 | (declare (obsolete window-body-width "29.1")) | ||
| 153 | (* (window-width window) (frame-char-width))) | ||
| 154 | |||
| 155 | (provide 'image-dired-util) | 155 | (provide 'image-dired-util) |
| 156 | 156 | ||
| 157 | ;; Local Variables: | 157 | ;; Local Variables: |
diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index a58eaa4775d..1444dfb2cf4 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el | |||
| @@ -1056,13 +1056,13 @@ See also `image-dired-line-up-dynamic'." | |||
| 1056 | Calculate how many thumbnails fit." | 1056 | Calculate how many thumbnails fit." |
| 1057 | (interactive nil image-dired-thumbnail-mode) | 1057 | (interactive nil image-dired-thumbnail-mode) |
| 1058 | (let* ((char-width (frame-char-width)) | 1058 | (let* ((char-width (frame-char-width)) |
| 1059 | (width (image-dired-window-width-pixels (image-dired-thumbnail-window))) | 1059 | (width (window-body-width (image-dired-thumbnail-window) t)) |
| 1060 | (image-dired-thumbs-per-row | 1060 | (image-dired-thumbs-per-row |
| 1061 | (/ width | 1061 | (/ width |
| 1062 | (+ (* 2 image-dired-thumb-relief) | 1062 | (+ (* 2 image-dired-thumb-relief) |
| 1063 | (* 2 image-dired-thumb-margin) | 1063 | (* 2 image-dired-thumb-margin) |
| 1064 | (image-dired-thumb-size 'width) | 1064 | (image-dired-thumb-size 'width) |
| 1065 | char-width)))) | 1065 | char-width)))) |
| 1066 | (image-dired-line-up))) | 1066 | (image-dired-line-up))) |
| 1067 | 1067 | ||
| 1068 | (defun image-dired-line-up-interactive () | 1068 | (defun image-dired-line-up-interactive () |
| @@ -1368,7 +1368,7 @@ completely fit)." | |||
| 1368 | (defun image-dired-display-window-width (window) | 1368 | (defun image-dired-display-window-width (window) |
| 1369 | "Return width, in pixels, of WINDOW." | 1369 | "Return width, in pixels, of WINDOW." |
| 1370 | (declare (obsolete nil "29.1")) | 1370 | (declare (obsolete nil "29.1")) |
| 1371 | (- (image-dired-window-width-pixels window) | 1371 | (- (window-body-width window t) |
| 1372 | image-dired-display-window-width-correction)) | 1372 | image-dired-display-window-width-correction)) |
| 1373 | 1373 | ||
| 1374 | (defun image-dired-display-window-height (window) | 1374 | (defun image-dired-display-window-height (window) |