]> git.eshelyaron.com Git - emacs.git/commitdiff
Scroll up and down in image-dired
authorManuel Giraud <manuel@ledu-giraud.fr>
Thu, 9 Mar 2023 13:35:31 +0000 (14:35 +0100)
committerEli Zaretskii <eliz@gnu.org>
Thu, 10 Aug 2023 09:09:56 +0000 (12:09 +0300)
* lisp/image/image-dired.el (image-dired-scroll):
Function to manage scroll in image-dired.
(image-dired-scroll-up, image-dired-scroll-down): Scroll up and down
command in image-dired.
(image-dired-thumbnail-mode-map): Use them.  (Bug#65052)

lisp/image/image-dired.el

index 9a92cae8ad538d88e89bc25205324b9ae4d3706a..8e2e4c6f6444bd29e003a9082e686959fffcca0d 100644 (file)
@@ -770,6 +770,24 @@ On reaching end or beginning of buffer, stop and show a message."
   (interactive nil image-dired-thumbnail-mode)
   (image-dired--movement-command (pos-eol) 'reverse))
 
+(defun image-dired-scroll (&optional down)
+  "Scroll in the thumbnail buffer."
+  (let ((goal-column (current-column)))
+    (if down (scroll-down) (scroll-up))
+    (move-to-column goal-column)
+    (image-dired--movement-ensure-point-pos down)
+    (when image-dired-track-movement
+      (image-dired-track-original-file))
+    (image-dired--update-header-line)))
+
+(defun image-dired-scroll-up ()
+  (interactive nil image-dired-thumbnail-mode)
+  (image-dired-scroll))
+
+(defun image-dired-scroll-down ()
+  (interactive nil image-dired-thumbnail-mode)
+  (image-dired-scroll 'down))
+
 \f
 ;;; Header line
 
@@ -980,6 +998,8 @@ You probably want to use this together with
   "<remap> <end-of-buffer>"          #'image-dired-end-of-buffer
   "<remap> <move-beginning-of-line>" #'image-dired-move-beginning-of-line
   "<remap> <move-end-of-line>"       #'image-dired-move-end-of-line
+  "<remap> <scroll-up-command>"      #'image-dired-scroll-up
+  "<remap> <scroll-down-command>"    #'image-dired-scroll-down
 
   :menu
   '("Image-Dired"