Subject: bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired

From: Manuel Giraud <[email-masked]>
Date: Sat, 05 Aug 2023 19:39:45 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Manuel Giraud <[email-masked]>
>> Cc: [email-masked]
>> Date: Sat, 05 Aug 2023 15:27:14 +0200
>> 
>> >> Maybe I should do that into another bug report?
>> >
>> > It's up to you.
>> 
>> Ok then I'd prefer having this macros cleanage into another bug report.
>> Do you think you could apply the last one to master and close this bug
>> report?  I'll start from here.  Thanks.
>
> Which is "the last one" that you want me to install?

Sorry.  This is the one attached with this mail.
>From 4983e589f1e841c6a49a93d166970a18d4359a88 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Thu, 9 Mar 2023 14:35:31 +0100
Subject: [PATCH] Scroll up and down in image-dired

* 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.
---
 lisp/image/image-dired.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 33beb5b3e49..4e213587e7a 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -770,6 +770,24 @@ image-dired-move-end-of-line
   (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))
+
 
 ;;; Header line
 
@@ -980,6 +998,8 @@ image-dired-thumbnail-mode-map
   "<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"
-- 
2.40.0

-- 
Manuel Giraud