Subject: Re: 29.0.50; Session-compiled interactive form gives (invalid-function #<symbol list at 476>)

From: Bob Rogers <[email-masked]>
Date: Thu, 12 May 2022 18:45:00 -0400

From: Alan Mackenzie <[email-masked]>
   Date: Wed, 11 May 2022 15:20:04 +0000

   Hello again, Bob.

   On Sun, May 08, 2022 at 15:29:12 -0400, Bob Rogers wrote:

   . . .

   >    The problem occurs with an evaluated "interactive" form in a defun
   > that is compiled with compile-defun -- and it may have escaped notice
   > until now because it doesn't seem to happen if the source is part of
   > Emacs (i.e. is compiled in a file that git knows about).

   I think what's different is that the source has been copied into a
   different file, and that file doesn't have a

       ;; -*- lexical-binding:t -*-

   at the top.  :-)

Aha!  That makes much more sense.  I first encountered this in some of
my own code which I've been lazy about switching to "lexical-binding:t".

   . . .

   > Disassembly shows that the interactive form is not compiled, and the
   > arglist is full of #<symbol X at Y>:

   . . .

   Yes.  For some reason, the interactive form is not compiled when both
   lexical-binding is nil AND the form looks like (list .....).  I don't
   know why this is, and suspect it's a remnant of a very old bug fix which
   is no longer relevant.

   >    And of course "M-x eval-defun" and "M-x byte-compile-file" continue
   > to DTRT, so I am not in any hurry for a fix.  TIA,

   Would you please try out the following patch, which removes the
   positions from the symbols with positions in the arglist and the
   interactive form.  Then please let me know how it goes.  Thanks!

   . . .

   -- 
   Alan Mackenzie (Nuremberg, Germany).

The patch does work when I run my test case (though I get a different
error because I'm not invoking align-highlight-rule appropriately).  And
(as you say) the "interactive" form is compiled when lexical-binding
is nil.

					-- Bob