Subject: Re: bug#14702: 24.3.50; Byte-compiling called-interactively-p inside catch

From: Stefan Monnier <[email-masked]>
Date: Mon, 24 Jun 2013 21:39:21 -0400

>    (defun baz ()
>      (interactive)
>      (catch 'test
>        (if (called-interactively-p 'any)

If it hurts, don't do that.
Internally, the byte-compiled form of catch ends up wrapping its body
inside a lambda, so the called-interactively-p test refers to the
implicit lambda added, rather than to the enclosing function
you defined.

It would be good to avoid this intermediate lambda for performance
reasons (which would incidentally also fix this particular issue), but
in the mean time (and more generally) either avoid
called-interactively-p (pass an extra argument instead), or avoid
placing it "deep" within your function (e.g. inside
a catch/unwind-protect/condition-case/save-foobar/...).

        Stefan