all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#68114: [PATCH] Make 'advice-remove' interactive
@ 2023-12-29 19:57 Steven Allen
  2023-12-29 20:12 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Steven Allen @ 2023-12-29 19:57 UTC (permalink / raw)
  To: 68114

[-- Attachment #1: Type: text/plain, Size: 156 bytes --]


This patch makes 'advice-remove' interactive to match
'ad-advice-remove'. Unlike 'ad-advice-remove', 'advice-remove' works
with new-style advice as well.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-advice-remove-interactive.patch --]
[-- Type: text/x-patch, Size: 1528 bytes --]

From 41de95097d3e79967f4fbb417aba424e8ffce058 Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@stebalien.com>
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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-01-06 16:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-29 19:57 bug#68114: [PATCH] Make 'advice-remove' interactive Steven Allen
2023-12-29 20:12 ` Eli Zaretskii
2023-12-29 20:47   ` Steven Allen
2023-12-29 21:20     ` Stefan Kangas
2023-12-29 22:43       ` Steven Allen
2023-12-30  5:06     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-30 16:22       ` Steven Allen
2023-12-30  6:45     ` Eli Zaretskii
2023-12-30 16:37       ` Steven Allen
2024-01-06  9:02         ` Eli Zaretskii
2024-01-06 16:48         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.