unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Davin Pearson <davin.pearson@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: mwd@md5i.com, emacs-devel@gnu.org
Subject: Re: How to highlight the offending line of code with edebug
Date: Mon, 2 Jan 2023 13:27:08 +1300	[thread overview]
Message-ID: <CAG9ihEt4tQjwrakzqo42u40ohMtv31UMr5djkzGW8+GXEtZ-3Q@mail.gmail.com> (raw)
In-Reply-To: <83bknq2vrk.fsf@gnu.org>

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

(progn
  (setq edebug-eval-top-level-form t)
  (setq edebug-all-defs t)
  (setq edebug-all-forms t)
  (setq edebug-on-error t))

(defun smegulator ()
  void-variable-smeg
  )

;;(smegulator)

(defmacro dmp-quote (&rest rest)
  t)

(dmp-quote

When I put the following code at the start of
my .emacs file it executes without errors as
it should.

However when I evaluate (smegulator) it brings
up the following message, without a black triangle

elisp--eval-last-sexp: Symbol’s value as variable is void:
void-variable-smeg

When I execute C-u C-M-x on (defun smegulator () void-variable-smeg)
it brings up the following messages.

edebug-after: Symbol’s value as variable is void: void-variable-smeg

elisp--eval-last-sexp: Symbol’s value as variable is void:
void-variable-smeg
with a black triangle indicating we are in edebug mode.

How do I get the black triangle online in other files for debugging my code?

i.e. how do you get Emacs to do a C-u C-M-x on every defun  without doing
it manually C-u C-M-x for every function one at a time?

)
*Davin.*


On Tue, 27 Dec 2022 at 01:29, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Davin Pearson <davin.pearson@gmail.com>
> > Date: Mon, 26 Dec 2022 13:54:39 +1300
> > Cc: Michael Welsh Duggan <mwd@md5i.com>, emacs-devel@gnu.org
> >
> > Consider the following code:
> >
> > (progn
> >   (defun foo ()
> >     tomcat
> >     )
> >   (defun bar ()
> >     (foo))
> >   )
> >
> > (bar)
> >
> > When I instrument the foo and bar defuns for debugging by
> > entering the command C-u M-C-x over the (progn ...) sexp and
> > pressing the "n" key it comes with a black triangle next to
> > tomcat, thus indicating that we are stepping through the foo
> > function which is what I want.
> >
> > The error message is this:
> >
> > edebug-after: Symbol’s value as variable is void: tomcat
> >
> > This is all good.  What I need to know is how to instrument every
> > function for debugging.  I tried the following command at
> > the top of my ~/.emacs file:
> >
> > (progn
> >   (setq edebug-on-error t)
> >   (setq edebug-all-defs t))
> >
> > When I put the above foo/bar/tomcat code in another file and I
> > try to instrument the foo and bar methods for debugging, again
> > with C-u M-C-x it comes back with the following error:
> >
> > bar: Symbol’s value as variable is void: tomcat
> >
> > Note that there is no black triangle next to the tomcat sexp,
> > indicating we are using the debug module and not the edebug
> > module, which is not what I want.
> >
> > How do I get every function marked as instrumented?
>
> According to the manual:
>
>      If ‘edebug-all-defs’ is non-‘nil’, then the commands ‘eval-region’,
>   ‘eval-current-buffer’, and ‘eval-buffer’ also instrument any definitions
>   they evaluate.  Similarly, ‘edebug-all-forms’ controls whether
>   ‘eval-region’ should instrument _any_ form, even non-defining forms.
>   This doesn’t apply to loading or evaluations in the minibuffer.  The
>   command ‘M-x edebug-all-forms’ toggles this option.
>
>      Another command, ‘M-x edebug-eval-top-level-form’, is available to
>   instrument any top-level form regardless of the values of
>   ‘edebug-all-defs’ and ‘edebug-all-forms’.  ‘edebug-defun’ is an alias
>   for ‘edebug-eval-top-level-form’.
>
> I think this answers your questions.
>

[-- Attachment #2: Type: text/html, Size: 4465 bytes --]

  reply	other threads:[~2023-01-02  0:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 21:09 How to highlight the offending line of code with edebug Davin Pearson
2022-12-22 21:13 ` Davin Pearson
2022-12-23  7:20   ` Eli Zaretskii
2022-12-23  7:36     ` Michael Welsh Duggan
2022-12-23  8:39       ` Eli Zaretskii
2022-12-26  0:54         ` Davin Pearson
2022-12-26 12:29           ` Eli Zaretskii
2023-01-02  0:27             ` Davin Pearson [this message]
2023-01-02 11:57               ` Eli Zaretskii
2023-01-02 22:11                 ` Davin Pearson

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=CAG9ihEt4tQjwrakzqo42u40ohMtv31UMr5djkzGW8+GXEtZ-3Q@mail.gmail.com \
    --to=davin.pearson@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mwd@md5i.com \
    /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).