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 14:41:07 -0700

>  > Not completely fixed yet, because it doesn't say anything 
>  > about where `foo' is
>  > defined (assuming it is defined in a file somewhere).
> 
> If it is "defined in a file somewhere" you can jump to `foo' and see
> where it is defined.  IIUC your assumption was that it's been defined
> and evaluated in a buffer only.

I didn't mean to make any such assumption. The example I sent was ambiguous in
this regard, but it did probably suggest a definition outside of a file.

If the new definition is in a file that is loaded, then it would be good to
treat it the same way we treat such a definition when it has nothing aliased to
it: give the function name and the file it is defined in.

That is, for (defun foo () "..." 5) we don't just print `foo' and let you click
that link to find out where it is defined. We also print "is an interactive
compiled Lisp function in `titi.el'". That same format would be preferable for
the defalias case also: "`toto' is an alias for `foo' which is an interactive
compiled Lisp function in `titi.el'".

IOW, the only thing to be added is the fact that `toto' is an alias for `foo'.
We still need to know what `foo' is and where it was defined.

>  > 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.
> 
> If it's defined in a file we can send the user to the source 
> code in the
> 
>    (defalias 'lisp-complete-symbol 'foo)
> 
> case via the `foo' indirection

It's the `lisp-complete-symbol' that is the indirection: it is a pointer to
`foo'.

> but certainly _not_ in the
> 
>    (defalias 'lisp-complete-symbol (symbol-function 'foo))
> 
> because, well, look at the return value of (symbol-function 'foo).

I guess this is because `defalias' is a function, not a macro, so we don't have
access to the sexp (symbol-function 'foo) and hence to `foo'. OK.

>  > We also need to be sure that the `foo' doc string is used. 
>  > In my test example I omitted that.
> 
> In the indirection case follow the link to `foo' and get its 
> doc-string from there.  In the `symbol-function' case you
> simply have to provide your own doc-string via the third arg of `defalias'.

This is presumably the same problem as above. OK.

So it sounds like we can build the source file link "in `titi.el'" in the case
of 'foo but not in the case of (symbol-function 'foo). That's still pretty good
- much more helpful than what we have now (which is wrong and misleading).

>  > And both of these cases need to be treated:
>  >
>  > (defalias 'lisp-complete-symbol 'foo)
>  > (defalias 'lisp-complete-symbol (symbol-function 'foo))
> 
> I suppose I posted the *Help* output for both cases.

Thx - Drew