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?