help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How do I get edebug online?


From: Eric Abrahamsen
Subject: Re: How do I get edebug online?
Date: Mon, 17 Jan 2022 14:46:17 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Davin Pearson <davin.pearson@gmail.com> writes:

> First I eval the following sexp:
>
> (setq edebug-all-defs t)
>
> Then I issue the following command on the following code which resides
> in a file called:
> ~/java-training-wheels/dlisp/coolmacs/dmp-grep--splat-file.el.
> The command is \C-\M-x.  The file contains the following defun:
>
> (defun fac (n)
>   (when (= 5 n)
>     (message "Foo bar")
>     (edebug)
>     (message "Rita Hayworth"))
>   (if (< 0 n)
>       (* n (fac (1- n)))
>     1))

You don't insert an actual call to (edebug) in your code (I didn't
actually know that was possible, and looking at the docstring it says it
works more or less like `debug', which is why you got the backtrack you
mention below).

Using `edebug-all-defs' always seemed clumsy to me, and likely to cause
an explosion of unwanted effects. I would leave that as nil, and then
just use the C-u prefix argument for C-M-x (`eval-defun'). That lets you
be much more targeted about what you instrument and what you don't.

Now, when you execute the function, edebug will halt execution right at
the beginning of the function, and hand over control to you and
keybindings like "g" and "SPC" and what have you. You don't need to
insert anything into the function definition itself.

HTH,
Eric




reply via email to

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