Function: other-buffer

Return most recently selected buffer other than BUFFER.
Buffers not visible in windows are preferred to visible buffers, unless
optional second argument VISIBLE-OK is non-nil. Ignore the argument
BUFFER unless it denotes a live buffer. If the optional third argument
FRAME is non-nil, use that frame's buffer list instead of the selected
frame's buffer list.

The buffer is found by scanning the selected or specified frame's buffer
list first, followed by the list of all buffers. If no other buffer
exists, return the buffer `*scratch*' (creating it if necessary).