pop-to-buffer-same-window

pop-to-buffer-same-window is a compiled Lisp function in `window.el'.

(pop-to-buffer-same-window BUFFER &optional NORECORD)

Select buffer BUFFER in some window, preferably the same one.
BUFFER may be a buffer, a string (a buffer name), or nil. If it
is a string not naming an existent buffer, create a buffer with
that name. If BUFFER is nil, choose some other buffer. Return
the buffer.

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

Unlike `pop-to-buffer', this function prefers using the selected
window over popping up a new window or frame.