Certain Emacs commands switch to a specific buffer with special contents. For example, M-x shell switches to a buffer named `*Shell*'. By convention, all these commands are written to pop up the buffer in a separate window. But you can specify that certain of these buffers should appear in the selected window.
If you add a buffer name to the list
the effect is that such commands display that particular buffer by
switching to it in the selected window. For example, if you add the
"*grep*" to the list, the
grep command will
display its output buffer in the selected window.
The default value of
same-window-buffer-names is not
nil. It specifies the buffers `*info*', `*mail*' and
`*shell*'. This is why M-x shell normally switches to the
`*shell*' buffer in the selected window. If you delete this
element from the value of
same-window-buffer-names, the behavior
of M-x shell will change--it will pop up the buffer in another
You can specify these buffers more generally with the variable
same-window-regexps. Set it to a list of regular expressions;
then any buffer whose name matches one of those regular expressions is
displayed by switching to it in the selected window. (Once again, this
applies only to buffers that normally get displayed for you in a
separate window.) The default value of this variable specifies Telnet
and rlogin buffers.
An analogous feature lets you specify buffers which should be displayed in their own individual frames. See section Special Buffer Frames.