From: Stefan Kangas Date: Wed, 27 Oct 2021 01:23:49 +0000 (+0200) Subject: image-dired: Add new commands for beginning/end of buffer X-Git-Tag: emacs-29.0.90~3671^2~399 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ab11a3adf91311e752fae0749113c00a20e6ee4e;p=emacs.git image-dired: Add new commands for beginning/end of buffer * lisp/image-dired.el (image-dired-beginning-of-buffer) (image-dired-end-of-buffer): New commands. (image-dired-thumbnail-mode-map): Bind new beginning of buffer command to '<' and 'M-<', and end of buffer command to '>' and 'M->'. --- diff --git a/lisp/image-dired.el b/lisp/image-dired.el index b54404b0903..cd18ca15654 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1444,6 +1444,28 @@ image." (image-dired-track-original-file)) (image-dired-display-thumb-properties)) +(defun image-dired-beginning-of-buffer () + "Move to the first image in the buffer and display properties." + (interactive nil image-dired-thumbnail-mode) + (goto-char (point-min)) + (while (and (not (image-at-point-p)) + (not (eobp))) + (forward-char 1)) + (when image-dired-track-movement + (image-dired-track-original-file)) + (image-dired-display-thumb-properties)) + +(defun image-dired-end-of-buffer () + "Move to the last image in the buffer and display properties." + (interactive nil image-dired-thumbnail-mode) + (goto-char (point-max)) + (while (and (not (image-at-point-p)) + (not (bobp))) + (forward-char -1)) + (when image-dired-track-movement + (image-dired-track-original-file)) + (image-dired-display-thumb-properties)) + (defun image-dired-format-properties-string (buf file props comment) "Format display properties. BUF is the associated dired buffer, FILE is the original image file @@ -1590,6 +1612,11 @@ You probably want to use this together with (define-key map "\C-p" 'image-dired-previous-line) (define-key map "\C-n" 'image-dired-next-line) + (define-key map "<" 'image-dired-beginning-of-buffer) + (define-key map ">" 'image-dired-end-of-buffer) + (define-key map (kbd "M-<") 'image-dired-beginning-of-buffer) + (define-key map (kbd "M->") 'image-dired-end-of-buffer) + (define-key map "d" 'image-dired-flag-thumb-original-file) (define-key map [delete] 'image-dired-flag-thumb-original-file) (define-key map "m" 'image-dired-mark-thumb-original-file)