From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Fri, 29 Jul 2022 15:19:49 +0000 Message-ID: References: <837d46mjen.fsf@gnu.org> <174616cd5c33bfc14b1f@heytings.org> <837d44jr4p.fsf@gnu.org> <83bktghrn0.fsf@gnu.org> <8a3eaeef010995a5da8d@heytings.org> <837d40ds09.fsf@gnu.org> <83zggwcby5.fsf@gnu.org> <83o7xccagi.fsf@gnu.org> <831qu7daxb.fsf@gnu.org> <83sfmnb7yg.fsf@gnu.org> <837d3ybh5z.fsf@gnu.org> <136c4fe0fc74196714aa@heytings.org> <83pmhp89ov.fsf@gnu.org> <136c4fe0fc39573addc9@heytings.org> <83k07x8738.fsf@gnu.org> <136c4fe0fcdf00ef9a11@heytings.org> <83h73183r7.fsf@gnu.org> <136c4fe0fc0fceb0d752@heytings.org> <838roc8ka7.fsf@gnu.org> <83tu706obt.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34425"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682-done@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 29 17:20:56 2022 Return-path: 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 ) id 1oHRnJ-0008a5-O0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Jul 2022 17:20:53 +0200 Original-Received: from localhost ([::1]:55602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHRnI-0003Fz-Hq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Jul 2022 11:20:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHRmV-0003CJ-Ki for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2022 11:20:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHRmV-0000kJ-BY for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2022 11:20:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oHRmU-00015j-7N for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2022 11:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2022 15:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-done@debbugs.gnu.org id=D56682.16591079934167 (code D ref 56682); Fri, 29 Jul 2022 15:20:02 +0000 Original-Received: (at 56682-done) by debbugs.gnu.org; 29 Jul 2022 15:19:53 +0000 Original-Received: from localhost ([127.0.0.1]:33225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHRmL-000157-IR for submit@debbugs.gnu.org; Fri, 29 Jul 2022 11:19:53 -0400 Original-Received: from heytings.org ([95.142.160.155]:57800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHRmJ-00014z-2i for 56682-done@debbugs.gnu.org; Fri, 29 Jul 2022 11:19:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659107989; bh=LDMfJSHC/2EU5yUPIW/zdbMYuOiwuiBZsJGRmY0HTfc=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=RNt4eq7fqNhYfamgbqQapwcEPUlTlssQgQTXUvFJLT982wlWW3vs/9Ng0tV5WCUF1 1H6nxSD1DLvZxxCmuIoXtKF23ilrZcOc1WxC9UlddwcCi+ZnG8513O/GcRRmUD9b0S leX69omLLyC6P+Z1le4koUmiKk0/E28zRZ0dEh+2V7276pXK3qftVawBMfFl3LRx95 ZjaM1gclMRcuCRry7DhuX8qzojxZ+dgLb0Vu+VMC5PB0/R59hssCzxyM7qZPnxurWG twHHgGwaXqhFp9D8SmC6WHB/WXMAIJFH9vuWQCBUD8+bTfeSQgmRAzZSB1S5EotbT6 00/qX1vR3UQIw== In-Reply-To: <83tu706obt.fsf@gnu.org> 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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238187 Archived-At: > > Hmm... I'm bothered by this code in handle_fontified_prop: > > if (it->narrowed_begv) > Fnarrow_to_region (make_fixnum (it->narrowed_begv), > make_fixnum (it->narrowed_zv), Qt); > Hmmm... that code has been on the branch for a week, and I didn't see particular bugs. Which doesn't mean there are none, of course. > > This narrows the buffer around window's point position (since this is > how narrowed_begv and narrowed_zv are computed), but the display > iterator can be called for position outside this range. This is unlikely > to happen when the function is called as part of actual redisplay of a > window, but it can easily happen when the display code is used by other > primitives, for example vertical-motion or pos-visible-in-window-p. > What happens then is that fontification-functions are called with the > argument POS that is outside of the restriction, and that can cause > errors. (jit-lock simply does nothing in that case, AFAICT.) > > Is this intended? > I'm not sure I understand how this could happen. Can a non-visible part of the buffer be fontified by fontification-functions when for example pos-visible-in-window-p is called and eventually returns nil? At least if I do (pos-visible-in-window-p (point-max)), they are not: handle_fontified_prop is not even called with it at point-max. Even with (pos-visible-in-window-p (1+ (window-end))) fontification-functions are not called. Should we perhaps be extra careful and add not apply the narrowing when IT_CHARPOS is not between narrowed_begv and narrowed_zv?