emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kill-buffer during *debugging*


From: A Soare
Subject: kill-buffer during *debugging*
Date: Thu, 15 Feb 2007 11:31:54 +0100 (CET)

Hello.

> If I kill the buffer where the lisp debugger was running, The *Debugging* 
> mode is still active on the line mode, even I press C-j.

I reported a few days ago a bug on bug.emacs list (the upper line). I have been 
asked by a few persons to report it again , using the format of a bug-report 
from etc/ directory.

Here it is:

1. instrument with edebug a lisp function. For example, this very simple 
automaton:

(defun build-automaton (s alphabet-length first-char &optional start-pos)
  "this preprocessing state builds an automaton"
  (let* ((number-of-states (1+ (length s)))
         (matrix (make-vector number-of-states nil))
         (last-state 0))
    (dotimes (i number-of-states)
      (aset matrix i (make-vector alphabet-length 0))
      (dotimes (j alphabet-length)
        (aset (aref matrix i) j (if (and (/= i (1- number-of-states))
                                          (equal (aref s i) (+ j first-char)))
                                    (1+ i)
                                  (aref (aref matrix last-state) j))))
      (if (and (/= i (1- number-of-states))
               (not (zerop i)))
          (set 'last-state (aref (aref matrix last-state) (- (aref s i)
                                                             first-char)))))
    matrix))

2. Call this function, for example like this:

(build-automaton "emacs" 27 ?a)

3. WITHOUT STOPPING the debugger kill the buffer using C-x k.

Here is the bug. The *debugging* mode is still active. More, if I want to debug 
another instrumented function, impossible. We must run by hand M-: (top-level) 
to come back normally to command-loop.

---------------------------------

I tried first this code in lisp/emacs-lisp/edebug.el:

    (define-key map "\C-xk" (lambda ()
                              (interactive)
                              (unwind-protect (top-level)
                               (kill-buffer (current-buffer)))))

But this code does not work here. Can somebody explain me why, please? I do  
not understant why:

Debugger entered: nil
  edebug-display()
  edebug(error (error "Selecting deleted buffer"))
  signal(error ("Selecting deleted buffer"))
  edebug-signal(error ("Selecting deleted buffer"))

----------------------

Quand j'ai eu essayé cette possibilité et vu que ça ne roule pas, il vallait le 
mieux que je demande sur help.emacs list. Il y a quelqu'un qui m'a repondu. Son 
code marche. Donc voici ci-dessous:

1. the output from cvs -d:pserver:address@hidden:/sources/emacs diff -c 
emacs/lisp/emacs-lisp/edebug.el.
2. a Change-log-file attached.




###################################################################################################
Index: emacs/lisp/emacs-lisp/edebug.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/edebug.el,v
retrieving revision 3.94
diff -c -r3.94 edebug.el
*** emacs/lisp/emacs-lisp/edebug.el     21 Jan 2007 02:44:24 -0000      3.94
--- emacs/lisp/emacs-lisp/edebug.el     15 Feb 2007 10:23:13 -0000
***************
*** 3820,3825 ****
--- 3820,3833 ----
      (define-key map "Q" 'edebug-top-level-nonstop)
      (define-key map "a" 'abort-recursive-edit)
      (define-key map "S" 'edebug-stop)
+     (define-key map "\C-xk" (lambda ()
+                               (interactive)
+                               (run-with-idle-timer 0 nil
+                                                    (lambda()
+                                                      (kill-buffer
+                                                       (current-buffer))
+                                                      ))
+                               (top-level)))
  
      ;; breakpoints
      (define-key map "b" 'edebug-set-breakpoint)
########################################################################################################









Attachment: /changelog
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]