diff options
| -rw-r--r-- | lisp/image-mode.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index a869907669c..342102568ca 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -982,7 +982,19 @@ replacing the current Image mode buffer." | |||
| 982 | (throw 'image-visit-next-file (1+ idx))) | 982 | (throw 'image-visit-next-file (1+ idx))) |
| 983 | (setq idx (1+ idx)))) | 983 | (setq idx (1+ idx)))) |
| 984 | (setq idx (mod (+ idx (or n 1)) (length images))) | 984 | (setq idx (mod (+ idx (or n 1)) (length images))) |
| 985 | (find-alternate-file (nth idx images)))) | 985 | (let ((image (nth idx images)) |
| 986 | (dir (file-name-directory buffer-file-name))) | ||
| 987 | (find-alternate-file image) | ||
| 988 | ;; If we have dired buffer(s) open to where this image is, then | ||
| 989 | ;; place point on it. | ||
| 990 | (dolist (buffer (buffer-list)) | ||
| 991 | (with-current-buffer buffer | ||
| 992 | (when (and (derived-mode-p 'dired-mode) | ||
| 993 | (equal (file-truename dir) | ||
| 994 | (file-truename default-directory))) | ||
| 995 | (save-window-excursion | ||
| 996 | (switch-to-buffer (current-buffer) t t) | ||
| 997 | (dired-goto-file (expand-file-name image dir))))))))) | ||
| 986 | 998 | ||
| 987 | (defun image-previous-file (&optional n) | 999 | (defun image-previous-file (&optional n) |
| 988 | "Visit the preceding image in the same directory as the current file. | 1000 | "Visit the preceding image in the same directory as the current file. |