Open casouri opened 4 years ago
This is a funny one. Here is what describe-function
gives (after running (require 'help)
):
help-command is a sparse keymap.
Prefix command (definition is a keymap associating keystrokes with commands).
According to the manual:
-- Prefix Command: help-command
This symbol is not a function; its function definition cell holds
the keymap known as ‘help-map’. It is defined in ‘help.el’ as
follows:
(define-key global-map (string help-char) 'help-command)
(fset 'help-command help-map)
Indeed, but if describe-function
does return the documentation, why would helpful error?
The screw-up comes in helpful--signature
, specifically around the handling of advertised-args
. I don't know what the correct fix is. This is a pathological edge case. How does describe-function
handle it?
Probably not a hard one. I think the problem is just nobody has the time to look into it...
It's not actually a function, it's a (obscure to me) way of handling prefix keys for key maps.
https://emacs.stackexchange.com/questions/28576/when-does-emacs-treat-keymaps-as-functions
https://emacs.stackexchange.com/questions/32754/what-does-fset-symbol-keymap-do
Helpful should support this though.
This is not an isolated edge case. I just hit this exact same error in doom emacs calling M-x helpful-callable RET yas-expand RET. Looking up help for something as popular as yas-expand shouldn't blow up with an error. This really ought to be fixed.
In the case of yas-expand
, describe-function
first produces the original function definition using (nth 3 (help-fns--analyze-function 'yas-expand))
before passing it to help-function-arglist
. This will not automatically solve help-command
though, as (nth 3 (help-fns--analyze-function 'yas-expand))
returns the keymap object instead of a function symbol.
Reproduce:
Backtrace: