changeset 63157:4a4691a3100d

(debugger-will-be-back): New var. (debug): Use it. (debugger-step-through, debugger-continue, debugger-jump) (debugger-return-value): Set it when needed. (debugger-make-xrefs, debugger-frame, debugger-frame-clear): Use inhibit-read-only.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 09 Jun 2005 03:09:30 +0000
parents 356a4e78a1e4
children 0c1cf4d7cbaf
files lisp/emacs-lisp/debug.el
diffstat 1 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/debug.el	Thu Jun 09 01:41:23 2005 +0000
+++ b/lisp/emacs-lisp/debug.el	Thu Jun 09 03:09:30 2005 +0000
@@ -88,6 +88,8 @@
 (defvar debugger-outer-standard-output)
 (defvar debugger-outer-inhibit-redisplay)
 (defvar debugger-outer-cursor-in-echo-area)
+(defvar debugger-will-be-back nil
+  "Non-nil if we expect to get back in the debugger soon.")
 
 (defvar inhibit-debug-on-entry nil
   "Non-nil means that debug-on-entry is disabled.")
@@ -123,6 +125,7 @@
 			     (get-buffer-create "*Backtrace*")))
 	  (debugger-old-buffer (current-buffer))
 	  (debugger-step-after-exit nil)
+          (debugger-will-be-back nil)
 	  ;; Don't keep reading from an executing kbd macro!
 	  (executing-kbd-macro nil)
 	  ;; Save the outer values of these vars for the `e' command
@@ -218,13 +221,13 @@
 		(fundamental-mode)
 		(with-selected-window (get-buffer-window debugger-buffer 0)
                   (when (and (window-dedicated-p (selected-window))
-                             (not debugger-step-after-exit))
+                             (not debugger-will-be-back))
                     ;; If the window is not dedicated, burying the buffer
                     ;; will mean that the frame created for it is left
                     ;; around showing some random buffer, and next time we
                     ;; pop to the debugger buffer we'll create yet
                     ;; another frame.
-                    ;; If debugger-step-after-exit is non-nil, the frame
+                    ;; If debugger-will-be-back is non-nil, the frame
                     ;; would need to be de-iconified anyway immediately
                     ;; after when we re-enter the debugger, so iconifying it
                     ;; here would cause flashing.
@@ -320,7 +323,7 @@
   (save-excursion
     (set-buffer (or buffer (current-buffer)))
     (setq buffer (current-buffer))
-    (let ((buffer-read-only nil)
+    (let ((inhibit-read-only t)
 	  (old-end (point-min)) (new-end (point-min)))
       ;; If we saved an old backtrace, find the common part
       ;; between the new and the old.
@@ -390,6 +393,7 @@
   (interactive)
   (setq debugger-step-after-exit t)
   (setq debugger-jumping-flag t)
+  (setq debugger-will-be-back t)
   (add-hook 'post-command-hook 'debugger-reenable)
   (message "Proceeding, will debug on next eval or call.")
   (exit-recursive-edit))
@@ -400,6 +404,12 @@
   (unless debugger-may-continue
     (error "Cannot continue"))
   (message "Continuing.")
+  (save-excursion
+    ;; Check to see if we've flagged some frame for debug-on-exit, in which
+    ;; case we'll probably come back to the debugger soon.
+    (goto-char (point-min))
+    (if (re-search-forward "^\\* " nil t)
+        (setq debugger-will-be-back t)))
   (exit-recursive-edit))
 
 (defun debugger-return-value (val)
@@ -410,6 +420,12 @@
   (setq debugger-value val)
   (princ "Returning " t)
   (prin1 debugger-value)
+  (save-excursion
+    ;; Check to see if we've flagged some frame for debug-on-exit, in which
+    ;; case we'll probably come back to the debugger soon.
+    (goto-char (point-min))
+    (if (re-search-forward "^\\* " nil t)
+        (setq debugger-will-be-back t)))
   (exit-recursive-edit))
 
 (defun debugger-jump ()
@@ -419,6 +435,7 @@
   (setq debugger-jumping-flag t)
   (add-hook 'post-command-hook 'debugger-reenable)
   (message "Continuing through this frame")
+  (setq debugger-will-be-back t)
   (exit-recursive-edit))
 
 (defun debugger-reenable ()
@@ -467,7 +484,7 @@
   (beginning-of-line)
   (backtrace-debug (debugger-frame-number) t)
   (if (= (following-char) ? )
-      (let ((buffer-read-only nil))
+      (let ((inhibit-read-only t))
 	(delete-char 1)
 	(insert ?*)))
   (beginning-of-line))
@@ -483,7 +500,7 @@
   (beginning-of-line)
   (backtrace-debug (debugger-frame-number) nil)
   (if (= (following-char) ?*)
-      (let ((buffer-read-only nil))
+      (let ((inhibit-read-only t))
 	(delete-char 1)
 	(insert ? )))
   (beginning-of-line))