Subject: Re: bug#66218: 29.1.50; `beginning-of-defun' jumps to wrong position in `emacs-lisp-mode'

From: Eli Zaretskii <[email-masked]>
Date: Sat, 07 Oct 2023 19:03:10 +0300

> From: Jens Schmidt <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 07 Oct 2023 17:47:19 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Jens Schmidt <[email-masked]>
> >> Cc: Eli Zaretskii <[email-masked]>
> >> Date: Fri, 06 Oct 2023 21:26:24 +0200
> >
> > I'm afraid I cannot reproduce the original problem using the current
> > emacs-29 branch.  Typing C-M-a from buffer position 70719 in shr.el
> > from emacs-29 lands me at the beginning of shr-table-body, as
> > expected.
> 
> Thanks for looking into this, but it still reproduces for me.
> 
> It is important to execute the reproducer *without* actually getting the
> file to the glass, so hitting C-M-a in the file itself would not show
> the issue.

Why not?  If the problem is where you identify it, it should not
matter how beginning-of-defun is invoked.

I'm not being stubborn, mind you, I think it's important that we
understand the issue completely to reason about the solutions.  And I
think we don't yet have a sufficient understanding of the problem, or
at least I don't.

> Please try exactly like described below, starting off the
> root of the development directory:
> 
> ------------------------- snip -------------------------
> [emacs-29]$ pwd
> /home/jschmidt/work/emacs-29
> [emacs-29]$ ls -al README
> -rw-r--r-- 1 jschmidt jschmidt 6125 Aug  1 00:06 README
> [emacs-29]$ git rev-parse HEAD
> 8f23a02a9ea1fbc4213cae5664dcb9bf6b5205f6
> [emacs-29]$ make -j8
> make actual-all || make advice-on-failure make-target=all exit-status=$?
> make[1]: Entering directory '/home/jschmidt/work/emacs-29'
> [...]
> make[1]: Leaving directory '/home/jschmidt/work/emacs-29'
> [emacs-29]$ ./src/emacs -Q
> ------------------------- snip -------------------------
> 
> Paste the following form into the scratch buffer with C-y:
> 
> ------------------------- snip -------------------------
> (progn
>   (with-current-buffer
>       (find-file-noselect "lisp/net/shr.el")
>     (goto-char 70719)
>     (beginning-of-defun)
>     ;; point should be at BOF of `shr-table-body', but is in fact
>     ;; somewhere near a Unicode character name
>     (pop-to-buffer (current-buffer))))
> ------------------------- snip -------------------------
> 
> And immediately after that hit C-x C-e.  It lands me to the position
> denoted by "^" (point=68645 of 91908):

I'm surprised, to say the least, that such a simple bug needs such a
complex reproducer, and any deviation from it fails the recipe.  I
think we must understand why.  And if it turns out that the problem is
so hard to reproduce, maybe we don't have to fix it on emacs-29.