What is the key sequence for closing the current buffer in Emacs?

Emacs

Emacs Problem Overview


If I click on File -> Close, it closes the buffer like I want, but doesn't list a key mapping. What is the key mapping?

Emacs Solutions


Solution 1 - Emacs

You can use C-x k to kill current buffer. See Emacs Manual .

Solution 2 - Emacs

BKB has already given correct answer. Just wanted to add that C-h b lists the key bindings applicable in current buffer

Solution 3 - Emacs

Well, you can view the shortcut of any function with the Help command (C-h).

Press C-hw and then type the command name as you would in M-x mode.


For example (in your case):

  1. Press C-hw
  2. Type the name of the command: kill-buffer ( you can also use tab/space to autocomplete :) )
  3. Press RET

Hope that helps :)

Solution 4 - Emacs

The question asks how to kill the current buffer. Use M-x kill-this-buffer. On my Emacs, it is mapped to s-k. Fewer keystrokes is better!

Solution 5 - Emacs

  1. C-x k to kill the current buffer.
  2. C-x 0 to close the current window.
  3. C-x 1 to close every other window.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNick StinematesView Question on Stackoverflow
Solution 1 - EmacsAnishView Answer on Stackoverflow
Solution 2 - EmacsMiserable VariableView Answer on Stackoverflow
Solution 3 - EmacsSazidView Answer on Stackoverflow
Solution 4 - EmacsDavid J.View Answer on Stackoverflow
Solution 5 - EmacsnomadView Answer on Stackoverflow