GNU bug report logs - #33601
26; Add macro `with-hook-added'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 3 Dec 2018 18:48:02 UTC

Severity: wishlist

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #41 received at 33601 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 33601 <at> debbugs.gnu.org
Subject: Re: bug#33601: 26; Add macro `with-hook-added'
Date: Sat, 12 Feb 2022 09:46:19 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

> Enhancement request: Please consider adding a macro such as this, to
> facilitate temporary use of a hook function.
>
> (defmacro with-hook-added (hook function &rest body)
>   "Evaluate forms in BODY with FUNCTION added to HOOK, then remove FUNCTION."
>   (declare (indent 1) (debug t))
>   `(unwind-protect (progn (add-hook ',hook ',function) ,@body)
>      (remove-hook ',hook ',function)))

I don't think this is generally useful enough, so I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 157 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.