From 77932668c2ee5354465982e966cf9584cafc1d2c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 6 Jun 2005 12:29:57 +0000 Subject: [PATCH] (debugger-window): New variable. (debug): Use debugger-window if it is set and still alive. Record debugger-window for next entry. --- lisp/emacs-lisp/debug.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 2149cba8720..7d7e066b4e8 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -97,6 +97,11 @@ This is to optimize `debugger-make-xrefs'.") This variable is used by `debugger-jump', `debugger-step-through', and `debugger-reenable' to temporarily disable debug-on-entry.") +(defvar debugger-window nil + "If non-nil, the last window used by the debugger for its buffer. +The next call to the debugger reuses the same window, if it is still live. +That case would normally occur when the window is in a separate frame.") + ;;;###autoload (setq debugger 'debug) ;;;###autoload @@ -178,7 +183,13 @@ first will be printed into the backtrace buffer." ;; Place an extra debug-on-exit for macro's. (when (eq 'lambda (car-safe (cadr (backtrace-frame 4)))) (backtrace-debug 5 t))) - (pop-to-buffer debugger-buffer) + (if (and debugger-window + (window-live-p debugger-window)) + (progn + (set-window-buffer debugger-window debugger-buffer) + (select-window debugger-window)) + (pop-to-buffer debugger-buffer)) + (setq debugger-window (selected-window)) (debugger-mode) (debugger-setup-buffer debugger-args) (when noninteractive -- 2.39.5