unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: No Wayman <iarchivedmywholelife@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 60768@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#60768: 30.0.50; edebug-instrument-function off by one
Date: Thu, 13 Jul 2023 08:03:55 -0400	[thread overview]
Message-ID: <87edlc81az.fsf@gmail.com> (raw)
In-Reply-To: <83lem6a8kb.fsf@gnu.org>


Eli Zaretskii <eliz@gnu.org> writes:

>> From: No Wayman <iarchivedmywholelife@gmail.com>
>> Date: Thu, 12 Jan 2023 21:27:06 -0500
>> 
>> 1. Save the following elisp to /tmp/test.el:
>> 
>> 
>> --8<---------------cut 
>> here---------------start------------->8---
>> ;; -*- lexical-binding: t; -*-
>> 
>> ;;;###autoload
>> (defun one ()
>>   "ONE"
>>   (1+ 0))
>> 
>> (defun two ()
>>   "TWO"
>>   (1+ (one)))
>> 
>> (defun three ()
>>   "THREE"
>>   (1+ (two)))
>> 
>> (provide 'test)
>> --8<---------------cut 
>> here---------------end--------------->8---
>> 
>> 2. Run emacs from the command line with the following:
>> 
>> emacs -Q --batch -l /tmp/test.el --eval "(progn (require 
>> 'edebug) 
>> (edebug-instrument-function #'one))"
>> 
>> Expected output: Edebug: one
>> Actual output: Edebug: two
>> 
>> If you repeat the test with an additional autoload cookie added 
>> above function "two", function one is correctly instrumented.
>> 
>> If you repeat it with an autoload cookie only above function 
>> "three", function two is, incorrectly, instrumented.
>> 
>> My hunch is find-function-search-for-symbol being thrown off 
>> somehow.
>
> It's not a real problem, and it has nothing to do with the 
> autoload
> cookie, AFAICT.  If you modify edebug.el like below:
>
> diff --git a/lisp/emacs-lisp/edebug.el 
> b/lisp/emacs-lisp/edebug.el
> index 2f7d03e..0ac51ad 100644
> --- a/lisp/emacs-lisp/edebug.el
> +++ b/lisp/emacs-lisp/edebug.el
> @@ -518,6 +518,7 @@ edebug-read-top-level-form
>          ;; Don't enter Edebug while doing that, in case we're 
>          trying to
>          ;; instrument things like end-of-defun.
>          (edebug-active t))
> +    (save-excursion (end-of-defun))
>      (end-of-defun)
>      (beginning-of-defun)
>      (prog1
>
> i.e., add one call to end-of-defun whose result is thrown away, 
> before
> the _real_ call to end-of-defun, the problems go away.
>
> The reason seems to be that end-of-defun calls scan-sexps, and 
> the
> first call to scan-sexps does something that wasn't done before.
>
> Stefan, any ideas what could that be?  Any hints where to look?

Any chance of applying this workaround with a note to investigate 
more for a proper fix?






  parent reply	other threads:[~2023-07-13 12:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  2:27 bug#60768: 30.0.50; edebug-instrument-function off by one No Wayman
2023-01-13 13:05 ` Eli Zaretskii
2023-01-13 16:41   ` No Wayman
2023-01-13 16:54     ` Eli Zaretskii
2023-01-17  2:28   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-13 12:03   ` No Wayman [this message]
2023-07-13 13:14     ` Eli Zaretskii

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=87edlc81az.fsf@gmail.com \
    --to=iarchivedmywholelife@gmail.com \
    --cc=60768@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).