window-buffer
window-buffer is a built-in function in `C source code
'.
(window-buffer &optional WINDOW)
Return the buffer displayed in window WINDOW.
If WINDOW is omitted or nil, it defaults to the selected window.
Return nil for an internal window or a deleted window.