Function: switch-to-buffer-other-frame

switch-to-buffer-other-frame is an interactive and byte-compiled function defined in window.el.gz.

Signature

(switch-to-buffer-other-frame BUFFER-OR-NAME &optional NORECORD)

Documentation

Switch to buffer BUFFER-OR-NAME in another frame.

BUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil. Return the buffer switched to.

This uses the function display-buffer as a subroutine to display the buffer; see its documentation for additional customization information. By default, if the buffer is already displayed (even in the current frame), that window is selected. If the buffer isn't displayed in any frame, a new frame is popped up and the buffer is displayed there.

If called interactively, read the buffer name using read-buffer. The variable confirm-nonexistent-file-or-buffer(var)/confirm-nonexistent-file-or-buffer(fun) determines whether to request confirmation before creating a new buffer. See read-buffer for features related to input and completion of buffer names.

If BUFFER-OR-NAME is a string and does not identify an existing buffer, create a new buffer with that name. If BUFFER-OR-NAME is nil, switch to the buffer returned by other-buffer.

Optional second arg NORECORD non-nil means do not put this buffer at the front of the list of recently selected ones.

View in manual

Probably introduced at or before Emacs version 20.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun switch-to-buffer-other-frame (buffer-or-name &optional norecord)
  "Switch to buffer BUFFER-OR-NAME in another frame.
BUFFER-OR-NAME may be a buffer, a string (a buffer name), or
nil.  Return the buffer switched to.

This uses the function `display-buffer' as a subroutine to
display the buffer; see its documentation for additional
customization information.  By default, if the buffer is already
displayed (even in the current frame), that window is selected.
If the buffer isn't displayed in any frame, a new frame is popped
up and the buffer is displayed there.

If called interactively, read the buffer name using `read-buffer'.
The variable `confirm-nonexistent-file-or-buffer' determines
whether to request confirmation before creating a new buffer.
See `read-buffer' for features related to input and completion
of buffer names.

If BUFFER-OR-NAME is a string and does not identify an existing
buffer, create a new buffer with that name.  If BUFFER-OR-NAME is
nil, switch to the buffer returned by `other-buffer'.

Optional second arg NORECORD non-nil means do not put this
buffer at the front of the list of recently selected ones."
  (interactive
   (list (read-buffer-to-switch "Switch to buffer in other frame: ")))
  (pop-to-buffer buffer-or-name display-buffer--other-frame-action norecord))