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 12:31:41 +0800 Message-ID: <87tu6czu4y.fsf@localhost> References: <1144021660321893@iva5-64778ce1ba26.qloud-c.yandex.net> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28445"; 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 06:31:45 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 1oNoEy-0007C7-TP for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 06:31:44 +0200 Original-Received: from localhost ([::1]:60432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNoEx-0004kz-Ij for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 00:31:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNoEI-0004jY-KV for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 00:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNoEI-0003T2-Ay for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 00:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNoEI-0001Km-6v for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 00:31: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 04:31: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.16606242465107 (code B ref 56682); Tue, 16 Aug 2022 04:31:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 16 Aug 2022 04:30:46 +0000 Original-Received: from localhost ([127.0.0.1]:44510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNoE1-0001KI-L7 for submit@debbugs.gnu.org; Tue, 16 Aug 2022 00:30:45 -0400 Original-Received: from mail-pf1-f175.google.com ([209.85.210.175]:45761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNoDy-0001K2-TS for 56682@debbugs.gnu.org; Tue, 16 Aug 2022 00:30:43 -0400 Original-Received: by mail-pf1-f175.google.com with SMTP id z187so8344541pfb.12 for <56682@debbugs.gnu.org>; Mon, 15 Aug 2022 21:30:42 -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=P182QNKP59zYmkuUGtDRcHx9ShBTLwTJs3JIaW3ujS4=; b=mw3wKmD/FyxqaX/pEnmTWF6ngwEh+g1hCIgBFUbVjF6U01URbJ881lezyFO3W5r/ey OqLOX93tMgRbKzaS7r/80cEgprL9BASieBA4jgVRJHYPQ0DAU1f4Bq+Hzsac5plJBBUU NzPdQSQ9Kx2LtuueGNwMj5k8gYrmvNzdwJjnPGg7vXaBkWQiL49DVN/Uo5d0F568sTUA a7OFqAOIKwcX43PPj9XznY/RkCoIMICRZfsmJcmQAb0jeV7LbI8+RVuYi4TaD8w5ak3z 3/maNzUgf1b3rXhs8Hds9iBiFKIKiwNrvSem78wYoeqldLEBiqwkgQIF2amcVnQKzcC6 Wgeg== 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=P182QNKP59zYmkuUGtDRcHx9ShBTLwTJs3JIaW3ujS4=; b=gIlFwHBdpIMEJgohyeJ3R0AEkSrRYUSP0CSTDqHw2khp7zH7BolvMnOOIJlnxqjSnt szHfB++IKgG5tOrlOU+brwbgwSOQTV4yIVG3MaQxFoNhSNRMFdKqSnvTkKhJCt0Pfewj BC9eY0b+iVsk0QLUZLdPyzPcXcKkOv3Seq+osTiSX6UP+hpExYz5EkaeK54une3wYlB4 tzD1d5QgQW62jyQPIcVnvUD5OBObu7Mgr7ypHLKlAiHeDoZ+WjlV8CPBB1QOmtBO1bBH RH9g5dxoYgyAoDrLCahOdlM/O8lA/idzbTYo1tIseh3nZO44uKDNElQcmUlcRYWQEXZK AmPA== X-Gm-Message-State: ACgBeo3uNd/BGnEz06tvvJVqqp7WKT02U9eQfhHujPPLmhSk1DByFbMX 4+UsywwhNSA80/tGl2B8LJs= X-Google-Smtp-Source: AA6agR57FMhZQutvm46zgXUMFzUrWCd+NNeo4yfj4hSQ4dxJrTpB+i07+/HNSuxBh80KnwMtdpWmfg== X-Received: by 2002:a05:6a02:208:b0:41d:b01:db6d with SMTP id bh8-20020a056a02020800b0041d0b01db6dmr16889211pgb.252.1660624236877; Mon, 15 Aug 2022 21:30:36 -0700 (PDT) Original-Received: from localhost ([115.154.175.57]) by smtp.gmail.com with ESMTPSA id f2-20020a17090ab94200b001fa9117a8edsm512395pjw.21.2022.08.15.21.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 21:30:36 -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:239868 Archived-At: Stefan Monnier writes: >> However, I do insist on my statement that expecting major-mode to not >> widen is a bug. > > No, it's a design decision, which makes it possible to use specific > implementation techniques. Org-mode's support for multiple major modes > (org-babel) uses an implementation technique that does not require > narrowing. Both approaches have their virtues and downsides, but if the > submode widens then the supermode has less freedom in terms of which > implementation technique to use. I agree that major-mode doing (widen) may be problematic. However, at least Org mode does need to do it in order to parse the buffer. >> 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. This is prescribed by Org syntax. We cannot avoid this. -- 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