1

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.

4
  • For many (most?) users, killing buffers is a rare operation, so please give details: which buffer exactly id you try to kill, what exact sequence of operations did you do; and of course: why do you want to kill those buffer.
    – Stefan
    Commented Feb 22, 2019 at 21:49
  • Welcome to Emacs! As a beginner, I highly recommend reading the build in tutorial via 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! :) Commented Feb 22, 2019 at 21:55
  • 2
    Also, I'm not able to reproduce your problem from a freshly loaded emacs -Q. What steps reproduce the problem for you? Commented Feb 22, 2019 at 21:57
  • 2
    Perhaps you just need to refresh the buffer list? (Either use C-x C-b again, or type g within that buffer).
    – phils
    Commented Feb 23, 2019 at 2:41

3 Answers 3

10

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.

3

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

0

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:

enter image description here

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):

enter image description here

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:

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.