Subject: bug#24221: 25.1.50; binding anonymous functions to keys cause help buffer navigation errors

From: Drew Adams <[email-masked]>
Date: Fri, 16 Sep 2016 10:43:46 -0700 (PDT)

This is the problem behind this regression:

1. `describe-key' calls `describe-function', passing it the
   command definition.

2. Someone changed `describe-function' so that it now barfs
   if its arg is not a function symbol.

The doc string of `describe-function' says (and has long
said) that the arg is a symbol.  However, that should be
the case only for interactive use (the `completing-read'
call requires a match against a function symbol).

What should be done:

1. Remove the error for a non-symbol, except perhaps for the
interactive case.

2. Fix the doc, to say that it need not be a symbol when
called from Lisp.

Before the regression was introduced, both `describe-function'
and using `[back]' to get to it worked for a lambda form.

And a doc string in the lambda form was shown correctly as
the doc, in *Help* - just as if the function had a name.

And a byte-compiled lambda form also worked perfectly well
prior to the introduction of the regression:

(global-set-key
  (kbd "C-c l")
  (byte-compile
    (lambda () "DOC" (interactive) (message "FOO"))))

This regression removed a bunch of useful behavior.

`describe-function' should describe a function - any
function.  The argument should be limited to a function
symbol only when called interactively.

(An argument could even be made that it should not even
be so limited for interactive use, that is, that
`completing-read' should be lax, letting you type a
lambda form if you want.  I'm not making that argument
here, however.)