From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Steven Allen Newsgroups: gmane.emacs.bugs Subject: bug#68114: [PATCH] Make 'advice-remove' interactive Date: Fri, 29 Dec 2023 11:57:12 -0800 Message-ID: <87r0j42353.fsf@stebalien.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9244"; mail-complaints-to="usenet@ciao.gmane.io" To: 68114@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 29 20:58:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rJIzo-0002Bj-Tq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Dec 2023 20:58:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJIzd-0002BA-PU; Fri, 29 Dec 2023 14:58:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJIzb-0002B2-Q0 for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 14:58:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rJIza-0006bT-Qj for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 14:58:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rJIza-0005f6-I3 for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 14:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Steven Allen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Dec 2023 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68114 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170387984521718 (code B ref -1); Fri, 29 Dec 2023 19:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Dec 2023 19:57:25 +0000 Original-Received: from localhost ([127.0.0.1]:42279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJIyz-0005eE-15 for submit@debbugs.gnu.org; Fri, 29 Dec 2023 14:57:25 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:49130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJIyx-0005e0-9W for submit@debbugs.gnu.org; Fri, 29 Dec 2023 14:57:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJIyr-00028g-HE for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 14:57:17 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJIyp-0006Xi-Pq for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 14:57:17 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 66C6E5C02A2 for ; Fri, 29 Dec 2023 14:57:13 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 29 Dec 2023 14:57:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm1; t=1703879833; x=1703966233; bh=UBaS2HmHX+H70wAN7gePV2kOoekIZrZr TQNtT6lTWck=; b=MAjYNMqtIz1omGz6BuzCI36jFfcnkCyZmCAn7GiuAT/ykUdq mBP1cdveZOPsUx8ciP/e7kx7AZI1KtIMWUUglOiAtHRIyKvEbCJGO54q+bHHUMPz kNPz7g1z4T/I2TuvaAFnSKg4QBl6RI/U9/G0X4qE5uj4ZBiKzvd+TVbdzM9uopGg I6zKTaGlxn456SdWuYvWVauP5G8dvzEgRLwbmt0g/RnzUBWIxsCILjnS5G1bgEWh qfX+9/lD6KB8ahcEJr0L5W8GmRuCCPigcfvT21aRm1UZR1OlGgdOqzitDJwI1dY3 ejn7+gmofaTqYWN41+rIl/mc/JY+uUhAMoiLrw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1703879833; x=1703966233; bh=UBaS2HmHX+H70wAN7gePV2kOoekIZrZrTQN tT6lTWck=; b=Uq1ojKfOyCbuJ7/Wdyp2DDsP2AIRe6PeyTH6YkxsW0ukRYbU6ir XCW53797F9BHZ+7RAZkYkFSpioIgxaq+/ukOQCYBIDk/oFPO2P+bsGFiY9JZAJu8 8k7zqSx9LD778Z4aMmTAiSHTheU3cPQSBavJsqoROayPi9i+7Zwq8mfgPnIJeZQn c+guY3dJQ7opAuf0ZB/sOuE89B8y9ckfz26kq7qKrsHCZgo5oA2Ym+Izp0cEUsQ3 D5k8T0uMrt1LZ7ybfGwwmMgtMRWdzkGnC/jNCj02csr20SzAWEk/rf4Jm0mwcfD6 e0O2k8wlpcJbhwmjZv8ThSAeTlSf9h6VBDw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeffedgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesmhdtreertd dttdenucfhrhhomhepufhtvghvvghnucetlhhlvghnuceoshhtvghvvghnsehsthgvsggr lhhivghnrdgtohhmqeenucggtffrrghtthgvrhhnpeekffffgfevteehtdeiffelffegke dvieeigeehfedtteejkeefhfevtddtkeefffenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomh X-ME-Proxy: Feedback-ID: ie8a146a7:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 29 Dec 2023 14:57:12 -0500 (EST) Received-SPF: pass client-ip=66.111.4.28; envelope-from=steven@stebalien.com; helo=out4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:277036 Archived-At: --=-=-= Content-Type: text/plain This patch makes 'advice-remove' interactive to match 'ad-advice-remove'. Unlike 'ad-advice-remove', 'advice-remove' works with new-style advice as well. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-advice-remove-interactive.patch >From 41de95097d3e79967f4fbb417aba424e8ffce058 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 29 Dec 2023 09:53:05 -0800 Subject: [PATCH] Make 'advice-remove' interactive `ad-advice-remove' is already interactive, but it doesn't work with new-style advice. * lisp/emacs-lisp/nadvice.el (advice-remove): Make it interactive. --- lisp/emacs-lisp/nadvice.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index 9f2b42f5765..32e54b3dd02 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -539,6 +539,16 @@ advice-remove or an autoload and it preserves `fboundp'. Instead of the actual function to remove, FUNCTION can also be the `name' of the piece of advice." + (interactive + (let ((symbol (intern (completing-read + "Advised Function: " + obarray + (lambda (sym) (advice--p (advice--symbol-function sym))) + t nil nil + (when-let (def (function-called-at-point)) (symbol-name def))))) + advice) + (advice-mapc (lambda (f _) (push (cons (prin1-to-string f) f) advice)) symbol) + (list symbol (cdr (assoc-string (completing-read "Advice: " advice) advice))))) (let ((f (symbol-function symbol))) (remove-function (cond ;This is `advice--symbol-function' but as a "place". ((get symbol 'advice--pending) -- 2.43.0 --=-=-=--