Next: , Previous: , Up: Windows   [Contents][Index]

20.6 Displaying a Buffer in a Window

It is a common Emacs operation to display or “pop up” some buffer in response to a user command. There are several different ways in which commands do this.

Many commands, like C-x C-f (find-file), display the buffer by “taking over” the selected window, expecting that the user’s attention will be diverted to that buffer. These commands usually work by calling switch-to-buffer internally (see Select Buffer).

Some commands try to display “intelligently”, trying not to take over the selected window, e.g., by splitting off a new window and displaying the desired buffer there. Such commands, which include the various help commands (see Help), work by calling display-buffer internally. See Window Choice, for details.

Other commands do the same as display-buffer, and additionally select the displaying window so that you can begin editing its buffer. The command C-x ` (next-error) is one example (see Compilation Mode). Such commands work by calling the function pop-to-buffer internally. See Switching to a Buffer in a Window in The Emacs Lisp Reference Manual.

Commands with names ending in -other-window behave like display-buffer, except that they never display in the selected window. Several of these commands are bound in the C-x 4 prefix key (see Pop Up Window).

Commands with names ending in -other-frame behave like display-buffer, except that they (i) never display in the selected window and (ii) prefer to create a new frame to display the desired buffer instead of splitting a window—as though the variable pop-up-frames is set to t (see Window Choice). Several of these commands are bound in the C-x 5 prefix key.

Next: , Previous: , Up: Windows   [Contents][Index]