29.13 Displaying a Buffer in a Suitable Window

This section describes lower-level functions Emacs uses to find or create a window for displaying a specified buffer. The common workhorse of these functions is display-buffer which eventually handles all incoming requests for buffer display (see Choosing a Window for Displaying a Buffer).

display-buffer delegates the task of finding a suitable window to so-called action functions (see Action Functions for Buffer Display). First, display-buffer compiles a so-called action alist—a special association list that action functions can use to fine-tune their behavior. Then it passes that alist on to each action function it calls (see Action Alists for Buffer Display).

The behavior of display-buffer is highly customizable. To understand how customizations are used in practice, you may wish to study examples illustrating the order of precedence which display-buffer uses to call action functions (see Precedence of Action Functions). To avoid conflicts between Lisp programs calling display-buffer and user customizations of its behavior, it may make sense to follow a number of guidelines which are sketched in the final part of this section (see The Zen of Buffer Display).