aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-02-28 14:33:50 +0000
committerStefan Monnier2005-02-28 14:33:50 +0000
commitcf9a1b693fe26df8fedea0345270b812dbcbd6d3 (patch)
tree8b7c1da90cb24f885d6afc99456bb23d1c9c1c3e
parent340c08fe431f62d79502188e899a7b89880470aa (diff)
downloademacs-cf9a1b693fe26df8fedea0345270b812dbcbd6d3.tar.gz
emacs-cf9a1b693fe26df8fedea0345270b812dbcbd6d3.zip
(inhibit-debug-on-entry): New var.
(debug): Use it. Move the inhibit-trace earlier. (debug-entry-code): New const. (debug-on-entry-1): Use it.
-rw-r--r--lisp/emacs-lisp/debug.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 58fb3b4a1b8..06efa93f33f 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -93,6 +93,8 @@ 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)
97
96;;;###autoload 98;;;###autoload
97(setq debugger 'debug) 99(setq debugger 'debug)
98;;;###autoload 100;;;###autoload
@@ -147,6 +149,8 @@ first will be printed into the backtrace buffer."
147 (setq overriding-terminal-local-map nil) 149 (setq overriding-terminal-local-map nil)
148 ;; Don't let these magic variables affect the debugger itself. 150 ;; Don't let these magic variables affect the debugger itself.
149 (let ((last-command nil) this-command track-mouse 151 (let ((last-command nil) this-command track-mouse
152 (inhibit-trace t)
153 (inhibit-debug-on-entry t)
150 unread-command-events 154 unread-command-events
151 unread-post-input-method-events 155 unread-post-input-method-events
152 last-input-event last-command-event last-nonmenu-event 156 last-input-event last-command-event last-nonmenu-event
@@ -189,8 +193,7 @@ first will be printed into the backtrace buffer."
189 (backtrace-debug 3 t)) 193 (backtrace-debug 3 t))
190 (debugger-reenable) 194 (debugger-reenable)
191 (message "") 195 (message "")
192 (let ((inhibit-trace t) 196 (let ((standard-output nil)
193 (standard-output nil)
194 (buffer-read-only t)) 197 (buffer-read-only t))
195 (message "") 198 (message "")
196 ;; Make sure we unbind buffer-read-only in the right buffer. 199 ;; Make sure we unbind buffer-read-only in the right buffer.
@@ -691,6 +694,10 @@ If argument is nil or an empty string, cancel for all functions."
691 (setq body (cons (documentation function) body))) 694 (setq body (cons (documentation function) body)))
692 (fset function (cons 'lambda (cons (car contents) body))))))) 695 (fset function (cons 'lambda (cons (car contents) body)))))))
693 696
697
698(defconst debug-entry-code '(if inhibit-debug-on-entry nil (debug 'debug))
699 "Code added to a function to cause it to call the debugger upon entry.")
700
694(defun debug-on-entry-1 (function defn flag) 701(defun debug-on-entry-1 (function defn flag)
695 (if (subrp defn) 702 (if (subrp defn)
696 (error "%s is a built-in function" function) 703 (error "%s is a built-in function" function)
@@ -703,7 +710,7 @@ If argument is nil or an empty string, cancel for all functions."
703 (if (stringp (car tail)) (setq tail (cdr tail))) 710 (if (stringp (car tail)) (setq tail (cdr tail)))
704 ;; Skip the interactive form. 711 ;; Skip the interactive form.
705 (if (eq 'interactive (car-safe (car tail))) (setq tail (cdr tail))) 712 (if (eq 'interactive (car-safe (car tail))) (setq tail (cdr tail)))
706 (unless (eq flag (equal (car tail) '(debug 'debug))) 713 (unless (eq flag (equal (car tail) debug-entry-code))
707 ;; If the function has no body, add nil as a body element. 714 ;; If the function has no body, add nil as a body element.
708 (when (null tail) 715 (when (null tail)
709 (setq tail (list nil)) 716 (setq tail (list nil))
@@ -713,7 +720,7 @@ If argument is nil or an empty string, cancel for all functions."
713 (progn (setcar tail (cadr tail)) 720 (progn (setcar tail (cadr tail))
714 (setcdr tail (cddr tail))) 721 (setcdr tail (cddr tail)))
715 (setcdr tail (cons (car tail) (cdr tail))) 722 (setcdr tail (cons (car tail) (cdr tail)))
716 (setcar tail '(debug 'debug)))) 723 (setcar tail debug-entry-code)))
717 defn)))) 724 defn))))
718 725
719(defun debugger-list-functions () 726(defun debugger-list-functions ()