From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Tue, 16 Aug 2022 21:29:20 +0800 Message-ID: <87k0781fm7.fsf@localhost> References: <12348081660379417@sas2-a098efd00d24.qloud-c.yandex.net> <66bbbb95983414e79637@heytings.org> <83wnbckp0q.fsf@gnu.org> <8e884ebe-2d2e-d599-15c3-a5cfe5e6b295@yandex.ru> <83o7wnl7ok.fsf@gnu.org> <036414cc-c711-efaf-ed5b-f8ccfaca0604@yandex.ru> <5900f20836753183a6ac@heytings.org> <5c22e38a-5dcd-860e-28a0-b4a5ede6a21b@yandex.ru> <877d3awb92.fsf@localhost> <87pmh2z277.fsf@localhost> <87mtc6yzfv.fsf@localhost> <6be37aac-f305-16e0-b856-6884108f940e@yandex.ru> <87h72d4slv.fsf@localhost> <87tu6czu4y.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33080"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Gregory Heytings , Eli Zaretskii , Dmitry Gutov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 16 15:29:12 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 1oNwd6-0008Oz-0T for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 15:29:12 +0200 Original-Received: from localhost ([::1]:47912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNwd4-0006II-Hw for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 09:29:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNwcw-0006IA-MS for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 09:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNwcw-0003Aj-Dl for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 09:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNwcw-0001Gz-98 for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 09:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Aug 2022 13:29: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-submit@debbugs.gnu.org id=B56682.16606565134857 (code B ref 56682); Tue, 16 Aug 2022 13:29:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 16 Aug 2022 13:28:33 +0000 Original-Received: from localhost ([127.0.0.1]:45349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNwcT-0001GH-07 for submit@debbugs.gnu.org; Tue, 16 Aug 2022 09:28:33 -0400 Original-Received: from mail-pf1-f169.google.com ([209.85.210.169]:36746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNwcQ-0001G2-46 for 56682@debbugs.gnu.org; Tue, 16 Aug 2022 09:28:31 -0400 Original-Received: by mail-pf1-f169.google.com with SMTP id a22so8768104pfg.3 for <56682@debbugs.gnu.org>; Tue, 16 Aug 2022 06:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=qa8wcWd/XRMahIUR6AvVovJXGGArw+W9RHXqv94p6GI=; b=Rp9SyZ0h1c5MqMlzFgC66pOLYhIVqn2rft6CvNfLuphFuFp25BE3loiHfDzdqC/ghT Q9kJYkeKl01+8/sBovqLxPmqMYerJhr2SNL185EvKC/pgGyhP6rzFPvKYX9lVua3k70S eOp4pCyXJGqR1TtBzp7sGW7psbICNNYp8166BmNc1U+uHQPuXQrJHae3H7/rnFWHJXPX lDN/uVpisB3b2K4QVBP7oNNscnDIQSqbTqc+qxvwRtjCHD4pCH1pfsnQ6fKexKDv7Wkc 9BNwOXQiH15tulH/EYZ61G1G42ayVdzm1EVlH6IZyPPSddvzEHH3US7osBd7vUdDhEB9 8DZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=qa8wcWd/XRMahIUR6AvVovJXGGArw+W9RHXqv94p6GI=; b=PtI5S0I1+mm6oSd+kcmRmeYIKSaXNbrh/HnxODBpJ/gJ8KskyRYMQ2RA0DzdgdrG+K Q/Qkau3Cb0mqTDK5hhzYvVFhsLDdvPEk2tvcLyXF6XYANMu1/TnrcebYFaOawxlxqvuo BrRT5B2YugyE5h6mqHFrolli4lJKY5Fc526/mzPruIReBA2szBzXgSDbbEV97cv5HZTH /kc8FdZ8BdCv89yVLc2A8wr7LN4BGdUazB15wCLAeMXMYoBmxEwhm6VXGgLjOMIR7UFW ww2x3ub9ARinB0f+r4Am0BImh8FfquXj3E9QJB3GE293dEZW7/EcsB8F9A36Gf6b+KLZ cOfg== X-Gm-Message-State: ACgBeo2SyPMFXDOFVMNnY2hV6khJfN1Ys0S8D+OdPNb2EWVR3Pa9wnoq or74kFKJFwdM+55ziKBPA90= X-Google-Smtp-Source: AA6agR4qnXQ3/ZhoynRmuuL1gGy/3ihCPPexNhNJJsywmxbP4+Yc1WCyl+drSv2LS0JYquF9fYOR5w== X-Received: by 2002:a05:6a00:10cf:b0:528:48c3:79e0 with SMTP id d15-20020a056a0010cf00b0052848c379e0mr20868794pfu.18.1660656504384; Tue, 16 Aug 2022 06:28:24 -0700 (PDT) Original-Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id a15-20020a1709027e4f00b0016d72804664sm8988428pln.205.2022.08.16.06.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 06:28:23 -0700 (PDT) In-Reply-To: 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:239934 Archived-At: Stefan Monnier writes: >>>> There are valid cases when a major mode needs to examine >>>> the whole buffer. >>> Not if the whole buffer contains text which the major mode can't >>> understand. There are valid cases where a major mode needs to widen, >>> indeed, but not when called from font-lock or from >>> `indent-line-function`. >> `org-indent-line' (the value of `indent-line-function' in Org mode) does >> require invoking parser in order to determine the syntactic object at >> point, which, in turn, needs to consider the full buffer contents. > > *All* indentation code needs to look at the context. For that reason > `indent-according-to-mode` already widens as appropriate before calling > `indent-line-function`. For that reason the function placed on > `indent-line-function` *never* needs to widen (and should never widen). Then, can Emacs throw an error if widen must not be allowed in certain scenarios? In complex codebase like Org, we cannot guarantee that some user-customized function does not widen. Or spurious advice. Debugging absence of widening somewhere inside deep function calls will be a nightmare. -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92