From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: New optimisations for long raw strings in C++ Mode. Date: Fri, 12 Aug 2022 16:18:01 +0300 Message-ID: <835yixob1y.fsf@gnu.org> References: <87fsi5xw9l.fsf@gnus.org> <83wnbhtlzb.fsf@gnu.org> <703c2351d96919276449@heytings.org> <83o7wsqlcm.fsf@gnu.org> <83edxoqcnl.fsf@gnu.org> <83a68cqbm0.fsf@gnu.org> <834jykq9m6.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22386"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, gregory@heytings.org, larsi@gnus.org, emacs-devel@gnu.org To: Lynn Winebarger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 12 15:24:37 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oMUeT-0005cu-4F for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Aug 2022 15:24:37 +0200 Original-Received: from localhost ([::1]:48266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMUeS-0005Nq-5O for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Aug 2022 09:24:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMUYB-0007uM-Lf for emacs-devel@gnu.org; Fri, 12 Aug 2022 09:18:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45962) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMUYA-0002Ry-HF; Fri, 12 Aug 2022 09:18:06 -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=s1wrKOxhHR4RY8MPoP+jm5nwDyC0wGA5aPV1Zl0+QgA=; b=BCRWXr4FhCvl AWQjcpAd8CfkHSQS+ZFIZrmKwibpUb/u0yABWONcoabCf+aoArNqisQTl4QLOdhuf2CAmh8Yuvhkk CWaiwn/3NdgsRoUz2xsUjNbgeNkw8NcR4dWEgkD2RkDVWoWueWotnvQM0YX5lqin2SoHnD1IHPvoq fW1OiqovwkndYFP5XuPuhSJCup9S4JZdzqpgUjaNox6NuigRd7bn0nIJ6TUiRbgjDdEkZ+8z2hPX8 8Sr5gOWJGL1rFn8P8N2rRBbX+5i/yN1k94r2Zn+m6Xy5jTGzRdP5MW1/4bRRY89oJCk4GAc5rMr2t 048AKKAr7PU08PsKMnPFDQ==; Original-Received: from [87.69.77.57] (port=3936 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMUYA-00024F-05; Fri, 12 Aug 2022 09:18:06 -0400 In-Reply-To: (message from Lynn Winebarger on Fri, 12 Aug 2022 09:05:06 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293387 Archived-At: > From: Lynn Winebarger > Date: Fri, 12 Aug 2022 09:05:06 -0400 > Cc: Alan Mackenzie , gregory@heytings.org, Lars Ingebrigtsen , > emacs-devel > > Really? Then please tell me how is it that we the humans can detect > incorrect fontifications even when shown partial strings and comments? > We know that fontifications are incorrect, and where strings or > comments start or end immediately, just after a single glance. We > never need to go to BOB to find that out. > > Serious question: is fontification intended to display text according to what the author probably intended, or > according to how a compiler will process that text (leaving correctness to a more precise tool than font-lock, > whether Semantic, tree-sitter, LSP, whatever)? I fail to see how this question is relevant to the issue at hand, which is what should be the behavior of fontification functions in very large files and files with very long lines. > Because I can definitely write code that has some subtle issue that I will miss, and erroneously think should > display one way but which would be processed in a different way. Should fontification show my likely > intention (plus, and only for bonus points, possibly highlight the error that disconnects the likely intended from > the actual parse), or should it display according to the way the tools will interpret it so the author will find > errors that way? Ideally, the latter. But not at a prise of making moving through and editing the file impractical. > When I use a dedicated IDE of recent vintage, it feels less like I am writing a stream of characters than filling > in partially constructed objects representing the abstract syntax of the language I'm writing in (with grammar > that has allowances for incomplete or erroneous constructs), with the text being displayed as a > representation of the underlying object. IOW, the relationship of the syntactic object and the text is inverted > compared to emacs's design, where (if I understand correctly) the properties of the syntactic object are only > tied to the text through text properties. With the other approach, the fontification and the syntax object are > tied together, but with emacs the relationship seems much more tenuous. E.g. completion and fontification > are completely separate activities as far as I know, though the same contextual information should be useful > for both activities. That is correct, for the current Emacs design. > If CC mode is determining more syntactic information than tree-sitter's incremental parsing provides (per > Immanuel Lizroth's comment in this thread) I don't think this is true, FWIW.