unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: Drew Adams <drew.adams@oracle.com>
Cc: 33601@debbugs.gnu.org
Subject: bug#33601: 26; Add macro `with-hook-added'
Date: Tue, 04 Dec 2018 12:13:55 +1300	[thread overview]
Message-ID: <1c26ed105b9c1262e1688018d32d4957@webmail.orcon.net.nz> (raw)
In-Reply-To: <9bda9cb4-42bb-4e89-b73e-fb0b62443b6c@default>

On 2018-12-04 11:50, Drew Adams wrote:
> 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).


-Phil






  reply	other threads:[~2018-12-03 23:13 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 [this message]
2018-12-03 23:51         ` Drew Adams
     [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=1c26ed105b9c1262e1688018d32d4957@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=33601@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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).