mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Move point in the dired buffer with n'/p' in an image-mode buffer
* lisp/image-mode.el (image-next-file): If the image is in a dired buffer, then move point in that buffer when advancing (bug#21752). This makes it easier to select images.
This commit is contained in:
parent
9db9b0b12d
commit
e8dd6c9d83
1 changed files with 13 additions and 1 deletions
|
|
@ -982,7 +982,19 @@ replacing the current Image mode buffer."
|
|||
(throw 'image-visit-next-file (1+ idx)))
|
||||
(setq idx (1+ idx))))
|
||||
(setq idx (mod (+ idx (or n 1)) (length images)))
|
||||
(find-alternate-file (nth idx images))))
|
||||
(let ((image (nth idx images))
|
||||
(dir (file-name-directory buffer-file-name)))
|
||||
(find-alternate-file image)
|
||||
;; If we have dired buffer(s) open to where this image is, then
|
||||
;; place point on it.
|
||||
(dolist (buffer (buffer-list))
|
||||
(with-current-buffer buffer
|
||||
(when (and (derived-mode-p 'dired-mode)
|
||||
(equal (file-truename dir)
|
||||
(file-truename default-directory)))
|
||||
(save-window-excursion
|
||||
(switch-to-buffer (current-buffer) t t)
|
||||
(dired-goto-file (expand-file-name image dir)))))))))
|
||||
|
||||
(defun image-previous-file (&optional n)
|
||||
"Visit the preceding image in the same directory as the current file.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue