unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 33601@debbugs.gnu.org
Subject: bug#33601: 26; Add macro `with-hook-added'
Date: Mon, 3 Dec 2018 23:51:44 +0000 (UTC)	[thread overview]
Message-ID: <108a3ae8-9959-4dc1-a7fe-bea4a31c8643@default> (raw)
In-Reply-To: <1c26ed105b9c1262e1688018d32d4957@webmail.orcon.net.nz>

> > 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	other threads:[~2018-12-03 23:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 18:47 bug#33601: 26; Add macro `with-hook-added' Drew Adams
2018-12-03 19:01 ` Glenn Morris
2018-12-03 20:58   ` Drew Adams
2018-12-03 19:03 ` Drew Adams
2018-12-03 22:37   ` Phil Sainty
2018-12-03 22:50     ` Drew Adams
2018-12-03 23:13       ` Phil Sainty
2018-12-03 23:51         ` Drew Adams [this message]
     [not found] ` <mailman.5097.1543862895.1284.bug-gnu-emacs@gnu.org>
2018-12-04 18:46   ` Alan Mackenzie
2022-02-12  8:46 ` Lars Ingebrigtsen
     [not found] <<mailman.5097.1543862895.1284.bug-gnu-emacs@gnu.org>
     [not found] ` <<20181204184614.2049.qmail@mail.muc.de>
2018-12-04 19:18   ` Drew Adams
2018-12-04 20:10     ` Alan Mackenzie
2018-12-04 21:22       ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=108a3ae8-9959-4dc1-a7fe-bea4a31c8643@default \
    --to=drew.adams@oracle.com \
    --cc=33601@debbugs.gnu.org \
    --cc=psainty@orcon.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).