29.17.1 Displaying Buffers in Side Windows

The following action function for display-buffer (see Action Functions for Buffer Display) creates or reuses a side window for displaying the specified buffer.

Function: display-buffer-in-side-window buffer alist

This function displays buffer in a side window of the selected frame. It returns the window used for displaying buffer, nil if no such window can be found or created.

alist is an association list of symbols and values as for display-buffer. The following symbols in alist are special for this function:

side

Denotes the side of the frame where the window shall be located. Valid values are left, top, right and bottom. If unspecified, the window is located at the bottom of the frame.

slot

Denotes a slot at the specified side where to locate the window. A value of zero means to preferably position the window in the middle of the specified side. A negative value means to use a slot preceding (that is, above or on the left of) the middle slot. A positive value means to use a slot following (that is, below or on the right of) the middle slot. Hence, all windows on a specific side are ordered by their slot value. If unspecified, the window is located in the middle of the specified side.

dedicated

The dedicated flag (see Dedicated Windows) has a slightly different meaning for side windows. When a side window is created, that flag is set to the value side to prevent display-buffer to use the window in other action functions. Its value persists across invocations of quit-window, kill-buffer, previous-buffer and next-buffer.

In particular, these commands will refrain from showing, in a side window, buffers that have not been displayed in that window before. They will also refrain from having a normal, non-side window show a buffer that has been already displayed in a side window. A notable exception to the latter rule occurs when an application, after displaying a buffer, resets that buffer’s local variables. To override these rules and always delete a side window with quit-window or kill-buffer, and eventually prevent the use of previous-buffer and next-buffer, set this value to t or specify a value via display-buffer-mark-dedicated.

If you specify the same slot on the same side for two or more different buffers, the buffer displayed last is shown in the corresponding window. Hence, slots can be used for sharing the same side window between buffers.

This function installs the window-side and window-slot parameters (see Window Parameters) and makes them persistent. It does not install any other window parameters unless they have been explicitly provided via a window-parameters entry in alist.

By default, side windows cannot be split via split-window (see Splitting Windows). Also, a side window is not reused or split by any buffer display action (see Action Functions for Buffer Display) unless it is explicitly specified as target of that action. Note also that delete-other-windows cannot make a side window the only window on its frame (see Deleting Windows).