Eli Zaretskii writes: > Ping! Morgan, could you please try Martin's suggestions and report > back? > >> >> FWIW, I would rewrite 'image-dired-display-image' as the (largely >> untested) >> >> (defun image-dired-display-image (file &optional _ignored) >> "Display image FILE in the image buffer window. >> If FILE is an image, the window will use `image-dired-image-mode' >> which is based on `image-mode'." >> (declare (advertised-calling-convention (file) "29.1")) >> (setq file (expand-file-name file)) >> (when (not (file-exists-p file)) >> (error "No such file: %s" file)) >> (let* ((buffer (get-buffer-create image-dired-display-image-buffer)) >> (window (get-buffer-window buffer))) >> (find-file-noselect-1 buffer file nil t nil nil) >> (with-current-buffer buffer >> (if (string-match (image-file-name-regexp) file) >> (image-dired-image-mode) >> ;; Support visiting PDF files. >> (normal-mode))) >> >> (unless window >> (display-buffer buffer)))) >> >> instead of doing all that 'kill-buffer' (which could delete the selected >> window as a side-effect so the final 'select-window' will throw an >> error) 'rename-buffer' rigmarole. >> >> martin I initially explored this option but was weary to use 'find-file-noselect-1` as it looks like it should be an internal function and is used only in the file it's defined in. However, I do like this solution the most. Attached is a patch almost identical to the proposed function. The proposed function would be perfect if it contained the line '(display-buffer buffer t)'. Morgan