Function: find-alternate-file-other-window
find-alternate-file-other-window is an interactive and byte-compiled
function defined in files.el.gz.
Signature
(find-alternate-file-other-window FILENAME &optional WILDCARDS)
Documentation
Find file FILENAME as a replacement for the file in the next window.
This command does not select that window.
See C-x C-f (find-file) for the possible forms of the FILENAME argument.
Interactively, or if WILDCARDS is non-nil in a call from Lisp, expand wildcards (if any) and replace the file with multiple files.
If this command needs to split the current window, it by default obeys
the user options split-height-threshold and split-width-threshold,
when it decides whether to split the window horizontally or vertically.
Probably introduced at or before Emacs version 26.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun find-alternate-file-other-window (filename &optional wildcards)
"Find file FILENAME as a replacement for the file in the next window.
This command does not select that window.
See \\[find-file] for the possible forms of the FILENAME argument.
Interactively, or if WILDCARDS is non-nil in a call from Lisp,
expand wildcards (if any) and replace the file with multiple files.
If this command needs to split the current window, it by default obeys
the user options `split-height-threshold' and `split-width-threshold',
when it decides whether to split the window horizontally or vertically."
(interactive
(save-selected-window
(other-window 1)
(let ((file buffer-file-name)
(file-name nil)
(file-dir nil))
(and file
(setq file-name (file-name-nondirectory file)
file-dir (file-name-directory file)))
(list (read-file-name
"Find alternate file: " file-dir nil
(confirm-nonexistent-file-or-buffer) file-name)
t))))
(if (one-window-p)
(find-file-other-window filename wildcards)
(save-selected-window
(other-window 1)
(find-alternate-file filename wildcards))))