same-window-p

same-window-p is a compiled Lisp function in `window.el'.

(same-window-p BUFFER-NAME)

Return non-nil if a buffer named BUFFER-NAME would be shown in the "same" window.
This function returns non-nil if `display-buffer' or
`pop-to-buffer' would show a buffer named BUFFER-NAME in the
selected rather than (as usual) some other window. See
`same-window-buffer-names' and `same-window-regexps'.