diff options
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index ad8dddf0b33..893c821f086 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -3460,27 +3460,36 @@ canceled the first time the function is entered." | |||
| 3460 | 3460 | ||
| 3461 | (defalias 'edebug-cancel-edebug-on-entry #'cancel-edebug-on-entry) | 3461 | (defalias 'edebug-cancel-edebug-on-entry #'cancel-edebug-on-entry) |
| 3462 | 3462 | ||
| 3463 | (defun edebug--edebug-on-entry-functions () | ||
| 3464 | (let ((functions nil)) | ||
| 3465 | (mapatoms | ||
| 3466 | (lambda (symbol) | ||
| 3467 | (when (and (fboundp symbol) | ||
| 3468 | (get symbol 'edebug-on-entry)) | ||
| 3469 | (push symbol functions))) | ||
| 3470 | obarray) | ||
| 3471 | functions)) | ||
| 3472 | |||
| 3463 | (defun cancel-edebug-on-entry (function) | 3473 | (defun cancel-edebug-on-entry (function) |
| 3464 | "Cause Edebug to not stop when FUNCTION is called. | 3474 | "Cause Edebug to not stop when FUNCTION is called. |
| 3465 | The removes the effect of `edebug-on-entry'." | 3475 | The removes the effect of `edebug-on-entry'. If FUNCTION is is |
| 3476 | nil, remove `edebug-on-entry' on all functions." | ||
| 3466 | (interactive | 3477 | (interactive |
| 3467 | (list (let ((name (completing-read | 3478 | (list (let ((name (completing-read |
| 3468 | "Cancel edebug on entry to: " | 3479 | "Cancel edebug on entry to (default all functions): " |
| 3469 | (let ((functions nil)) | 3480 | (let ((functions (edebug--edebug-on-entry-functions))) |
| 3470 | (mapatoms | ||
| 3471 | (lambda (symbol) | ||
| 3472 | (when (and (fboundp symbol) | ||
| 3473 | (get symbol 'edebug-on-entry)) | ||
| 3474 | (push symbol functions))) | ||
| 3475 | obarray) | ||
| 3476 | (unless functions | 3481 | (unless functions |
| 3477 | (user-error "No functions have `edebug-on-entry'")) | 3482 | (user-error "No functions have `edebug-on-entry'")) |
| 3478 | functions)))) | 3483 | functions)))) |
| 3479 | (when (and name | 3484 | (when (and name |
| 3480 | (not (equal name ""))) | 3485 | (not (equal name ""))) |
| 3481 | (intern name))))) | 3486 | (intern name))))) |
| 3482 | (put function 'edebug-on-entry nil)) | 3487 | (unless function |
| 3483 | 3488 | (message "Removing `edebug-on-entry' from all functions.")) | |
| 3489 | (dolist (function (if function | ||
| 3490 | (list function) | ||
| 3491 | (edebug--edebug-on-entry-functions))) | ||
| 3492 | (put function 'edebug-on-entry nil))) | ||
| 3484 | 3493 | ||
| 3485 | '(advice-add 'debug-on-entry :around 'edebug--debug-on-entry) ;; Should we do this? | 3494 | '(advice-add 'debug-on-entry :around 'edebug--debug-on-entry) ;; Should we do this? |
| 3486 | ;; Also need edebug-cancel-debug-on-entry | 3495 | ;; Also need edebug-cancel-debug-on-entry |