From: Helmut Eller <eller.helmut@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Debugging functions with lexical-binding
Date: Tue, 31 May 2011 09:11:11 +0200 [thread overview]
Message-ID: <m2boyjjqeo.fsf@gmail.com> (raw)
In-Reply-To: jwv62os4yor.fsf-monnier+emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 564 bytes --]
* Stefan Monnier [2011-05-30 04:13] writes:
>> What are the commands to inspect local variables of lexical functions?
>
> M-x esp RET
That's too cryptic for me. What do you mean?
>> Pressing C-M-c reduces one level of recursive edit but puts the
>> *Backtrace* buffer in fundamental-mode which is IMO also wrong.]
>
> Yup, the *Backtrace* buffer's content and major-mode are not properly
> saved&restored upon entry to and exit from the debugger. Patch welcome,
Below is a simple patch. It only restores the content but not buffer
local variables.
Helmut
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: debug.patch --]
[-- Type: text/x-diff, Size: 1688 bytes --]
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2011-05-30 12:23:56 +0000
+++ lisp/ChangeLog 2011-05-31 07:08:41 +0000
@@ -1,3 +1,11 @@
+2011-05-31 Helmut Eller <eller.helmut@gmail.com>
+
+ Try to deal with recursive debuggers and C-M-c.
+
+ * debug.el (debug): Restore the previous content of the
+ *Backtrace* buffer when we exit with C-M-c. Restoring buffer
+ local variables would be annoyingly difficult.
+
2011-05-30 Leo Liu <sdl.web@gmail.com>
* net/rcirc.el (rcirc-debug-buffer): Use visible buffer name.
=== modified file 'lisp/emacs-lisp/debug.el'
--- lisp/emacs-lisp/debug.el 2011-03-20 03:53:45 +0000
+++ lisp/emacs-lisp/debug.el 2011-05-31 06:45:28 +0000
@@ -120,6 +120,7 @@
(debug-on-quit nil)
(debugger-buffer (get-buffer-create "*Backtrace*"))
(debugger-old-buffer (current-buffer))
+ (debugger-previous-contents nil)
(debugger-step-after-exit nil)
(debugger-will-be-back nil)
;; Don't keep reading from an executing kbd macro!
@@ -181,6 +182,7 @@
(when (eq 'lambda (car-safe (cadr (backtrace-frame 4))))
(backtrace-debug 5 t)))
(pop-to-buffer debugger-buffer)
+ (setq debugger-previous-contents (buffer-string))
(debugger-mode)
(debugger-setup-buffer debugger-args)
(when noninteractive
@@ -215,7 +217,7 @@
;; erase it (and maybe hide it) but keep it alive.
(with-current-buffer debugger-buffer
(erase-buffer)
- (fundamental-mode)
+ (insert debugger-previous-contents)
(with-selected-window (get-buffer-window debugger-buffer 0)
(when (and (window-dedicated-p (selected-window))
(not debugger-will-be-back))
next prev parent reply other threads:[~2011-05-31 7:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-28 13:50 Debugging functions with lexical-binding Helmut Eller
2011-05-30 4:13 ` Stefan Monnier
2011-05-31 7:11 ` Helmut Eller [this message]
2011-05-31 15:25 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2boyjjqeo.fsf@gmail.com \
--to=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.