unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* kill-buffer during *debugging*
@ 2007-02-15 10:31 A Soare
  2007-02-17 20:57 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: A Soare @ 2007-02-15 10:31 UTC (permalink / raw)
  To: Emacs   Dev  [emacs-devel]

[-- Attachment #1: Type: text/plain, Size: 3971 bytes --]

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:anonymous@cvs.gnu.org:/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 #2: /changelog --]
[-- Type: application/octet-stream, Size: 170 bytes --]

2007-02-15  Alin C. Soare  <alinsoar@voila.fr>  (tiny change)

	* lisp/emacs-lisp/edebug.el (edebug-mode-map): Added code for
	kill-buffer keybinding in *debugging* mode

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kill-buffer during *debugging*
  2007-02-15 10:31 kill-buffer during *debugging* A Soare
@ 2007-02-17 20:57 ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2007-02-17 20:57 UTC (permalink / raw)
  To: alinsoar; +Cc: emacs-devel

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

    Here is the bug. The *debugging* mode is still active.

Could you explain that more concretely?  What does it mean to say
"still active" in this case?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kill-buffer during *debugging*
@ 2007-02-18  8:56 A Soare
  2007-02-20 18:07 ` Stuart D. Herring
  0 siblings, 1 reply; 4+ messages in thread
From: A Soare @ 2007-02-18  8:56 UTC (permalink / raw)
  To: Emacs   Dev  [emacs-devel]

>     3. WITHOUT STOPPING the debugger kill the buffer using C-x k.
> 
>     Here is the bug. The *debugging* mode is still active.
> 
> Could you explain that more concretely?  What does it mean to say
> "still active" in this case?

The *debugging* mode is "still active" = If I am killing the buffer while I am debugging with edebug - that means I am killing the buffer when the *debugging* is active as a minor mode (we see minor modes in the mode line if `minor-mode-alist is set in `default-mode-line-format) -, in the MODE LINE one can still see *debugging*. So the debugging mode is still active, even if the buffer was closed.

My code from that little patch makes 2 things:

1. stop the debugger (using the (top-level), as it is used in present when pressing "q")
2. kill the buffer.

It runs "a la fois" 2 commands:

((top-level)
 (kill-buffer))

This is executed in a lambda function associated to C-x k.
Without my patch, when I press C-x k and the debugger is running, the buffer is killed, but the debugger is not stopped (is still active).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kill-buffer during *debugging*
  2007-02-18  8:56 A Soare
@ 2007-02-20 18:07 ` Stuart D. Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Stuart D. Herring @ 2007-02-20 18:07 UTC (permalink / raw)
  To: alinsoar; +Cc: emacs-devel

> The *debugging* mode is "still active" = If I am killing the buffer while
> I am debugging with edebug - that means I am killing the buffer when the
> *debugging* is active as a minor mode (we see minor modes in the mode line
> if `minor-mode-alist is set in `default-mode-line-format) -, in the MODE
> LINE one can still see *debugging*. So the debugging mode is still active,
> even if the buffer was closed.

Perhaps you want to abort the recursive edit that the debugger started
with C-]?  The debugger itself is not a mode, even though there is a
"Debugger" mode.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-20 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-15 10:31 kill-buffer during *debugging* A Soare
2007-02-17 20:57 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2007-02-18  8:56 A Soare
2007-02-20 18:07 ` Stuart D. Herring

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).