From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: debugger-toggle-locals
Date: Sun, 01 Dec 2013 17:47:31 -0500 [thread overview]
Message-ID: <jwviov842xk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m2r4a7ts0i.fsf@gmail.com> (Helmut Eller's message of "Sat, 23 Nov 2013 09:57:17 +0100")
> x: 9
> y: 114
> z: (9 . 114)
Nitpick: I'd rather have "x=" instead of "x:" (for me, ":" means "has type").
> +(defun debugger--backtrace-base ()
> + "Return the function name that marks the top of the backtrace.
> +See `backtrace-frame'."
> + (cond ((eq 'debug--implement-debug-on-entry
> + (cadr (backtrace-frame 1 'debug)))
> + 'debug--implement-debug-on-entry)
> + (t 'debug)))
Please use it in debugger-eval-expression as well.
> +(defun debugger--locals-visible-p ()
> + "Are the local variables of the current stack frame visible?"
> + (save-excursion
> + (move-to-column 2)
> + (get-text-property (point) 'debugger-locals-visible-p)))
The text property shouldn't have a name that ends in `-p'; these names
are for predicates (i.e. functions returning a boolean), not for
variables or object fields, or symbol/text properties.
> + (dolist (s+v locals)
> + (let ((symbol (car s+v))
> + (value (cdr s+v))
You can use (pcase-dolist (`(,symbol . ,value) locals) ...).
> + (cond ((string= (symbol-name symbol) "internal-interpreter-environment")
> + (cond ((or (null value)
> + (and (null (cdr value))
> + (symbol (car value))))
^^^^^^
should be `symbolp', right?
`value' can also be of the form (a b t).
I.e. (null (cdr value)) is false, but there are no values.
But I tend to think that the handling of
internal-interpreter-environment should be kept in the C code: this
symbol should by and large not be exported to Elisp.
> + backtrace_eval_unrewind (distance);
[...]
> + /* restore values from specpdl to orignal place */
> + backtrace_eval_unrewind (-distance);
It's kind of annoying that we have to modify the backtrace in order to
build the result, since the function is otherwise side-effect-free.
It's admittedly simpler to do it as above rather than "doing it right".
Stefan
next prev parent reply other threads:[~2013-12-01 22:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-23 8:57 debugger-toggle-locals Helmut Eller
2013-11-24 14:13 ` debugger-toggle-locals Stefan Monnier
2013-12-01 22:47 ` Stefan Monnier [this message]
2013-12-02 11:04 ` debugger-toggle-locals Helmut Eller
2013-12-02 14:46 ` debugger-toggle-locals 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwviov842xk.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=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 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).