Subject: Re: bug#66764: 29.1; Emacs scrolls for "(goto-char (point-max))" instead of jumping

From: Eli Zaretskii <[email-masked]>
Date: Thu, 26 Oct 2023 21:25:16 +0300

> Date: Thu, 26 Oct 2023 19:04:42 +0200
> From: Geza Herman <[email-masked]>
> 
> The bug is, that in certain circumstances, emacs moves the point by 
> using some kind of scrolling for "(goto-char (point-max))", instead of 
> just jumping.
> 
> Repro:
> 
> - create a file using the little C program at the end (it produces a 
> large text to stdout, you'll need to redirect it to some file)
> 
> - open the file with "emacs -Q generated.txt"
> 
> - with M-:, execute this:
> 
>     (progn
>       (setq scroll-conservatively 101)
>       (font-lock-add-keywords nil '(((lambda (bound)) (1 'error prepend 
> t))) t)
>       (goto-char (point-max)))
> 
> Notice that emacs doesn't jump to the end immediately as usual, but it 
> does some kind of very fast scrolling.

I didn't yet try to reproduce this, but just reading the description:
why do you consider this behavior a problem, let alone a bug?

> In my real case, a much smaller file produces this problem. Also, Emacs 
> doesn't go to the end of the file, but stops somewhere in the middle (I 
> was unable to reproduce this issue with a simple configuration).

This can legitimately happen if the last line has tall characters or
you use line-spacing or something similar.  Again, why is it a
problem, as long as EOB is visible after that?

> So to go to the end of the file I have to run "(goto-char
> (point-max))" multiple times. Interestingly, "M->" works fine. But
> if I remove the recenter call at the end of "end-of-buffer", it also
> has this odd behavior.

Which isn't surprising, since with the 'recenter' call removed,
end-of-buffer is just (goto-char (point-max)).