From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#33601: 26; Add macro `with-hook-added' Date: Mon, 3 Dec 2018 23:51:44 +0000 (UTC) Message-ID: <108a3ae8-9959-4dc1-a7fe-bea4a31c8643@default> References: <6871371f-5c46-46f2-9a92-b1c154ec5a73@default> <0b15a9be-6f19-4569-93fd-1a09a6456b25@default> <06d76795115ae2a95f56694a904100ba@webmail.orcon.net.nz> <9bda9cb4-42bb-4e89-b73e-fb0b62443b6c@default> <1c26ed105b9c1262e1688018d32d4957@webmail.orcon.net.nz> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1543881039 582 195.159.176.226 (3 Dec 2018 23:50:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Dec 2018 23:50:39 +0000 (UTC) Cc: 33601@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 04 00:50:34 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTxyz-0008SB-L2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Dec 2018 00:50:33 +0100 Original-Received: from localhost ([::1]:53345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTy16-0005UO-Ai for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Dec 2018 18:52:44 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTy0g-0005Jh-PJ for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2018 18:52:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTy0T-0003uM-0C for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2018 18:52:12 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55322) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gTy0Q-0003rU-KA for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2018 18:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gTy0Q-0004Nd-Ha for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2018 18:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Dec 2018 23:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33601 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33601-submit@debbugs.gnu.org id=B33601.154388111716819 (code B ref 33601); Mon, 03 Dec 2018 23:52:02 +0000 Original-Received: (at 33601) by debbugs.gnu.org; 3 Dec 2018 23:51:57 +0000 Original-Received: from localhost ([127.0.0.1]:59579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTy0K-0004ND-Up for submit@debbugs.gnu.org; Mon, 03 Dec 2018 18:51:57 -0500 Original-Received: from userp2120.oracle.com ([156.151.31.85]:46246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTy0H-0004Mn-NL for 33601@debbugs.gnu.org; Mon, 03 Dec 2018 18:51:54 -0500 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB3NmVK0058975; Mon, 3 Dec 2018 23:51:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=byWPQ6ZrYJLIizlxvz4QT2EYosfHWWu/9BxMEybhMKk=; b=Kn350vy85F22ZeIe2aBIoSXd3fshPvy7qHSpw2DrrpoLoCcnkVOjGd6eVd55Yumbki98 oLEYHNSVb8c5+uC/WXoHyLHWfZ7QIqnopz+MKjHsOeOyLrZa9Ybl2Oy9xAq25a0tOgbz vtMhLtebH1ZJ5w+2jRMSDGYoEqZ1z+0xIWuWZdfIUXHRFr4MHvWq0DS+7UVo1LxTEER4 X1XndkVlX8sYGD/eGdWb468WmqFbX79pPZi762G6GsrMIrGUoz2E0AXyo/ueyduaHtlU zQ1oXDHIDkojB+Arj/9V+tYwqzi/hSp50jTO+9fCS1xhMSntCy8O39rnWni+4Vq/+7N5 vg== Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2p3jxr9bk7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 03 Dec 2018 23:51:47 +0000 Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wB3NpkOH029907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Dec 2018 23:51:46 GMT Original-Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wB3Npjx7028943; Mon, 3 Dec 2018 23:51:45 GMT In-Reply-To: <1c26ed105b9c1262e1688018d32d4957@webmail.orcon.net.nz> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4771.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9096 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812030211 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:153041 Archived-At: > > 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. >=20 > I certainly think it can be useful. >=20 > 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. >=20 > 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.