[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Brittleness of called-interactively-p

From: Stefan Monnier
Subject: Re: Brittleness of called-interactively-p
Date: Sun, 12 Jul 2015 19:26:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>>> I would like to make a suggestion. All these problems can be resolved by
>>> introducing a special (dynamically bound) variable. Each call -- not only
>>> interactive -- to an interactive function would rebind it to the value
>>> providing all the necessary information about interactiveness of this call.
SM> That's pretty much what we do.
> No. Currently, called-interactively-p "returns t if the containing function
> was called by `call-interactively'." I argue that functions not having
> interactive form should not have effect on return value.

You might be able to exploit this "ignore non-interactive functions" to
make the current code more robust, indeed.  It might be reasonably easy,
e.g. replace

  (memq (nth 1 frame) '(interactive-p 'byte-code))

with something like (not (commandp (nth 1 frame)).  But note that the
situation for advised functions is still tricky: the outer advice is called
with funcall-interactively (and it interactive) but inner advices and the
original function are always called with `apply' or `funcall' rather
than with funcall-interactively, so called-interactively-p still has to
work harder to try and figure out that "the inner function is actually,
conceptually, called interactively, even though technically it's not".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]