From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Davin Pearson Newsgroups: gmane.emacs.devel Subject: Re: How to highlight the offending line of code with edebug Date: Tue, 3 Jan 2023 11:11:20 +1300 Message-ID: References: <83fsd68u3f.fsf@gnu.org> <87ili2o9lc.fsf@md5i.com> <83zgbe7bu1.fsf@gnu.org> <83bknq2vrk.fsf@gnu.org> <837cy52lp9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001be65605f14f3c73" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39352"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mwd@md5i.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 02 23:12:37 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCT2r-000A28-Aw for ged-emacs-devel@m.gmane-mx.org; Mon, 02 Jan 2023 23:12:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCT20-0001ob-Lb; Mon, 02 Jan 2023 17:11:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCT1x-0001mn-Bz for emacs-devel@gnu.org; Mon, 02 Jan 2023 17:11:41 -0500 Original-Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pCT1v-000291-8F; Mon, 02 Jan 2023 17:11:40 -0500 Original-Received: by mail-pj1-x1029.google.com with SMTP id v23so31120633pju.3; Mon, 02 Jan 2023 14:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0yqSrVM7zLv84YsqkG//pFEm4uZogwTf0usjHmOwpcc=; b=qTKy8XA7TmRfG073b+ZIXKjH3fK6cNuDOWtZ9cTyp7GPVogmTxgyB2jDYmm38YjYtU OOll3uvKkEdJ9LDUvIktpGvj+lEhDteQkKQlbaliVnpq3xk95145P9Tdn9qghqGwE6tL 3sw8/WNc8PK6p6CdwxWeK7rUHd1KIHtZhp6h0pkL5APCFQbI/hkfPNyc0nVLNh6Gqx/T POq4+J9i3JoosuwzzGYTTHjrCppIoaEY9sdRObxxlSewQzj6RJ8c6hvTTiSDD3Ls73Q2 PufKrXluWdM/k24Y/LrA2b4t3Yn29Jj/A7K8pHdM15WQ/hFYW4+IfSZKpGs8RQcmH0C0 K9yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0yqSrVM7zLv84YsqkG//pFEm4uZogwTf0usjHmOwpcc=; b=67aTYS+kg78mUYtT43grB4VI2x6gLxIna9F9Gh8d/9qjwlWW/l8Utb7SLjd5XLxRPs 6Q9hsTW0+BxTpFpwADNAeMGUbSbC8abyTDm+0ZlO2gDg7hZ+4kZacF3vuR3nxFrvJGpB aNWJ9rZ7qNu1BVcm3Oz5pphJ9+wFIHZb6cCXzo5yy4AlT8Tr0c1VmnfAjzfeh84Gg7JQ 80PaeG9yeBv1AHEXZydfzdv1KPflFnCOkJXwa0gENuqse87NoEwwkIOLXSscXrga0P0a QXbf/WdXo3MCzWwIrb7K8q4rixDLfVlDorXEaF19VLPJjUFZSL+Vo7rmwrJz1T5oyak5 O3lg== X-Gm-Message-State: AFqh2krV5t95RWkWBsD7BUb6pBU4/VkPwjUYQ6joCaQ+6Vr7b1PNHspr oAobdm68Dj3wy0yacWok3bewPqkjmXiA/v6HmKIiSw1aNhM= X-Google-Smtp-Source: AMrXdXsGtfLekFEoKT1TpIMMGafQsSSjGbmTQqAwnkbuLfglurFC7iXw6neCYeaQEpf35/FbCbIeRIQoGOB6r32/UgE= X-Received: by 2002:a17:90a:b702:b0:219:e176:7079 with SMTP id l2-20020a17090ab70200b00219e1767079mr3016016pjr.196.1672697496723; Mon, 02 Jan 2023 14:11:36 -0800 (PST) In-Reply-To: <837cy52lp9.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=davin.pearson@gmail.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302199 Archived-At: --0000000000001be65605f14f3c73 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ;; 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=E2=80=99s value as variable is void: smegulator-void-v= ar 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 wrote: > > From: Davin Pearson > > 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=E2=80=99s 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=E2=80=99s value as variable is void: void-variable= -smeg > > > > elisp--eval-last-sexp: Symbol=E2=80=99s 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 doi= ng > > 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" > --0000000000001be65605f14f3c73 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
;; I am trying to instrument all functions in all of my *.= el files
;; but I am running into grief Getting *Debugging*

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

(defmacro dmp-quote (&rest rest)
=C2=A0 t)

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

(defun smegulator ()
=C2=A0 smegu= lator-void-var
=C2=A0 )

;;(smegulator) ;; NOTE: commented for lat= er evaluation

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

(dmp-quote

When I put the following= code at the start of my .emacs file it
executes without errors as it sh= ould.=C2=A0 However when I
evaluate (smegulator) it brings up the follow= ing message
in the *Backtrace* buffer:

Debugger entered--Lisp err= or: (void-function smegulator)
=C2=A0 (smegulator)
=C2=A0 elisp--eval= -last-sexp(nil)
=C2=A0 eval-last-sexp(nil)
=C2=A0 funcall-interactive= ly(eval-last-sexp nil)
=C2=A0 command-execute(eval-last-sexp)

wit= hout a black triangle indicating we are not in the edebug
*Debugging* Wh= en 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: Sym= bol=E2=80=99s value as variable is void: smegulator-void-var

again w= ithout 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 a= t 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 ede= bug mode, but the
correct behaviour is pretty much a hit and miss= affair.


)


Davin.


On Tue, 3 Jan 2023 at 00:57, El= i Zaretskii <eliz@gnu.org> wrote:=
> From: Davi= n Pearson <= davin.pearson@gmail.com>
> Date: Mon, 2 Jan 2023 13:27:08 +1300
> Cc: mwd@md5i.com= , emacs-devel@gnu.= org
>
> (progn
>=C2=A0 =C2=A0(setq edebug-eval-top-level-form t)
>=C2=A0 =C2=A0(setq edebug-all-defs t)
>=C2=A0 =C2=A0(setq edebug-all-forms t)
>=C2=A0 =C2=A0(setq edebug-on-error t))
>
> (defun smegulator ()
>=C2=A0 =C2=A0void-variable-smeg
>=C2=A0 =C2=A0)
>
> ;;(smegulator)
>
> (defmacro dmp-quote (&rest rest)
>=C2=A0 =C2=A0t)
>
> (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=E2=80=99s value as variable is void: voi= d-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=E2=80=99s value as variable is void: void-variabl= e-smeg
>
> elisp--eval-last-sexp: Symbol=E2=80=99s value as variable is void: voi= d-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=C2=A0 witho= ut 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:

=C2=A0 . set edebug-all-forms to a non-nil value
=C2=A0 . mark the region around your code
=C2=A0 . type "M-x eval-region RET"
--0000000000001be65605f14f3c73--