Function: image-dired-forward-image

image-dired-forward-image is an interactive and byte-compiled function defined in image-dired.el.gz.

Signature

(image-dired-forward-image &optional ARG WRAP-AROUND)

Documentation

Move to next image in the thumbnail buffer.

Optional prefix ARG says how many images to move; the default is one image. Negative means move backwards. On reaching end or beginning of buffer, stop and show a message.

If optional argument WRAP-AROUND is non-nil, wrap around: if point is on the last image, move to the last one and vice versa.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-dired.el.gz
;;; Navigation

(defun image-dired-forward-image (&optional arg wrap-around)
  "Move to next image in the thumbnail buffer.
Optional prefix ARG says how many images to move; the default is
one image.  Negative means move backwards.
On reaching end or beginning of buffer, stop and show a message.

If optional argument WRAP-AROUND is non-nil, wrap around: if
point is on the last image, move to the last one and vice versa."
  (interactive "p" image-dired-thumbnail-mode)
  (setq arg (or arg 1))
  (let (pos)
    (dotimes (_ (abs arg))
      (if (and (not (if (plusp arg) (eobp) (bobp)))
               (save-excursion
                 (forward-char (if (plusp arg) 1 -1))
                 (while (and (not (if (plusp arg) (eobp) (bobp)))
                             (not (image-dired-image-at-point-p)))
                   (forward-char (if (plusp arg) 1 -1)))
                 (setq pos (point))
                 (image-dired-image-at-point-p)))
          (goto-char pos)
        (if wrap-around
            (goto-char (if (plusp arg)
                           (point-min)
                         ;; There are two spaces after the last image.
                         (- (point-max) 2)))
          (message "At %s image" (if (plusp arg) "last" "first"))))))
  (image-dired--update-header-line)
  (when image-dired-track-movement
    (image-dired-track-original-file)))