emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d9ea77a: Allow using edebug-remove-instrumentation more fine-grai


From: Lars Ingebrigtsen
Subject: master d9ea77a: Allow using edebug-remove-instrumentation more fine-grained
Date: Thu, 14 Nov 2019 00:20:09 -0500 (EST)

branch: master
commit d9ea77af4cbbc4826200ef712a93592320978f15
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Allow using edebug-remove-instrumentation more fine-grained
    
    * lisp/emacs-lisp/edebug.el (edebug-remove-instrumentation):
    Prompt the user for what functions to remove instrumentation from
    a la cancel-edebug-on-entry (bug#38195).
---
 lisp/emacs-lisp/edebug.el | 48 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 17 deletions(-)

diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index d810523..6b55d7c 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -4571,23 +4571,37 @@ With prefix argument, make it a temporary breakpoint."
   ;; Continue standard unloading.
   nil)
 
-(defun edebug-remove-instrumentation ()
-  "Remove Edebug instrumentation from all functions."
-  (interactive)
-  (let ((functions nil))
-    (mapatoms
-     (lambda (symbol)
-       (when (and (functionp symbol)
-                  (get symbol 'edebug))
-         (let ((unwrapped (edebug-unwrap* (symbol-function symbol))))
-           (unless (equal unwrapped (symbol-function symbol))
-             (push symbol functions)
-             (setf (symbol-function symbol) unwrapped)))))
-     obarray)
-    (if (not functions)
-        (message "Found no functions to remove instrumentation from")
-      (message "Remove edebug instrumentation from %s"
-               (mapconcat #'symbol-name functions ", ")))))
+(defun edebug-remove-instrumentation (functions)
+  "Remove Edebug instrumentation from FUNCTIONS.
+Interactively, the user is prompted for the function to remove
+instrumentation for, defaulting to all functions."
+  (interactive
+   (list
+    (let ((functions nil))
+      (mapatoms
+       (lambda (symbol)
+         (when (and (functionp symbol)
+                    (get symbol 'edebug))
+           (let ((unwrapped (edebug-unwrap* (symbol-function symbol))))
+             (unless (equal unwrapped (symbol-function symbol))
+               (push symbol functions)))))
+       obarray)
+      (unless functions
+        (error "Found no functions to remove instrumentation from"))
+      (let ((name
+             (completing-read
+              "Remove instrumentation from (default all functions): "
+              functions)))
+        (if (and name
+                 (not (equal name "")))
+            (list (intern name))
+          functions)))))
+  ;; Remove instrumentation.
+  (dolist (symbol functions)
+    (setf (symbol-function symbol)
+          (edebug-unwrap* (symbol-function symbol))))
+  (message "Removed edebug instrumentation from %s"
+           (mapconcat #'symbol-name functions ", ")))
 
 (provide 'edebug)
 ;;; edebug.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]