diff options
| author | Lars Ingebrigtsen | 2019-11-14 06:19:59 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-11-14 06:20:04 +0100 |
| commit | d9ea77af4cbbc4826200ef712a93592320978f15 (patch) | |
| tree | c85e4ef1ce7f3163d925149d5cd1145b328aacfc | |
| parent | 1d189843bb2a4f23dc269314d5e6dfb4f9fe801e (diff) | |
| download | emacs-d9ea77af4cbbc4826200ef712a93592320978f15.tar.gz 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).
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 48 |
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." | |||
| 4571 | ;; Continue standard unloading. | 4571 | ;; Continue standard unloading. |
| 4572 | nil) | 4572 | nil) |
| 4573 | 4573 | ||
| 4574 | (defun edebug-remove-instrumentation () | 4574 | (defun edebug-remove-instrumentation (functions) |
| 4575 | "Remove Edebug instrumentation from all functions." | 4575 | "Remove Edebug instrumentation from FUNCTIONS. |
| 4576 | (interactive) | 4576 | Interactively, the user is prompted for the function to remove |
| 4577 | (let ((functions nil)) | 4577 | instrumentation for, defaulting to all functions." |
| 4578 | (mapatoms | 4578 | (interactive |
| 4579 | (lambda (symbol) | 4579 | (list |
| 4580 | (when (and (functionp symbol) | 4580 | (let ((functions nil)) |
| 4581 | (get symbol 'edebug)) | 4581 | (mapatoms |
| 4582 | (let ((unwrapped (edebug-unwrap* (symbol-function symbol)))) | 4582 | (lambda (symbol) |
| 4583 | (unless (equal unwrapped (symbol-function symbol)) | 4583 | (when (and (functionp symbol) |
| 4584 | (push symbol functions) | 4584 | (get symbol 'edebug)) |
| 4585 | (setf (symbol-function symbol) unwrapped))))) | 4585 | (let ((unwrapped (edebug-unwrap* (symbol-function symbol)))) |
| 4586 | obarray) | 4586 | (unless (equal unwrapped (symbol-function symbol)) |
| 4587 | (if (not functions) | 4587 | (push symbol functions))))) |
| 4588 | (message "Found no functions to remove instrumentation from") | 4588 | obarray) |
| 4589 | (message "Remove edebug instrumentation from %s" | 4589 | (unless functions |
| 4590 | (mapconcat #'symbol-name functions ", "))))) | 4590 | (error "Found no functions to remove instrumentation from")) |
| 4591 | (let ((name | ||
| 4592 | (completing-read | ||
| 4593 | "Remove instrumentation from (default all functions): " | ||
| 4594 | functions))) | ||
| 4595 | (if (and name | ||
| 4596 | (not (equal name ""))) | ||
| 4597 | (list (intern name)) | ||
| 4598 | functions))))) | ||
| 4599 | ;; Remove instrumentation. | ||
| 4600 | (dolist (symbol functions) | ||
| 4601 | (setf (symbol-function symbol) | ||
| 4602 | (edebug-unwrap* (symbol-function symbol)))) | ||
| 4603 | (message "Removed edebug instrumentation from %s" | ||
| 4604 | (mapconcat #'symbol-name functions ", "))) | ||
| 4591 | 4605 | ||
| 4592 | (provide 'edebug) | 4606 | (provide 'edebug) |
| 4593 | ;;; edebug.el ends here | 4607 | ;;; edebug.el ends here |