Subject: bug#669: 23.0.60; defalias is not taken into account by C-h k

From: "Drew Adams" <[email-masked]>
Date: Wed, 13 Aug 2008 10:27:24 -0700

>  > If you use (defalias 'lisp-complete-symbol 'foo) instead, 
>  > then this is output:
>  >
>  > M-TAB (translated from <escape> <tab>) runs the command
>  > lisp-complete-symbol, which is an alias for `foo' in `lisp.el'.
>  >
>  > It is bound to M-TAB.
>  >
>  > (lisp-complete-symbol &optional predicate)
>  >
>  > This is still wrong, because `foo' is not in `lisp.el' 
>  > (and the defalias is not in `lisp.el').
>  >
>  > This bug appears as far back as Emacs 20.7.
>  >
>  >
>  >> From: Drew Adams Sent: Thursday, August 07, 2008 11:23 AM
>  >> emacs -Q
>  >>
>  >> (defun foo (&optional predicate)
>  >>   "" (interactive) (message "FOO"))
>  >>
>  >> (defalias 'lisp-complete-symbol (symbol-function 'foo))
>  >>
>  >> C-h k then shows this, which is 100% wrong:
>  >>
>  >> M-TAB (translated from <escape> <tab>) runs the command
>  >> lisp-complete-symbol, which is an interactive Lisp function in
>  >> `lisp.el'.
>  >>
>  >> It is bound to M-TAB.
>  >>
>  >> (lisp-complete-symbol &optional predicate)
> 
> I'm currently rewriting help-fns.el and can produce
> 
> M-TAB (translated from <escape> <tab>) runs the command
> lisp-complete-symbol, which is an interactive Lisp function.
> 
> It is bound to M-TAB, <menu-bar> <lisp-interaction>
> <lisp-complete-symbol>, H-SPC.
> 
> (lisp-complete-symbol &optional predicate)
> 
> and
> 
> M-TAB (translated from <escape> <tab>) runs the command
> lisp-complete-symbol, which is an alias for `foo'.
> 
> It is bound to M-TAB, <menu-bar> <lisp-interaction>
> <lisp-complete-symbol>, H-SPC.
> 
> (lisp-complete-symbol &optional predicate)
> 
> Are these acceptable?

Hi Martin, 

Thanks for working on this.

Not completely fixed yet, because it doesn't say anything about where `foo' is
defined (assuming it is defined in a file somewhere). If you could add that,
that would be great. The point is that we do want to send the user to the source
code, but not to the original `lisp-complete-symbol' source code.

We also need to be sure that the `foo' doc string is used. In my test example I
omitted that.

And both of these cases need to be treated:

(defalias 'lisp-complete-symbol 'foo)
(defalias 'lisp-complete-symbol (symbol-function 'foo))

Thx - Drew