]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove some macros in image-dired (Bug#65403)
authorManuel Giraud <manuel@ledu-giraud.fr>
Sun, 13 Aug 2023 12:48:01 +0000 (14:48 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Wed, 23 Aug 2023 21:35:31 +0000 (23:35 +0200)
* lisp/image/image-dired.el (image-dired--movement-command)
(image-dired--movement-command-line): Change macros to functions.
(image-dired--update-after-move): New function for book-keeping
after a move in image-dired.
(image-dired-scroll): Use it.

lisp/image/image-dired.el

index 8e2e4c6f6444bd29e003a9082e686959fffcca0d..83f228b2d590bff63120e71361893d38cd25634e 100644 (file)
@@ -724,21 +724,22 @@ On reaching end or beginning of buffer, stop and show a message."
               (not (if reverse (bobp) (eobp))))
     (forward-char (if reverse -1 1))))
 
-(defmacro image-dired--movement-command (to &optional reverse)
-  `(progn
-     (goto-char ,to)
-     (image-dired--movement-ensure-point-pos ,reverse)
-     (when image-dired-track-movement
-       (image-dired-track-original-file))
-     (image-dired--update-header-line)))
-
-(defmacro image-dired--movement-command-line (&optional reverse)
-  `(image-dired--movement-command
-     (let ((goal-column (current-column)))
-       (forward-line ,(if reverse -1 1))
-       (move-to-column goal-column)
-       (point))
-     ,reverse))
+(defun image-dired--update-after-move (reverse)
+  "Book-keeping after move."
+  (image-dired--movement-ensure-point-pos reverse)
+  (when image-dired-track-movement
+    (image-dired-track-original-file))
+  (image-dired--update-header-line))
+
+(defun image-dired--movement-command (to &optional reverse)
+  (goto-char to)
+  (image-dired--update-after-move reverse))
+
+(defun image-dired--movement-command-line (&optional reverse)
+  (let ((goal-column (current-column)))
+    (forward-line (if reverse -1 1))
+    (move-to-column goal-column)
+    (image-dired--update-after-move reverse)))
 
 (defun image-dired-next-line ()
   "Move to next line in the thumbnail buffer."
@@ -775,10 +776,7 @@ On reaching end or beginning of buffer, stop and show a message."
   (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)))
+    (image-dired--update-after-move down)))
 
 (defun image-dired-scroll-up ()
   (interactive nil image-dired-thumbnail-mode)