changeset 76298:872a30c0f872

(edebug-kill-buffer): New function. (edebug-mode): Add the hook. (edebug-recursive-edit): Remove the hook on exiting.
author Richard M. Stallman <rms@gnu.org>
date Sun, 04 Mar 2007 17:53:03 +0000
parents 35a8988b02f7
children 08cc2843c940
files lisp/emacs-lisp/edebug.el
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/edebug.el	Sun Mar 04 17:50:46 2007 +0000
+++ b/lisp/emacs-lisp/edebug.el	Sun Mar 04 17:53:03 2007 +0000
@@ -2939,6 +2939,7 @@
 		      (edebug-overlay-arrow))
 		  (setq buffer-read-only edebug-buffer-read-only)
 		  (use-local-map edebug-outside-map)
+		  (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t)
 		  )
 	      ;; gotta have a buffer to let its buffer local variables be set
 	      (get-buffer-create " bogus edebug buffer"))
@@ -3942,8 +3943,18 @@
 edebug-unwrap-results
 edebug-global-break-condition
 "
+  ;; If the user kills the buffer in which edebug is currently active,
+  ;; exit to top level, because the edebug command loop can't usefully
+  ;; continue running in such a case.
+  (add-hook 'kill-buffer-hook 'edebug-kill-buffer nil t)
   (use-local-map edebug-mode-map))
 
+(defun edebug-kill-buffer ()
+  "Used on `kill-buffer-hook' when Edebug is operating in a buffer of Lisp code."
+  (let (kill-buffer-hook)
+    (kill-buffer (current-buffer)))
+  (top-level))
+
 ;;; edebug eval list mode
 
 ;; A list of expressions and their evaluations is displayed in *edebug*.