summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-11-14 06:19:59 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2019-11-14 06:20:04 +0100
commitd9ea77af4cbbc4826200ef712a93592320978f15 (patch)
treec85e4ef1ce7f3163d925149d5cd1145b328aacfc /lisp/emacs-lisp
parent1d189843bb2a4f23dc269314d5e6dfb4f9fe801e (diff)
downloademacs-d9ea77af4cbbc4826200ef712a93592320978f15.tar.gz
emacs-d9ea77af4cbbc4826200ef712a93592320978f15.tar.bz2
emacs-d9ea77af4cbbc4826200ef712a93592320978f15.zip
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).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/edebug.el48
1 files changed, 31 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index d81052318cb..6b55d7cff03 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