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


15.1 Creating and Selecting Buffers

C-x b buffer RET

Select or create a buffer named buffer (switch-to-buffer).

C-x 4 b buffer RET

Similar, but select a buffer named buffer in another window (switch-to-buffer-other-window).

M-x switch-to-other-buffer n

Switch to the previous buffer.

To select a buffer named bufname, type C-x b bufname RET. This is the command switch-to-buffer with argument bufname. You can use completion on an abbreviation for the buffer name you want (see Completion). An empty argument to C-x b specifies the most recently selected buffer that is not displayed in any window.

Most buffers are created when you visit files, or use Emacs commands that display text. You can also create a buffer explicitly by typing C-x b bufname RET, which creates a new, empty buffer that is not visiting any file, and selects it for editing. The new buffer’s major mode is determined by the value of default-major-mode (see Major Modes). Buffers not visiting files are usually used for making notes to yourself. If you try to save one, you are asked for the file name to use.

The function switch-to-buffer-other-frame is similar to switch-to-buffer except that it creates a new frame in which to display the selected buffer.

Use M-x switch-to-other-buffer to visit the previous buffer. If you supply a positive integer n, the nth most recent buffer is displayed. If you supply an argument of 0, the current buffer is moved to the bottom of the buffer stack.

Note that you can also use C-x C-f and any other command for visiting a file to switch buffers. See Visiting.


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