1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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).
This commit is contained in:
Lars Ingebrigtsen 2019-11-14 06:19:59 +01:00
parent 1d189843bb
commit d9ea77af4c

View file

@ -4571,23 +4571,37 @@ With prefix argument, make it a temporary breakpoint."
;; Continue standard unloading. ;; Continue standard unloading.
nil) nil)
(defun edebug-remove-instrumentation () (defun edebug-remove-instrumentation (functions)
"Remove Edebug instrumentation from all functions." "Remove Edebug instrumentation from FUNCTIONS.
(interactive) Interactively, the user is prompted for the function to remove
(let ((functions nil)) instrumentation for, defaulting to all functions."
(mapatoms (interactive
(lambda (symbol) (list
(when (and (functionp symbol) (let ((functions nil))
(get symbol 'edebug)) (mapatoms
(let ((unwrapped (edebug-unwrap* (symbol-function symbol)))) (lambda (symbol)
(unless (equal unwrapped (symbol-function symbol)) (when (and (functionp symbol)
(push symbol functions) (get symbol 'edebug))
(setf (symbol-function symbol) unwrapped))))) (let ((unwrapped (edebug-unwrap* (symbol-function symbol))))
obarray) (unless (equal unwrapped (symbol-function symbol))
(if (not functions) (push symbol functions)))))
(message "Found no functions to remove instrumentation from") obarray)
(message "Remove edebug instrumentation from %s" (unless functions
(mapconcat #'symbol-name 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) (provide 'edebug)
;;; edebug.el ends here ;;; edebug.el ends here