unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
@ 2023-08-04 14:55 Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-04 15:24 ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-04 14:55 UTC (permalink / raw)
  To: 65052

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


Hi,

Here is a patch that updates header tracking in image-dired when
scrolling up or down.

[-- 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: 1741 bytes --]

From 48910a1c0f97387edafa8616537ff1538dca65f8 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-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 | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 33beb5b3e49..b514730d0d9 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -770,6 +770,22 @@ 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)
+  (scroll-up)
+  ;; "one line" dance to update tracking and header
+  (image-dired-next-line)
+  (image-dired-previous-line))
+
+(defun image-dired-scroll-down ()
+  "Scroll down the in thumbnail buffer."
+  (interactive nil image-dired-thumbnail-mode)
+  (scroll-down)
+  ;; "one line" dance to update tracking and header
+  (image-dired-previous-line)
+  (image-dired-next-line))
+
 \f
 ;;; Header line
 
@@ -980,6 +996,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


[-- Attachment #3: Type: text/plain, Size: 8047 bytes --]



In GNU Emacs 30.0.50 (build 2, x86_64-unknown-openbsd7.3, cairo version
 1.17.8) of 2023-08-04 built on computer
Repository revision: 60e5f212182ca2f41f89a4315075e38433bc8ac0
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101006
System Description: OpenBSD computer 7.3 GENERIC.MP#1125 amd64

Configured using:
 'configure --prefix=/home/manuel/emacs --bindir=/home/manuel/bin
 --with-x-toolkit=no --with-toolkit-scroll-bars=no --without-sound
 --without-compress-install CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBXML2 MODULES NOTIFY KQUEUE OLDXMENU PDUMPER PNG RSVG
SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  paredit-mode: t
  display-time-mode: t
  display-battery-mode: t
  server-mode: t
  override-global-mode: t
  repeat-mode: t
  desktop-save-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/manuel/.emacs.d/elpa/ef-themes-1.2.0/theme-loaddefs hides /home/manuel/emacs/share/emacs/30.0.50/lisp/theme-loaddefs

Features:
(shadow misearch multi-isearch sort gnus-cite mail-extr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
gnus-async gnus-bcklg gnus-ml gnus-topic mm-archive url-cache qp utf-7
imap rfc2104 nndoc nndraft nnmh network-stream nnfolder nnml gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache nnrss emacsbug
magit-patch magit-extras face-remap magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func magit-diff git-commit
log-edit add-log magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor magit-mode transient magit-git
magit-section magit-utils dash ibuf-ext ibuffer ibuffer-loaddefs
image-file image-converter image-dired image-dired-tags
image-dired-external image-dired-util org-agenda mule-util on-screen
css-mode sgml-mode facemenu imenu vc org-indent pascal vc-hg conf-mode
view reveal texinfo texinfo-loaddefs smerge-mode diff emacs-news-mode
oc-basic org-element org-persist org-id avl-tree ol-eww eww url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect ol-docview
doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m
ol-doi org-link-doi gnus-icalendar org-capture org-refile org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities ob-emacs-lisp
ob-core ob-eval org-cycle org-table ol org-fold org-fold-core org-keys
oc org-loaddefs org-version org-compat org-macs whitespace vc-cvs vc-rcs
log-view pcvs-util make-mode sh-script smie treesit executable vc-git
diff-mode vc-dispatcher vc-svn bug-reference paredit gnus-dired time
battery cus-load exwm-randr xcb-randr exwm-config ido exwm exwm-input
xcb-keysyms xcb-xkb exwm-manage exwm-floating xcb-cursor xcb-render
exwm-layout exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb xcb-xproto
xcb-types xcb-debug server modus-operandi-theme modus-themes zone
speed-type url-http url-auth url-gw nsm compat ytdious mingus libmpdee
reporter edebug debug backtrace detached-init detached autorevert
filenotify transmission color calc-bin calc-ext calc calc-loaddefs rect
calc-macs supercite regi ebdb-message ebdb-gnus gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums gmm-utils mailheader gnus-win ebdb-mua
ebdb-com crm ebdb-format ebdb mailabbrev eieio-opt speedbar ezimage
dframe find-func eieio-base pcase timezone icalendar gnus nnheader
gnus-util mail-utils range mm-util mail-prsvr wid-edit visual-basic-mode
cl web-mode derived disp-table erlang-start smart-tabs-mode skeleton
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs slime-asdf grep slime-tramp tramp rx trampver
tramp-integration files-x tramp-message tramp-compat xdg shell pcomplete
parse-time iso8601 time-date format-spec tramp-loaddefs slime-fancy
slime-indentation slime-cl-indent cl-indent slime-trace-dialog
slime-fontifying-fu slime-package-fu slime-references
slime-compiler-notes-tree advice slime-scratch slime-presentations
bridge slime-macrostep macrostep slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-repl slime-parse slime
apropos compile text-property-search etags fileloop generator xref
project arc-mode archive-mode noutline outline icons pp comint ansi-osc
ansi-color ring hyperspec thingatpt slime-autoloads edmacro kmacro
use-package-bind-key bind-key appt diary-lib diary-loaddefs cal-menu
calendar cal-loaddefs dired-x dired-aux dired dired-loaddefs
notifications dbus xml cl-extra help-mode use-package-core repeat
easy-mmode desktop frameset debbugs-autoloads detached-autoloads
ebdb-autoloads ef-themes-autoloads exwm-autoloads hyperbole-autoloads
magit-autoloads git-commit-autoloads finder-inf magit-section-autoloads
md4rd-autoloads dash-autoloads on-screen-autoloads osm-autoloads
paredit-autoloads request-autoloads rust-mode-autoloads s-autoloads
speed-type-autoloads transmission-autoloads tree-mode-autoloads
visual-fill-column-autoloads with-editor-autoloads info compat-autoloads
ytdious-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind kqueue lcms2
dynamic-setting system-font-setting font-render-setting cairo xinput2 x
multi-tty move-toolbar make-network-process emacs)

Memory information:
((conses 16 1057313 730582) (symbols 48 63122 23)
 (strings 32 306271 44990) (string-bytes 1 9931531)
 (vectors 16 189944) (vector-slots 8 3240300 61907)
 (floats 8 662 1451) (intervals 56 27960 3941) (buffers 984 134))

-- 
Manuel Giraud

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-04 15:24 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> Date: Fri, 04 Aug 2023 16:55:45 +0200
> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Here is a patch that updates header tracking in image-dired when
> scrolling up or down.

What is "header tracking"?

More generally, could you please explain what problem are you trying
to solve here?

Thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-04 18:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri, 04 Aug 2023 16:55:45 +0200
>> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> Here is a patch that updates header tracking in image-dired when
>> scrolling up or down.
>
> What is "header tracking"?
>
> More generally, could you please explain what problem are you trying
> to solve here?

Yes, sorry.  When you are using image-dired, there is a header line with
some informations (by default name of the file, its size and so on, see
`image-dired-display-properties-format').  Those informations are
updated when you move from one thumbnail to another (by mean of
C-{f,b,n,p}).  But they are not updated with C-v/M-v.  This patch fixes
this.

(BTW "tracking" is not the correct word here as it means something else
in image-dired)
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-04 19:07 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Fri, 04 Aug 2023 20:25:30 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Date: Fri, 04 Aug 2023 16:55:45 +0200
> >> From:  Manuel Giraud via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >> 
> >> Here is a patch that updates header tracking in image-dired when
> >> scrolling up or down.
> >
> > What is "header tracking"?
> >
> > More generally, could you please explain what problem are you trying
> > to solve here?
> 
> Yes, sorry.  When you are using image-dired, there is a header line with
> some informations (by default name of the file, its size and so on, see
> `image-dired-display-properties-format').  Those informations are
> updated when you move from one thumbnail to another (by mean of
> C-{f,b,n,p}).  But they are not updated with C-v/M-v.  This patch fixes
> this.

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?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  2023-08-05  5:43         ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-04 20:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

[-- 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


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  2023-08-04 20:58       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-05  5:43 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Fri, 04 Aug 2023 22:58:25 +0200
> 
> 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'.

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?

Thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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  9:29             ` Eli Zaretskii
  0 siblings, 2 replies; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-05  8:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

Eli Zaretskii <eliz@gnu.org> 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?
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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  9:29             ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-05  9:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

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

Manuel Giraud <manuel@ledu-giraud.fr> writes:

> Eli Zaretskii <eliz@gnu.org> 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

[-- 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: 1895 bytes --]

From 4983e589f1e841c6a49a93d166970a18d4359a88 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-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))
+
 \f
 ;;; 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


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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  9:29             ` Eli Zaretskii
  1 sibling, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-05  9:29 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Sat, 05 Aug 2023 10:32:39 +0200
> 
> Eli Zaretskii <eliz@gnu.org> 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?

Fine by me, thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-05 10:02 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Sat, 05 Aug 2023 11:27:08 +0200
> 
> >> 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.

Yes, thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-05 12:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Cc: 65052@debbugs.gnu.org
>> Date: Sat, 05 Aug 2023 11:27:08 +0200
>> 
>> >> 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.
>
> Yes, thanks.

Maybe I should do that into another bug report?
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-05 13:12 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Sat, 05 Aug 2023 14:58:16 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Manuel Giraud <manuel@ledu-giraud.fr>
> >> Cc: 65052@debbugs.gnu.org
> >> Date: Sat, 05 Aug 2023 11:27:08 +0200
> >> 
> >> >> 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.
> >
> > Yes, thanks.
> 
> Maybe I should do that into another bug report?

It's up to you.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-05 13:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

Eli Zaretskii <eliz@gnu.org> writes:

[...]

>> >> > 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.
>> >
>> > Yes, thanks.
>> 
>> 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.
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-05 15:28 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> 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?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-05 17:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Cc: 65052@debbugs.gnu.org
>> 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.

[-- 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: 1895 bytes --]

From 4983e589f1e841c6a49a93d166970a18d4359a88 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-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))
+
 \f
 ;;; 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


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-10  9:11 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Sat, 05 Aug 2023 19:39:45 +0200
> 
> > Which is "the last one" that you want me to install?
> 
> Sorry.  This is the one attached with this mail.

Thanks, installed.

Btw, I noticed that the Date of the commit is a few months ago:

   Date: Thu, 9 Mar 2023 14:35:31 +0100

Is that right?  The Git log will show this as AuthorDate of the
commit.

Also, should this bug be closed now?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 1 reply; 18+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-12  8:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65052

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Cc: 65052@debbugs.gnu.org
>> Date: Sat, 05 Aug 2023 19:39:45 +0200
>> 
>> > Which is "the last one" that you want me to install?
>> 
>> Sorry.  This is the one attached with this mail.
>
> Thanks, installed.
>
> Btw, I noticed that the Date of the commit is a few months ago:
>
>    Date: Thu, 9 Mar 2023 14:35:31 +0100
>
> Is that right?  The Git log will show this as AuthorDate of the
> commit.

Hi Eli,

Yes it was the date I worked on it for the first time.  I've just amend
on top of it afterward.  I don't really care and I don't know if this is
important for the Emacs log.

> Also, should this bug be closed now?

Yes you could close it now.  I'll try to work on removing the other
macros usage for movements in another report.  Thanks.
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#65052: 30.0.50; [PATCH] Scroll-{up, down} does not update tracking info in image-dired
  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
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2023-08-12  8:59 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 65052-done

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 65052@debbugs.gnu.org
> Date: Sat, 12 Aug 2023 10:56:07 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Btw, I noticed that the Date of the commit is a few months ago:
> >
> >    Date: Thu, 9 Mar 2023 14:35:31 +0100
> >
> > Is that right?  The Git log will show this as AuthorDate of the
> > commit.
> 
> Hi Eli,
> 
> Yes it was the date I worked on it for the first time.  I've just amend
> on top of it afterward.  I don't really care and I don't know if this is
> important for the Emacs log.

The date will appear in the ChangeLog which we generate from the Git
logs.  I don't know if this matters, either.

> > Also, should this bug be closed now?
> 
> Yes you could close it now.

Done, thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-08-12  8:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).