[slime-devel] Patch: show the current debug level in the REPL

Thomas F. Burdick tfb at OCF.Berkeley.EDU
Wed Jun 30 04:45:02 UTC 2004


Below is a patch to show the current debug level in the REPL, when it's > 0

Index: ChangeLog
===================================================================
RCS file: /project/slime/cvsroot/slime/ChangeLog,v
retrieving revision 1.443
diff -u -F^(def -r1.443 ChangeLog
--- ChangeLog	29 Jun 2004 22:07:00 -0000	1.443
+++ ChangeLog	30 Jun 2004 04:23:33 -0000
@@ -1,3 +1,10 @@
+2004-06-29  Thomas Burdick  <tfb at OCF.Berkeley.EDU>
+
+	* slime.el: Indicate when the REPL is in the debugger's context
+	(slime-debug-level): new connection var
+	(slime-dispatch-event): set slime-debug-level to match *sldb-level*
+	(slime-repl-insert-prompt): show debug-level in prompt when > 0 
+
 2004-06-30  Luke Gorrie  <luke at bluetail.com>
 
	* NEWS: Wrote preliminary release notes for alpha-1.
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.346
diff -u -F^(def -r1.346 slime.el
--- slime.el	29 Jun 2004 20:17:05 -0000	1.346
+++ slime.el	30 Jun 2004 04:23:46 -0000
@@ -1561,6 +1561,9 @@ (defmacro slime-def-connection-var (varn
 (slime-def-connection-var slime-use-sigint-for-interrupt nil
   "If non-nil use a SIGINT for interrupting.")
 
+(slime-def-connection-var slime-debug-level 0
+  "The current level of recursive debugging.")
+
 
 
 ;; XXX pending continuations are not removed if Lisp crashes.
@@ -1602,9 +1605,11 @@ (defun slime-dispatch-event (event &opti
        (sldb-activate thread level))
       ((:debug thread level condition restarts frames)
        (assert thread)
+       (setf (slime-debug-level) level)
        (sldb-setup thread level condition restarts frames))
       ((:debug-return thread level)
        (assert thread)
+       (setf (slime-debug-level) (1- level))
        (sldb-exit thread level))
       ((:emacs-interrupt thread)
        (cond ((slime-use-sigint-for-interrupt) (slime-send-sigint))
@@ -2168,7 +2173,9 @@ (defun slime-repl-insert-prompt (result 
     (slime-insert-propertized '(face slime-repl-result-face) result)
     (unless (bolp) (insert "\n"))
     (let ((prompt-start (point))
-          (prompt (format "%s> "  (slime-lisp-package))))
+          (prompt (if (> (slime-debug-level) 0)
+                      (format "%s [%d]> " (slime-lisp-package) (slime-debug-level))
+                      (format "%s> "  (slime-lisp-package)))))
       (slime-propertize-region
           '(face slime-repl-prompt-face
                  read-only t




More information about the slime-devel mailing list