Advanced Text-Fu · Lesson 11 of 13
Emacs Buffer Navigation
0 / 5 checkpoints answered
An Emacs buffer holds text or editor state, while a window displays a buffer. A buffer can exist without being visible, and several windows can display one buffer. Managing one object does not automatically manage the other.
Switching Buffers
Use C-x b, which runs switch-to-buffer, to select a buffer by name in the current window:
C-x b
The minibuffer offers completion for existing names. Entering a new name can create a non-file buffer with that name; it does not visit a file pathname.
By default, C-x Right runs next-buffer and C-x Left runs previous-buffer, cycling through buffers in the selected window.
CheckWhich key sequence prompts for a buffer name to display in the current window?
press 1/2/3 to answer · → next lesson
Splitting the Selected Window
Use C-x 2 to split the selected window into an upper and lower window:
C-x 2
Use C-x 3 to split it into left and right windows:
C-x 3
The new window initially displays a buffer, often the same one. Switch buffers in either window independently.
CheckWhich key sequence splits the selected Emacs window into left and right windows?
press 1/2/3 to answer · → next lesson
Selecting and Closing Windows
Use C-x o, which runs other-window, to select the next window:
C-x o
Use these commands to remove window displays:
C-x 0: Delete the selected window.C-x 1: Delete the other windows in the current frame.
Deleting a window normally leaves its displayed buffer alive. You can show that buffer again in another window.
CheckWhich key sequence moves point and keyboard focus to another Emacs window?
press 1/2/3 to answer · → next lesson
CheckWhich key sequence keeps the selected window and deletes the other windows in its frame?
press 1/2/3 to answer · → next lesson
Killing a Buffer
Use C-x k, which runs kill-buffer, to prompt for a buffer to remove from Emacs:
C-x k
The current buffer is the default choice. If a file-visiting buffer has unsaved changes, Emacs warns before killing it. Read the prompt; killing a modified buffer can discard edits.
Killing a buffer is different from deleting a window. Emacs replaces a killed buffer in any displaying window, while deleting a window can leave its buffer untouched.
CheckWhich key sequence prompts to kill an Emacs buffer?
press 1/2/3 to answer · → next lesson
Practice these commands with *scratch* and disposable buffers. Before killing any file-visiting buffer, confirm whether its modified indicator shows unsaved work.
Summary
You can now manage what Emacs stores and what each window displays.
- Switch buffers in the selected window with
C-x b. - Split below with
C-x 2or to the right withC-x 3. - Select another window with
C-x o. - Remove window displays with
C-x 0orC-x 1. - Kill a buffer with
C-x konly after reviewing unsaved changes.
Lesson complete
You finished Emacs Buffer Navigation. Nice work — keep the momentum going.