unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>,
	Lars Ingebrigtsen <larsi@gnus.org>
Cc: "3466@debbugs.gnu.org" <3466@debbugs.gnu.org>
Subject: bug#3466: 23.0.94; have `d' in debugger treat macro expansion like `c' does
Date: Thu, 20 Oct 2022 16:04:04 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488994C5911BE60315B9735F32A9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87h6zz2qtf.fsf_-_@web.de>

> > (defun foo () (dotimes (i 2) (message "foo")))
> >
> > and `M-x debug-on-entry' on foo, `M-: (foo)', just hitting `d' a lot
> > does what I'd expect -- stepping through all the code.  It does not seem
> > to step the through the macro expansion itself.  (At least not in Emacs
> > 27.1 or 28.)
> 
> I also don't understand what Drew writes.  Especially why c would do
> something that a repeated d would not get you to, sooner or later.

Nothing in the enhancement request suggested that `c'
does anything that repeated `d' won't do.  The point
was to (optionally) have some particular repetitions
of `d' be handled like `c': skip over the need to
repeat `d' for those cases.  Which cases: macro
expansions.

> Drew, did you bind c to something else?  Or had your code been loaded
> under some special conditions?  Normally what the debugger steps through
> doesn't contain macro calls - even for uncompiled code and even for the
> dynamically binding dialect.  So unless you were debugging quoted
> lambdas, I'm ... confused.

I appreciate the attention to the bug report, but it
was reported 14 years ago.  Well, let's see.

I think the point of the enhancement request was to
optionally be able to have `d' in the debugger act
like `c' when a macro is encountered - only to expand
the macro, not to evaluate the result of expansion.
More precisely, act like `c' when the macro expression
to be expanded would be shown.

`dolist' is a macro.  In Emacs 23 (which is when the
request was filed), you see this, if you use
(debug-on-entry 'foo), for this code:

(setq xs '((1 2) 42 (a b c)))
(defun foo ()
  (dolist (x xs)
    (message "%S" x)))

Debugger entered--entering a function:
* append(((message "%S" x)) ((setq --dolist-tail-- (cdr --dolist-tail--))))
* #[(spec &rest body) ...
* (dolist (x xs) (message "%S" x))
* foo()
  eval((foo))
  eval-expression((foo) nil)
  call-interactively(eval-expression)

The point was to (be able to, optionally) have `d' on
the #[(spec &rest body) ... line (not the `dolist'
line) act like `c' there - immediately giving the
result of its expansion.

Now, in more recent versions of Emacs you don't see
the (dolist...) line at all; you directly see `while'
instead:

Debugger entered--beginning evaluation of function call form:
* (while --dolist-tail-- ...
* (let ((--dolist-tail-- xs) x) (while --dolist-tail...
* (lambda nil (let ((--dolist-tail-- xs) x) (while --dolist-tail...
* apply((lambda nil (let ((--dolist-tail-- xs) x) (while --dolist-tail--...
* foo()
  eval((foo) t)
  eval-expression((foo) nil nil 127)
  funcall-interactively(eval-expression (foo) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

That's fine.  Emacs was enhanced as requested.





  reply	other threads:[~2022-10-20 16:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03 21:44 bug#3466: 23.0.94; have `d' in debugger treat macro expansion like `c' does Drew Adams
2021-06-03 10:04 ` Lars Ingebrigtsen
2021-06-03 15:01   ` bug#3466: [External] : " Drew Adams
2021-06-04  9:22     ` Lars Ingebrigtsen
2022-10-20  2:04       ` Michael Heerdegen
2022-10-20 16:04         ` Drew Adams [this message]
2022-10-20 20:38           ` Michael Heerdegen

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=SJ0PR10MB5488994C5911BE60315B9735F32A9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=3466@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    /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).