From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#66764: 29.1;
 Emacs scrolls for "(goto-char (point-max))" instead of jumping
Date: Fri, 27 Oct 2023 09:50:33 +0300
Message-ID: <831qdgftja.fsf@gnu.org>
References: <ddf1fc8b-2e31-4b2e-8da6-845031ac4171@gmail.com>
 <83jzr9fdh0.fsf@gnu.org> <807a1bd5-6477-cc36-088f-efcb782ccb99@gmail.com>
 <83a5s4fwih.fsf@gnu.org>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="40861"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: Gregory Heytings <gregory@heytings.org>, 66764@debbugs.gnu.org
To: geza.herman@gmail.com
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 27 08:52:04 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1qwGhQ-000APJ-2z
	for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Oct 2023 08:52:04 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1qwGgu-0003IA-Qn; Fri, 27 Oct 2023 02:51:32 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qwGgu-0003Hx-1Q
 for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2023 02:51:32 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qwGgt-00080F-AN
 for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2023 02:51:31 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1qwGhO-0004iw-7M
 for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2023 02:52:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Fri, 27 Oct 2023 06:52:02 +0000
Resent-Message-ID: <handler.66764.B66764.169838946418087@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 66764
X-GNU-PR-Package: emacs
Original-Received: via spool by 66764-submit@debbugs.gnu.org id=B66764.169838946418087
 (code B ref 66764); Fri, 27 Oct 2023 06:52:02 +0000
Original-Received: (at 66764) by debbugs.gnu.org; 27 Oct 2023 06:51:04 +0000
Original-Received: from localhost ([127.0.0.1]:34975 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1qwGgR-0004he-JH
 for submit@debbugs.gnu.org; Fri, 27 Oct 2023 02:51:03 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58970)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@gnu.org>) id 1qwGgO-0004h4-0x
 for 66764@debbugs.gnu.org; Fri, 27 Oct 2023 02:51:02 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1qwGfn-0007le-3M; Fri, 27 Oct 2023 02:50:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=WOZOTrwFGWhfXTb1H+6/ukEjiOdRHS6sNUu2ElQvj3k=; b=Us04dfUhy6Es
 AsvWahYb0bgGCviToiZSvMiVlgWR32cCnuZUC2VNEkqA80u96CnV4zilBTGXNkOdgdVT5PHoYfKRA
 upVoSf5TU+Jrlg8N7STyVvIsf6rpl+lx7E3PrYKFulU6sckPtIPwyDZbIxVZ4QPvgyqAw+LqFotly
 GkV9HNX7x1H6Hp17in2AYUL/tznnZL7MFjWXSO9oPeaE5R2KB9oRBxx/2AS7gR4LV4Gqtj24cvVWm
 Q2DKi/S15cPrLdv+YH2AvV416Y+y5GgKkYF0oBO2IEDJC6VFPiQmkJfhtg3Ub8jVTdbLXsX1fmaYi
 SxhsRh7q3FWvNt+B3QRoQw==;
In-Reply-To: <83a5s4fwih.fsf@gnu.org> (message from Eli Zaretskii on Fri, 27
 Oct 2023 08:46:14 +0300)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:273341
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/273341>

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.