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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 27 Oct 2023 09:50:33 +0300

OK, I think I see the root cause of the problem: it's your
font-lock-keywords setting, viz.:

 (font-lock-add-keywords nil '(((lambda (bound)) (1 'error prepend t))) t)

Without this setting, everything works as expected, and goto-char goes
to the EOB almost instantaneously, even when scroll-conservatively is
set to a large value.

AFAIU, the font-lock-keywords setting above causes the display engine
to call this function every time it moves across some chunk of text,
which slows down redisplay.  This shows with scroll-conservatively set
to a large value because Emacs then attempts to find the minimum
amount of scrolling the screen in order to bring point into the view.

It is a known fact that modes which use advanced font-lock settings
should adapt to the long-line situation (when the function
long-line-optimizations-p returns non-nil), so I think you should
modify your font-lock settings to avoid this problem in that case.

CC'ing Gregory in case I missed something in this scenario.