display-buffer command (as well as commands that call it
internally) chooses a window to display by following the steps given
below. See Choosing a Window for Display in The Emacs Lisp Reference Manual, for details about how to alter this
sequence of steps.
same-window-buffer-names, or adding a matching regular expression to the list
same-window-regexps. By default, these variables are
nil, so this step is skipped.
pop-up-frames(see below) to
pop-up-framesto a non-
nilvalue. The special value
graphic-onlymeans to do this only on graphical displays.
The split can be either vertical or horizontal, depending on the
split-width-threshold. These variables should have integer
split-height-threshold is smaller than the chosen
window’s height, the split puts the new window below. Otherwise, if
split-width-threshold is smaller than the window’s width, the
split puts the new window on the right. If neither condition holds,
Emacs tries to split so that the new window is below—but only if the
window was not split before (to avoid excessive splitting).
nilthe window may be also on another frame.
A more advanced and flexible way to customize the behavior of
display-buffer is by using the option
mentioned in the next section.