This is my first day on Emacs, and I am really liking it so far, but I cannot seem to be able to work correctly with buffers. I am trying to kill specific buffers with C-x k
, however upon checking the buffer list with C-x C-b
all of my original buffers still seem to exist. I know this must be user error, but I can't seem to find anyone with this problem.
3 Answers
Given you have multiple buffers open, use
C-x C-b
to open the buffer list. You will be given a nice list of all the buffers currently in memory. Make sure you have the current window that displays the buffer list open. Use
C-x o
to navigate to the aforementioned window. Now you have several options here. First you can mark the specific buffers you want for editing using
m
This will prompt a ">" next to the buffer name. Now use
C-k
to mark the specific buffers for deletion. This will prompt a "D" next to the buffer name. Once you have a list of buffers you marked for deletion, then use
x
to execute the Deletion. The x command will execute the deletion and remove the buffers from memory.
When you have moved to the buffer-list (made it active), press g
. This will update this buffer and the buffers that have already been deleted will disappear from the list, just the list does not automatically update when you call it, but it shows it is already open
Now you have several options here. First you can mark the specific buffers you want for editing using
m
This will prompt a ">" next to the buffer name. Now use
C-k
to mark the specific buffers for deletion.
That's not what m
does--it has nothing to do with editing/deleting. Putting a >
in front of a buffer name, like this:
does not mark it for deletion. To mark a buffer name for deletion, you type:
d (or C-k)
anywhere on the line with the buffer name which will put a D
in the far left column (you don't need to type m
first):
You may find it easiest to just click on the far left column of a line (which prevents the buffer from opening), then type d
.
To get rid of the D
or >
or any other mark in front of a buffer name, type:
u
Or, U
(capital u) to remove the marks in front of all the buffer names.
You can also type:
s
to mark a buffer for saving. You can even mark a buffer name with both an s
and a d
:
Remember, deleting a buffer does not delete the file, it just removes the buffer that is displaying the file. The file will still exist in your file system.
When you type:
x
the deletions and savings will be executed.
For a complete list of the letter/number commands you can type in the Buffer Menu opened by C-x C-b, see:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Several-Buffers.html
C-h t
. This doesn't pertain to your question, per se, but I wish someone had told me about the tutorial on my first day. :) Unless you mean the StackExchange...in that case, welcome! :)emacs -Q
. What steps reproduce the problem for you?C-x C-b
again, or typeg
within that buffer).