Subject: bug#66136: 29.1; byte-compiler reports "misplaced interactive spec" with empty fct in lexical environment

From: Jens Schmidt <[email-masked]>
Date: Sat, 23 Sep 2023 21:19:48 +0200

Mattias Engdegård <[email-masked]> writes:

> Our triptych of meta-forms in function bodies (documentation,
> declare, interactive) is still not handled in a very principled
> or robust way.

Just curious since `macroexp-parse-body' also takes care about it: Where
is `cl-declare' in this picture?  Is it relevant at all?

I'm asking since

------------------------- snip -------------------------
(byte-compile
 '(defun foo ()
    (cl-declare)
    (interactive)))
------------------------- snip -------------------------

gives the same "misplaced interactive spec" warning, but for a different
reason: The `cl-declare' gets replaced by nil somewhere before `m-p-b'
gets called, so `m-p-b' sees and returns:

-------------------- *trace-output* --------------------
1 -> (macroexp-parse-body (nil (interactive)))
1 <- macroexp-parse-body: (nil nil (interactive))
-------------------- *trace-output* --------------------

> [...] Suggested patch attached.

Thanks, will give it a try.