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: How the long-lines "optimisation" breaks font locking. Date: Wed, 03 Aug 2022 22:15:30 +0300 Message-ID: <83wnbp3zql.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16286"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, gregory@heytings.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 03 21:16:52 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 1oJJrP-00041G-JP for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Aug 2022 21:16:51 +0200 Original-Received: from localhost ([::1]:57104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJJrO-0006fi-5d for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Aug 2022 15:16:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJJqF-0005no-PU for emacs-devel@gnu.org; Wed, 03 Aug 2022 15:15:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJJqE-00043Y-Oh; Wed, 03 Aug 2022 15:15:38 -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=x8mw6nQ7DVuVmwhRxHStbLIbOZAn3RHkVdmr6dthcF0=; b=jjloP2m+uCBm AkkE4iC0WebBKxEn97zOZrsG4TQA3nqaFwGX8lgZa2B4kY8Wpa8bs/j7hflMoVDOXMZp/HNIcTh3U 03jfyy9lVvJ4jB5QKwaAWaYmzZvgZg9uofjeKai7ED1IzyRTVudmJjOfr28F0bGiw3gGkdaH1BF2I YkQ643V9OkVcLwqpPS7mTRC/DbPMj4TqXHSF0Wp/0luNRzcmkeg02f0TWEB+oPKXgJ9l0ScrCf3la bBlL+iktle080JbbWHwlWXeL+qSDJzewkLsfjxK8/JOfgo1MMHQkldavGClpHp2mHGm4o3zLNPZVK F23kZ1GNboIvImMujHiCQQ==; Original-Received: from [87.69.77.57] (port=2826 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 1oJJqC-0004wC-GJ; Wed, 03 Aug 2022 15:15:37 -0400 In-Reply-To: (message from Alan Mackenzie on Wed, 3 Aug 2022 18:39:16 +0000) 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:293029 Archived-At: > Date: Wed, 3 Aug 2022 18:39:16 +0000 > From: Alan Mackenzie > > Hello Gregory and Emacs. > > In the current master, > (i) start emacs -Q > (ii) C-x C-f ~/long-line.cc > (iii) Enter the following into the buffer (3 lines): > > char long_line[] = R"foo( > > )foo" > > (iv) Create a long line (> 10,000 characters) somehow and get it into > the kill ring. > (v) On the blank line 2 in long-line.cc, C-y inserting the long line. > > (vi) Note that there is now a long valid raw string in the buffer, > correctly fontified. > (vii) Put point on a "o" in the foo on L3. Delete the o > (viii) Note that the opening delimiter of the raw string on L1 now has > warning-face. This is correct. > (ix) Undo this last change with C-_. > (x) Note that the opening delimiter falsely retains the warning-face, > although it is now the opener of a validly terminated raw string. > This is a bug. > > (xi) Insert a LF (or several, if needed) into the long line, separating > it into two or more lines, none of which is "long". > (xii) Note that the raw string opener still has warning-face. A bug. > (xiii) Do M-x c++-mode. This fails to initialise the fontification > correctly, leaving the warning-face where it no longer belongs. This > is a bug. > (xiv) Note that in the foregoing operations, sometimes an error message > appears in the echo area about the lack of an expected syntax-table > text property. This is a bug. I cannot reproduce this. I don't see any warning-face in step viii, and no problem in step x. > I don't think it is improbable that a C++ hacker will create a long line > in a raw string. That this can cause permanent damage to the buffer's > fontification doesn't seem a good thing. That it is the recent > "optimisation" for long lines which causes it can be seen by repeating > the above steps, but with a line less than 10,000 characters long. The > fontification then behaves correctly. Alan, please stop fighting this with impractical specially-concocted scenarios. No one in their right minds will need such long strings, and if they do, and don't like whatever problems that causes (which I cannot reproduce in the first place), they can enlarge the value of long-line-threshold, or even make it nil. Puff! problem solved.