Question: 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?

Answer: 
You can use the function `kill-current-buffer` from `simple.el`. The docstring says:

> 
> kill-current-buffer is an interactive compiled Lisp function in
>  ‘simple.el’.
> 
> 
> (kill-current-buffer)
> 
> 
> Kill the current buffer.
>  When called in the minibuffer, get out of the minibuffer
>  using ‘abort-recursive-edit’.
> 
> 
> This is like ‘kill-this-buffer’, but it doesn’t have to be invoked
>  via the menu bar, and pays no attention to the menu-bar’s frame.
> 
> 
>
The fastest way is by a keyboard shortcut, which is `C-x k`.