85

If I click on menu FileClose, it closes the buffer like I want, but it doesn't list a key mapping for it. What is the key mapping?

1
  • 3
    The selected answer doesn't answer your question, the other one does.
    – roundar
    Jul 9, 2013 at 17:09

5 Answers 5

117

You can use Ctrl + X, K to kill the current buffer. See the Emacs manual.

4
  • 6
    Since the question asks how to kill the current buffer, kill-this-buffer, mapped to s-k, is faster. See: stackoverflow.com/a/26592985/109618
    – David J.
    Oct 27, 2014 at 17:12
  • 1
    This does not close the buffer. In someone's perverted mind, the buffer stays open and is filled with the contents of another buffer. What idiot is responsible for this awful ux??? How hard can it possibly be to get the buffer of interest to take up 80x24 of the terminal???
    – jww
    Jul 13, 2019 at 16:46
  • I just realize s-k => 's' => is 'super' key, LOL.. I never know what it super key before.
    – 1234
    Dec 21, 2019 at 21:39
  • C-x k doesn't 'kill' (whatever that may mean) the current buffer but merely empties it. If I do C-x b after I 'killed' a buffer it is still in the list. How do I kill the buffer AND remove it from the list?
    – HarryH
    Aug 10, 2020 at 8:41
33

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

2
  • 3
    C-h b is a lifesaver when you're editing a new type of file for the first time in emacs.
    – Branan
    Oct 21, 2008 at 17:33
  • 17
    Unfortunately, BKB (user 27055) deleted all his answers. The answer (from Google's cache) was: "C-x k kills the current buffer C-x # kills a server buffer (if you use Emacsclient)"
    – CesarB
    Nov 8, 2008 at 16:05
23

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!

By default, 's' (for super key) is the Windows key on most keyboards and the Command key on Mac.

6
  • 1
    s-k? As in, Shift-K, the same key that usually types the uppercase K key? Feb 12, 2015 at 17:44
  • 2
    's' as in 'super'. That maps to the Command / Apple key on OS X.
    – David J.
    Feb 12, 2015 at 22:16
  • Thanks, didn't know about that convention. Feb 12, 2015 at 22:54
  • 2
    What is the equivalent of 's'/'super' key on Linux? Is there a substitute key for it?
    – vfclists
    Oct 6, 2018 at 23:27
  • 1
    if you are using a standard non-Mac keyboard, the super key is the "Windows" key, usually located between Ctrl and Alt
    – xdavidliu
    Dec 9, 2018 at 20:43
22

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

0
11
  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.

Your Answer

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

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