diff options
| author | Lute Kamstra | 2005-03-03 16:25:13 +0000 |
|---|---|---|
| committer | Lute Kamstra | 2005-03-03 16:25:13 +0000 |
| commit | b6b77a90686a7df0c4818ba9ac74957f95569faf (patch) | |
| tree | 38a1f022fd0434930600b0741a1e1da69969a56e | |
| parent | fa439170423ac8a827952b0e3a06f26e5e30e857 (diff) | |
| download | emacs-b6b77a90686a7df0c4818ba9ac74957f95569faf.tar.gz emacs-b6b77a90686a7df0c4818ba9ac74957f95569faf.zip | |
(inhibit-debug-on-entry): Add docstring.
(debugger-jumping-flag): New var.
(debug-entry-code): Use it.
(debugger-jump): Use debugger-jumping-flag and add debugger-reenable
to post-command-hook.
(debugger-reenable): Use debugger-jumping-flag and remove itself from
post-command-hook.
(debug, debug-on-entry, cancel-debug-on-entry): Remove call to
debugger-reenable.
| -rw-r--r-- | lisp/emacs-lisp/debug.el | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index b637ead05ee..0692b7995ea 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el | |||
| @@ -93,11 +93,19 @@ This is to optimize `debugger-make-xrefs'.") | |||
| 93 | (defvar debugger-outer-inhibit-redisplay) | 93 | (defvar debugger-outer-inhibit-redisplay) |
| 94 | (defvar debugger-outer-cursor-in-echo-area) | 94 | (defvar debugger-outer-cursor-in-echo-area) |
| 95 | 95 | ||
| 96 | (defvar inhibit-debug-on-entry nil) | 96 | (defvar inhibit-debug-on-entry nil |
| 97 | "Non-nil means that debug-on-entry is disabled.") | ||
| 98 | |||
| 99 | (defvar debugger-jumping-flag nil | ||
| 100 | "Non-nil means that debug-on-entry is disabled. | ||
| 101 | This variable is used by `debugger-jump' and `debugger-reenable'.") | ||
| 97 | 102 | ||
| 98 | ;; When you change this, you may also need to change the number of | 103 | ;; When you change this, you may also need to change the number of |
| 99 | ;; frames that the debugger skips. | 104 | ;; frames that the debugger skips. |
| 100 | (defconst debug-entry-code '(if inhibit-debug-on-entry nil (debug 'debug)) | 105 | (defconst debug-entry-code |
| 106 | '(if (or inhibit-debug-on-entry debugger-jumping-flag) | ||
| 107 | nil | ||
| 108 | (debug 'debug)) | ||
| 101 | "Code added to a function to cause it to call the debugger upon entry.") | 109 | "Code added to a function to cause it to call the debugger upon entry.") |
| 102 | 110 | ||
| 103 | ;;;###autoload | 111 | ;;;###autoload |
| @@ -197,7 +205,6 @@ first will be printed into the backtrace buffer." | |||
| 197 | ;; Skip the frames for backtrace-debug, byte-code, | 205 | ;; Skip the frames for backtrace-debug, byte-code, |
| 198 | ;; and debug-entry-code. | 206 | ;; and debug-entry-code. |
| 199 | (backtrace-debug 4 t)) | 207 | (backtrace-debug 4 t)) |
| 200 | (debugger-reenable) | ||
| 201 | (message "") | 208 | (message "") |
| 202 | (let ((standard-output nil) | 209 | (let ((standard-output nil) |
| 203 | (buffer-read-only t)) | 210 | (buffer-read-only t)) |
| @@ -406,25 +413,17 @@ will be used, such as in a debug on exit from a frame." | |||
| 406 | "Continue to exit from this frame, with all debug-on-entry suspended." | 413 | "Continue to exit from this frame, with all debug-on-entry suspended." |
| 407 | (interactive) | 414 | (interactive) |
| 408 | (debugger-frame) | 415 | (debugger-frame) |
| 409 | ;; Turn off all debug-on-entry functions | 416 | (setq debugger-jumping-flag t) |
| 410 | ;; but leave them in the list. | 417 | (add-hook 'post-command-hook 'debugger-reenable) |
| 411 | (let ((list debug-function-list)) | ||
| 412 | (while list | ||
| 413 | (fset (car list) | ||
| 414 | (debug-on-entry-1 (car list) (symbol-function (car list)) nil)) | ||
| 415 | (setq list (cdr list)))) | ||
| 416 | (message "Continuing through this frame") | 418 | (message "Continuing through this frame") |
| 417 | (exit-recursive-edit)) | 419 | (exit-recursive-edit)) |
| 418 | 420 | ||
| 419 | (defun debugger-reenable () | 421 | (defun debugger-reenable () |
| 420 | "Turn all debug-on-entry functions back on." | 422 | "Turn all debug-on-entry functions back on. |
| 421 | (let ((list debug-function-list)) | 423 | This function is put on `post-command-hook' by `debugger-jump' and |
| 422 | (while list | 424 | removes itself from that hook." |
| 423 | (or (consp (symbol-function (car list))) | 425 | (setq debugger-jumping-flag nil) |
| 424 | (debug-convert-byte-code (car list))) | 426 | (remove-hook 'post-command-hook 'debugger-reenable)) |
| 425 | (fset (car list) | ||
| 426 | (debug-on-entry-1 (car list) (symbol-function (car list)) t)) | ||
| 427 | (setq list (cdr list))))) | ||
| 428 | 427 | ||
| 429 | (defun debugger-frame-number () | 428 | (defun debugger-frame-number () |
| 430 | "Return number of frames in backtrace before the one point points at." | 429 | "Return number of frames in backtrace before the one point points at." |
| @@ -634,7 +633,6 @@ which must be written in Lisp, not predefined. | |||
| 634 | Use \\[cancel-debug-on-entry] to cancel the effect of this command. | 633 | Use \\[cancel-debug-on-entry] to cancel the effect of this command. |
| 635 | Redefining FUNCTION also cancels it." | 634 | Redefining FUNCTION also cancels it." |
| 636 | (interactive "aDebug on entry (to function): ") | 635 | (interactive "aDebug on entry (to function): ") |
| 637 | (debugger-reenable) | ||
| 638 | ;; Handle a function that has been aliased to some other function. | 636 | ;; Handle a function that has been aliased to some other function. |
| 639 | (if (and (subrp (symbol-function function)) | 637 | (if (and (subrp (symbol-function function)) |
| 640 | (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) | 638 | (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) |
| @@ -665,7 +663,6 @@ If argument is nil or an empty string, cancel for all functions." | |||
| 665 | (mapcar 'symbol-name debug-function-list) | 663 | (mapcar 'symbol-name debug-function-list) |
| 666 | nil t nil))) | 664 | nil t nil))) |
| 667 | (if name (intern name))))) | 665 | (if name (intern name))))) |
| 668 | (debugger-reenable) | ||
| 669 | (if (and function (not (string= function ""))) | 666 | (if (and function (not (string= function ""))) |
| 670 | (progn | 667 | (progn |
| 671 | (let ((f (debug-on-entry-1 function (symbol-function function) nil))) | 668 | (let ((f (debug-on-entry-1 function (symbol-function function) nil))) |