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

From: Jens Schmidt <[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.  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):

------------------------- snip -------------------------
[...]
(defun shr-tag-bdi (dom)
  (insert ?\N{FIRST STRONG ISOLATE})
  (shr-generic dom)
^  (insert ?\N{POP DIRECTIONAL ISOLATE}))

[...]
------------------------- snip -------------------------

If that doesn't help, I can try setting up a reproducer running in batch
mode.