all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Request for help: advice-lite
@ 2012-06-28  4:09 Stefan Monnier
  2012-06-28  4:55 ` John Wiegley
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-06-28  4:09 UTC (permalink / raw)
  To: emacs-devel

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.

So I'd really like to see a "lite" version of advice.el.
What I'm looking for:
- as simple and lightweight as possible.
- e.g. only provide `around' advice.
- preserve advice.el's "C-h f" documentation feature, so we can know
  that the function is advised, and make it so we can easily jump to the
  advice's definition.
- should be usable for elp.el, trace.el, debug-on-entry, and advice.el.
- usable also for CL's `dotimes' and `dolist' override.

Any taker?


        Stefan


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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Request for help: advice-lite
  2012-06-28  4:09 Request for help: advice-lite Stefan Monnier
@ 2012-06-28  4:55 ` John Wiegley
  2012-06-28  5:12   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: John Wiegley @ 2012-06-28  4:55 UTC (permalink / raw)
  To: emacs-devel

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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?

> 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.

John



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Request for help: advice-lite
  2012-06-28  4:55 ` John Wiegley
@ 2012-06-28  5:12   ` Stefan Monnier
  2012-06-28  5:56     ` John Wiegley
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-06-28  5:12 UTC (permalink / raw)
  To: emacs-devel

>> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Request for help: advice-lite
  2012-06-28  5:12   ` Stefan Monnier
@ 2012-06-28  5:56     ` John Wiegley
  0 siblings, 0 replies; 4+ messages in thread
From: John Wiegley @ 2012-06-28  5:56 UTC (permalink / raw)
  To: emacs-devel

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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)) ....)

Still less elegant than `letf's correspondence to `let'.  My 2c.

John



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-28  5:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-28  4:09 Request for help: advice-lite Stefan Monnier
2012-06-28  4:55 ` John Wiegley
2012-06-28  5:12   ` Stefan Monnier
2012-06-28  5:56     ` John Wiegley

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.