[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Brittleness of called-interactively-p
From: |
Dmitri Paduchikh |
Subject: |
Brittleness of called-interactively-p |
Date: |
Sun, 12 Jul 2015 10:00:54 +0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello,
The documentation string of called-interactively-p states this:
> This function is very brittle, it may fail to return the intended result
> when the code is debugged, advised, or instrumented in some form. Some
> macros and special forms (such as `condition-case') may also sometimes
> wrap their bodies in a `lambda', so any call to `called-interactively-p'
> from those bodies will indicate whether that lambda (rather than the
> surrounding function) was called interactively.
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.
The called-interactively-p function would simply return this value. Of
course, this will change the meaning of called-interactively-p inside the
usual functions without interactive form, but previously it didn't make
sense to check called-interactively-p inside such functions anyway, so the
change shouldn't cause problems with existing code.
This will allow using called-interactively-p in those cases when changing of
function signature is undesirable for some reasons. For example, when
interactivity of call is insignificant for function interface and you don't
want to compromise the cleanness of function signature for such a little
reason. Or inside advices, when overriding function signature is undesirable
for compatibility reasons. And it even makes provision for some new uses,
e.g. inside function hooks.
Sorry if this idea has already been discussed here.
- Brittleness of called-interactively-p,
Dmitri Paduchikh <=
- Re: Brittleness of called-interactively-p, Stefan Monnier, 2015/07/12
- Re: Brittleness of called-interactively-p, Dmitri Paduchikh, 2015/07/12
- Re: Brittleness of called-interactively-p, Stefan Monnier, 2015/07/12
- Re: Brittleness of called-interactively-p, Dmitri Paduchikh, 2015/07/13
- Re: Brittleness of called-interactively-p, Stefan Monnier, 2015/07/15
- Re: Brittleness of called-interactively-p, raman, 2015/07/16
- RE: Brittleness of called-interactively-p, Drew Adams, 2015/07/16
- RE: Brittleness of called-interactively-p, T.V Raman, 2015/07/16
- Re: Brittleness of called-interactively-p, Richard Stallman, 2015/07/16
- Re: Brittleness of called-interactively-p, Dmitri Paduchikh, 2015/07/17