help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: watching for variable assignment


From: Eric Abrahamsen
Subject: Re: watching for variable assignment
Date: Fri, 21 Mar 2014 18:26:01 +0800
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> No, this isn't going to work -- the only way I could find the code
>> that's resetting the variable would be to instrument it directly,
>> which would require knowing which code it was in the first place.
>> Not much use!
>
> FWIW, I think I'd accept a patch which adds support for "watchers" on
> symbols (by extending the read-only bit to 2 bits, so we can
> distinguish a "really read-only symbol" from a "symbol with watchers").
>
>> I've got git emacs installed on my system, and I think the newer version
>> of advising functions might work better. I'm hoping that if I add a
>> function to "setq" with the :before key, I can avoid the infinite loop
>> problem.
>
> No, you can't advise special forms (and even if you changed nadvice.el to
> try and support it, it still wouldn't apply to byte-compiled code).
>
>> I read the manual, and found it pretty unhelpful on the question of how
>> to tell it what function you're actually trying to advise.  A "setf-able
>> place" doesn't mean much to me when I'm just trying to hijack "setq" and
>> check its args.
>
> Can you point to the offending documentation (it's still in the process
> of being written, so it would be helpful).
> I don't see any "setf-able" anywhere, but FWIW such a thing is also
> called "an lvalue" in other languages.

I saw "Generalized Variable" in the first paragraph, and in my brain I
conflate "generalized variable" with "setf-able place", probably
incorrectly.

FWIW, I updated git emacs recently. The docs seem to have been greatly
expanded, and now make a lot of sense.

E




reply via email to

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