From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired Date: Sat, 05 Aug 2023 11:27:08 +0200 Message-ID: <87zg35c00j.fsf@ledu-giraud.fr> References: <87ttteq2ku.fsf@ledu-giraud.fr> <83il9uvnj3.fsf@gnu.org> <87pm42psv9.fsf@ledu-giraud.fr> <834jlevd7o.fsf@gnu.org> <87r0oied8u.fsf@ledu-giraud.fr> <83y1iqt56g.fsf@gnu.org> <87msz5evo8.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16946"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65052@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 05 11:28:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qSDaC-0004GL-AE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Aug 2023 11:28:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSDZt-0000Sm-KC; Sat, 05 Aug 2023 05:28:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSDZr-0000R9-5n for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2023 05:28:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSDZq-0005dX-UV for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2023 05:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSDZq-000069-Qb for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2023 05:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Aug 2023 09:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65052 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65052-submit@debbugs.gnu.org id=B65052.1691227636302 (code B ref 65052); Sat, 05 Aug 2023 09:28:02 +0000 Original-Received: (at 65052) by debbugs.gnu.org; 5 Aug 2023 09:27:16 +0000 Original-Received: from localhost ([127.0.0.1]:55661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSDZ5-0008WT-U6 for submit@debbugs.gnu.org; Sat, 05 Aug 2023 05:27:16 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]:36106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSDZ3-0008WD-G2 for 65052@debbugs.gnu.org; Sat, 05 Aug 2023 05:27:15 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=d7d2o36l NCl+cWeyzbpo5X3AKVOp3ROPccmBTzgmW4w=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=PTr/wO8vCbXoER38WY8AbBWOJWZCa9 sEY6DB8ZN8hBj/t6J2jZsZEII6xVdGF8C5hwTaB5C+lemAgI9rvMb5Aw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=d7d2o36lNCl+cWey zbpo5X3AKVOp3ROPccmBTzgmW4w=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=WBhbiX6bmAFbDSD93q92QdglUDgWqgCVAVbmlR 2tYya2XQ3bYntyGLM5sv0q2+twU9gT0f1cDg3IXRQ/zPRb5WmuDsNNKbv3Gdkn1nkHpwIJ OfsvS/b7LtYCDF+2wwgToJ4fLZdH3QieiRTCGhWSfbKwMMywsMomMvhKNFSUnSRckJdGYl OUmB57W+YpL12h+ilUV4P1WiWrOsviVryYJ2IIXvmZQdWYbQOHphNlyTqitMvB5vlWgA/u VH1JW4PDde+5UAozy0p7XaWzXXeCM3ddCIIGVaBuZvZ3z2wPyL/Pv9bbwC49gtfbAN5O0d bXtxQJXsnObuMkWJgrcrQpJg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id e511b406 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 5 Aug 2023 11:27:11 +0200 (CEST) In-Reply-To: <87msz5evo8.fsf@ledu-giraud.fr> (Manuel Giraud's message of "Sat, 05 Aug 2023 10:32:39 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266752 Archived-At: --=-=-= Content-Type: text/plain Manuel Giraud writes: > Eli Zaretskii writes: > > [...] > >> Hmm... okay, but I wonder why not call image-dired-track-original-file >> and image-dired--update-header-line directly from each of these new >> commands, after scroll-up/down, instead of implementing this as a >> macro (which calls another macro). That would have been much simpler >> and easier to follow. Or is there something I'm missing here? > > Yes it would be much simpler. I was trying to "stay in line" with the > current code. I could try to add the scroll-up/down feature and maybe, > in a later patch, try to remove thoses macros. WDYT? Here. The code is more obvious this way and I think we should do the same for other movements. -- Manuel Giraud --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Scroll-up-and-down-in-image-dired.patch >From 4983e589f1e841c6a49a93d166970a18d4359a88 Mon Sep 17 00:00:00 2001 From: Manuel Giraud 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 " " #'image-dired-end-of-buffer " " #'image-dired-move-beginning-of-line " " #'image-dired-move-end-of-line + " " #'image-dired-scroll-up + " " #'image-dired-scroll-down :menu '("Image-Dired" -- 2.40.0 --=-=-=--