Windows 10, Emacs 25.1, Helm

I open 3 buffers (3 files). Show only 2 buffers.

enter image description here

As you can see the current buffer is my_buffer_1 because cursor is in this buffer. I want to kill this current buffer.

M-x kill-buffer

But Emacs ask me what exactly buffer I want to kill. enter image description here

I select my_buffer_1 and press Enter. As result buffer is killed. enter image description here

Is it possible Emacs to not ask me about buffer name and kill default (with cursor) buffer? In my case this is a my_buffer_1.

Use the function kill-this-buffer. I basically never want to kill buffers that are not the current buffer, so I rebind C-x k to that function:

(global-set-key (kbd "C-x k") #'kill-this-buffer)

(Of course, if you ever do wanted to be prompted for a buffer to kill, you can just run M-x kill-buffer, or since you use Helm, kill it from the buffer switcher.)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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