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: Tue, 3 Jan 2023 11:11:20 +1300	[thread overview]
Message-ID: <CAG9ihEt4mEWd0RRw0QQGu0qm3V6U7TVpRhVr8tfZt7Nf6-zBEg@mail.gmail.com> (raw)
In-Reply-To: <837cy52lp9.fsf@gnu.org>

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

;; I am trying to instrument all functions in all of my *.el files
;; but I am running into grief Getting *Debugging*

;; Please consider the following code that belongs at the top of the
;; file: ~/.emacs:

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

(progn
  (require 'debug)
  (require 'edebug)
  ;;(setq debug-on-error nil)
  (setq edebug-all-defs t)
  (setq edebug-all-forms t)
  (setq edebug-on-error t)
  (edebug-eval-top-level-form) ;; <-- bug in my earlier code is a function
not a variable
  )

(defun smegulator ()
  smegulator-void-var
  )

;;(smegulator) ;; NOTE: commented for later evaluation

(dmp-quote
 ;; NOTE: strictly for Davin's use...
 (progn
   (load-file "~/dlisp/custom-set-faces.el")
   (setq load-path (cons "~/dlisp/jtw-start/" load-path))
   (require 'dmp-safe--require)
   )
 )

(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
in the *Backtrace* buffer:

Debugger entered--Lisp error: (void-function smegulator)
  (smegulator)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

without a black triangle indicating we are not in the edebug
*Debugging* When I put the cursor inside (defun smegulator ()
smegulator-void-var) and evaluate C-M-x it comes back with the
following error, again without a black triangle so edebug mode is
not activated.

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

again without a black triangle indicating the edebug mode is not activated

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

Sometimes when I evaluate M-C-x or C-u M-C-x it brings up a
black triangle indicating we are entering edebug mode, but the
correct behaviour is pretty much a hit and miss affair.


)


*Davin.*


On Tue, 3 Jan 2023 at 00:57, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Davin Pearson <davin.pearson@gmail.com>
> > Date: Mon, 2 Jan 2023 13:27:08 +1300
> > Cc: mwd@md5i.com, emacs-devel@gnu.org
> >
> > (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?
>
> According to the manual, you should do the following, in the order
> shown:
>
>   . set edebug-all-forms to a non-nil value
>   . mark the region around your code
>   . type "M-x eval-region RET"
>

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

      reply	other threads:[~2023-01-02 22:11 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
2023-01-02 11:57               ` Eli Zaretskii
2023-01-02 22:11                 ` Davin Pearson [this message]

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=CAG9ihEt4mEWd0RRw0QQGu0qm3V6U7TVpRhVr8tfZt7Nf6-zBEg@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).