Function: image-next-file
image-next-file is an interactive and byte-compiled function defined
in image-mode.el.gz.
Signature
(image-next-file &optional N)
Documentation
Visit the next image in the same directory as the current image file.
With optional argument N, visit the Nth image file after the current one, in cyclic alphabetical order.
This command visits the specified file via find-alternate-file,
replacing the current Image mode buffer.
Probably introduced at or before Emacs version 24.4.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/image-mode.el.gz
;;; Switching to the next/previous image
(defun image-next-file (&optional n)
"Visit the next image in the same directory as the current image file.
With optional argument N, visit the Nth image file after the
current one, in cyclic alphabetical order.
This command visits the specified file via `find-alternate-file',
replacing the current Image mode buffer."
(interactive "p" image-mode)
(unless (derived-mode-p 'image-mode)
(error "The buffer is not in Image mode"))
(unless buffer-file-name
(error "The current image is not associated with a file"))
(let ((next (image-mode--next-file buffer-file-name n)))
(unless next
(user-error "No %s file in this directory"
(if (> n 0)
"next"
"prev")))
(if (stringp next)
(find-alternate-file next)
(funcall next))))