unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 65052@debbugs.gnu.org
Subject: bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
Date: Fri, 04 Aug 2023 22:58:25 +0200	[thread overview]
Message-ID: <87r0oied8u.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <834jlevd7o.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Aug 2023 22:07:07 +0300")

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

[...]

> OK, but then this part:
>
>> +  ;; "one line" dance to update tracking and header
>> +  (image-dired-next-line)
>> +  (image-dired-previous-line))
>
> looks like a kludge.  Can't we have a cleaner code for updating the
> header data?  If image-dired-previous/next-line can update the data,
> why cannot the scroll commands do the same without calling the
> line-movement commands?

You're right.  Here is a cleaner version inspired by
`image-dired--movement-command-line'.
-- 
Manuel Giraud

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Scroll-up-and-down-in-image-dired.patch --]
[-- Type: text/x-patch, Size: 2178 bytes --]

From 9395c814d5664f5d31490ee63de43fa3478b7143 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
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--movement-command-scroll):
Macro 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 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 33beb5b3e49..067134fd331 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -740,6 +740,16 @@ image-dired--movement-command-line
        (point))
      ,reverse))
 
+(defmacro image-dired--movement-command-scroll (&optional reverse)
+  `(image-dired--movement-command
+     (let ((goal-column (current-column)))
+       ,(if reverse
+            '(scroll-down)
+          '(scroll-up))
+       (move-to-column goal-column)
+       (point))
+     ,reverse))
+
 (defun image-dired-next-line ()
   "Move to next line in the thumbnail buffer."
   (interactive nil image-dired-thumbnail-mode)
@@ -770,6 +780,16 @@ image-dired-move-end-of-line
   (interactive nil image-dired-thumbnail-mode)
   (image-dired--movement-command (pos-eol) 'reverse))
 
+(defun image-dired-scroll-up ()
+  "Scroll up the in thumbnail buffer."
+  (interactive nil image-dired-thumbnail-mode)
+  (image-dired--movement-command-scroll))
+
+(defun image-dired-scroll-down ()
+  "Scroll down the in thumbnail buffer."
+  (interactive nil image-dired-thumbnail-mode)
+  (image-dired--movement-command-scroll 'reverse))
+
 \f
 ;;; Header line
 
@@ -980,6 +1000,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


  reply	other threads:[~2023-08-04 20:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 14:55 bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-04 15:24 ` Eli Zaretskii
2023-08-04 18:25   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-04 19:07     ` Eli Zaretskii
2023-08-04 20:58       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-08-05  5:43         ` Eli Zaretskii
2023-08-05  8:32           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-05  9:27             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-05 10:02               ` Eli Zaretskii
2023-08-05 12:58                 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-05 13:12                   ` Eli Zaretskii
2023-08-05 13:27                     ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-05 15:28                       ` Eli Zaretskii
2023-08-05 17:39                         ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-10  9:11                           ` Eli Zaretskii
2023-08-12  8:56                             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12  8:59                               ` Eli Zaretskii
2023-08-05  9:29             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0oied8u.fsf@ledu-giraud.fr \
    --to=bug-gnu-emacs@gnu.org \
    --cc=65052@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).