[Top][All Lists]

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

bug#33601: 26; Add macro `with-hook-added'

From: Drew Adams
Subject: bug#33601: 26; Add macro `with-hook-added'
Date: Mon, 3 Dec 2018 23:51:44 +0000 (UTC)

> > The real question is whether such a macro is useful.
> > I think it can be.  I gave a couple examples in bug
> > #33595.  It was those examples that made me think
> > such a macro might be useful.
> I certainly think it can be useful.
> On a couple of occasions I've used code which does a similar thing
> with advice -- adding temporary advice, running a body, and removing
> the advice again.
> In both cases one could argue for a more persistent hook or advice
> which performs its own check to see whether it should do things, but
> that might also entail writing a new wrapper to perform the test, so
> there's appeal in a with-* approach (particularly for things which are
> wanted only very occasionally).

Yes to all that.  A propos, I don't think advice (even
nadvice) replaces the special utility of a hook, for
reasons similar to those I gave in bug #33595 for why
a hook is handier for that use case than is using
`:exit-function' on `completion-extra-properties'.

Each such function behavior-modifying tool has a
purpose, even if sometimes they can substitute for
each other.

reply via email to

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