Problem with M-x describe-bindings
Steps to reproduce
- launch
emacs -Q - execute the following
(progn (add-to-list 'load-path "~/.emacs.d/lib/epithet") (require 'epithet) (add-hook 'help-mode-hook #'epithet-rename-buffer)) - Type M-x describe-bindings RET
Expected: You get a buffer with all bindings of the previously-selected buffer Actual: You get an empty buffer
If you follow the same steps except step 2, everything works fine.
+1, also have this issue.
I finally came back to this and this time I managed to figure out what goes wrong. The thing is that describe-bindings does this:
(with-help-window (help-buffer)
;; Be aware that `describe-buffer-bindings' puts its output into
;; the current buffer.
(with-current-buffer (help-buffer)
(describe-buffer-bindings buffer prefix)
The help-buffer function returns the name to be used for the help buffer. There are some special cases, but purposes of this discussions you can think of it as always returning the string "*Help*". So what happens is that with-help-window creates the *Help* buffer and puts it into help-mode. Since you have epithet-rename-buffer on the help-mode-hook, it runs at that point, when the buffer is still empty and renames it to *Help: describe-bindings for SOME-major-mode. And then, after that, describe-buffer-bindings is run to write the bindings into the buffer named (help-buffer), i.e., *Help*.
So the end result is that you get two buffers: one called *Help* with all the key bindings and an empty one with the name epithet gave it, *Help: describe-bindings for SOME-major-mode.
I think the only sensible way to solve this without changing the code of describe-bindings is to have epithet-for-help refuse to rename the describe-bindings buffer until it is already fully written out. Then, you'd have to add this to your configuration:
(advice-add 'describe-bindings :after
(lambda (&rest _)
(with-current-buffer (help-buffer)
(epithet-rename-buffer))))
I've made the fix (and fixed C-h m, while I was at it), and updated the suggested configuration in the README.
Thank you very much for your fix. It doesn't work for me though: https://github.com/oantolin/epithet/issues/11.