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?
Asked
Active
Viewed 5.6k times
85
-
2The selected answer doesn't answer your question, the other one does. – roundar Jul 09 '13 at 17:09
5 Answers
117
You can use C-x k
to kill current buffer. See Emacs Manual .

Anish
- 1,490
- 1
- 13
- 13
-
5Since the question asks how to kill the current buffer, `kill-this-buffer`, mapped to `s-k`, is faster. See: http://stackoverflow.com/a/26592985/109618 – David J. Oct 27 '14 at 17:12
-
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 '19 at 16:46
-
I just realize s-k => 's' => is 'super' key, LOL.. I never know what it super key before. – 1234 Dec 21 '19 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 '20 at 08:41
33
BKB has already given correct answer. Just wanted to add that C-h b
lists the key bindings applicable in current buffer

C. K. Young
- 219,335
- 46
- 382
- 435

Miserable Variable
- 28,432
- 15
- 72
- 133
-
3C-h b is a lifesaver when you're editing a new type of file for the first time in emacs. – Branan Oct 21 '08 at 17:33
-
16Unfortunately, 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 08 '08 at 16:05
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):
- Press C-hw
- Type the name of the command:
kill-buffer
( you can also use tab/space to autocomplete :) ) - Press RET
Hope that helps :)

Sazid
- 2,747
- 1
- 22
- 34
22
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!

David J.
- 31,569
- 22
- 122
- 174
-
`s-k`? As in, Shift-K, the same key that usually types the uppercase K key? – Vladimir Panteleev Feb 12 '15 at 17:44
-
1
-
-
When made explicit, the Shift modifier is written as an upper-case `S` in Emacs' key notation. Commonly it is implicit, though (e.g. `M-%` rather than `M-S-5`, and `C-c H` rather than `C-c S-h`). – phils Apr 23 '16 at 14:25
-
1What is the equivalent of 's'/'super' key on Linux? Is there a substitute key for it? – vfclists Oct 06 '18 at 23:27
-
if you are using a standard non-Mac keyboard, the super key is the "Windows" key, usually located between Ctrl and Alt – xdavidliu Dec 09 '18 at 20:43
11
C-x k
to kill the current buffer.C-x 0
to close the current window.C-x 1
to close every other window.

nomad
- 471
- 6
- 12