From: Manuel Giraud Date: Sun, 13 Aug 2023 12:48:01 +0000 (+0200) Subject: Remove some macros in image-dired (Bug#65403) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f46d6b0b3987ec9e8b99449410ce8301023466bf;p=emacs.git Remove some macros in image-dired (Bug#65403) * 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. --- diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 8e2e4c6f644..83f228b2d59 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -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)