[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Request for help: advice-lite
From: |
Stefan Monnier |
Subject: |
Re: Request for help: advice-lite |
Date: |
Thu, 28 Jun 2012 01:12:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
>> Advice.el is a very nice library, but sadly there are many places in Emacs
>> where we could use it but we don't because of advice.el's size.
> [...]
>> Any taker?
> I assume you'd be happy if one were to just copy advice.el to advice-lite.el,
> and then rip out everything you don't want?
If it's small enough, yes, of course. It might not be the easiest
way to get there, tho.
>> PS: The intention is of course not to encourage people to advise more
>> functions, but rather to avoid people using flet/letf/fset/... to roll their
>> own form of function-override which typically makes bug more difficult to
>> track down, because the presence of an override may not be obvious.
> One feature of letf that advising does not provide is that the override only
> covers a very specific range in the code. Advice typically persists
> throughout one's entire session.
You can get the same behavior in 2 different ways:
- (unwind-protect (progn (ad-enable-advice ...) ...) (ad-disable-advice ...))
- Make your advice check `my-advice-condition' and then do
(let ((my-advice-condition 'enabled)) ....)
Stefan