I try to add a nicer key binding to kill the current buffer.
An obvious solution is to use kill-this-buffer
, but often it does not work, or e.g. does not work the first time. The key binding for it is definitely not overridden by the buffers keymap, etc.
Indeed, the docs for kill-this-buffer
say:
This command can be reliably invoked only from the menu bar, otherwise it could decide to silently do nothing.
This is exactly the observed behavior.
What could be a nice alternative? Is something like (kill-buffer (current-buffer))
going to work reliably instead? Am I missing any subtleties?
M-x report-emacs-bug
requesting thatkill-this-buffer
be made to work in your use case. The current quirk is not a feature.kill-this-buffer
supposedly does not work. I have boundkill-this buffer
globally toC-q
. I have used this command every day hundreds of times for years. I have never had a single instance where it proved unreliable and failed to kill the buffer I was in.