emacs-devel
[Top][All Lists]
Advanced

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

Re: How to highlight the offending line of code with edebug


From: Davin Pearson
Subject: Re: How to highlight the offending line of code with edebug
Date: Tue, 3 Jan 2023 11:11:20 +1300

;; 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"

reply via email to

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