From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#62951: 29.0.90; c-ts-mode: Incorrect fontification due to FOR_EACH_TAIL_SAFE Date: Mon, 24 Apr 2023 00:04:02 +0300 Message-ID: <384f8110-eba6-8fb3-ef4e-56fa0721d85d@gutov.dev> References: <82E7ADEC-25BC-475B-8EE0-839FE78FF2F4@gmail.com> <83fs8s2xnk.fsf@gnu.org> <2BDA88D0-A870-4FE3-BAF8-350FBAA943BF@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2425"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: 62951@debbugs.gnu.org To: Yuan Fu , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 23 23:05:21 2023 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 1pqgtc-0000PW-Gb for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Apr 2023 23:05:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqgtN-0004rt-CR; Sun, 23 Apr 2023 17:05:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqgtL-0004pR-2z for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 17:05:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqgtK-0006zw-99 for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 17:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqgtJ-0001Zd-Ol for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 17:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Apr 2023 21:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62951 X-GNU-PR-Package: emacs Original-Received: via spool by 62951-submit@debbugs.gnu.org id=B62951.16822838525988 (code B ref 62951); Sun, 23 Apr 2023 21:05:01 +0000 Original-Received: (at 62951) by debbugs.gnu.org; 23 Apr 2023 21:04:12 +0000 Original-Received: from localhost ([127.0.0.1]:47034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqgsV-0001YV-Ja for submit@debbugs.gnu.org; Sun, 23 Apr 2023 17:04:11 -0400 Original-Received: from new1-smtp.messagingengine.com ([66.111.4.221]:46861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqgsU-0001YJ-9z for 62951@debbugs.gnu.org; Sun, 23 Apr 2023 17:04:10 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 3E4C458218A; Sun, 23 Apr 2023 17:04:05 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 23 Apr 2023 17:04:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1682283845; x=1682287445; bh=AfS64jNiaQzX/UgnEJXe2L7o98IEMyKiFqq IUUgQ4qw=; b=M+miK9I5kvkqJL0atwll/CWwIZes1v5rUZsRn5ON5BpgZdjWJ2R mJ0gQwcSGwE80cbfpyHuW2ogfHmIfI7vsLy/q2eUD37+NBzntiqQfBXlgGs6wR2R 0BAOhuThXE11cBbXWp4lU+km0u5S7HrqBZMLEXFoz6GGaCIRe1aEnjiI8UiC7kqn XLRHQncl5Jl1A8Q0EE6gNrJiLVD4MxEA4t4nsKUMrWqa7BO/A9WbWKcRaeFqWTG0 0jaUv2gxy1cr274gs8mVnGUqla+LlS0qqHhe1xthCkMtkcgV8zlm9c2Z+WwdCu2Z MyvzNJ1Rz2WdEGp86Ae4nulvfM32/1XcGbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1682283845; x=1682287445; bh=AfS64jNiaQzX/UgnEJXe2L7o98IEMyKiFqq IUUgQ4qw=; b=GTDFKQ2j2pp0rI0egSLJUD0+dwnqg9XVdU5KVpZNQb2WqPOJ3oR fWIR9nVu1n365+mMlCPf4FYAv1UucK8A2Gs57RX7cdsQz/8iVAiCiSIKsbyDT9YC wZY3ufsZc4qkN9ELSHTjeU/1ncTPKMZtVSUQz2i05j6dZsWpP7SqHiyETCpq3RFC kVqOuQuQ5+W8UCcBvEdNmg6JAxpcI55etALNqTR3pkEIGYl7liDMcn6ND8/GzJoV ppFctlG3nm7xp2lx3JDOVPBICcan3VKm6D2fEV66FIO4VsbfGr9GrnIKfH098mh4 hiOA50WfkUrfIuRaQ5j/8o+SBzH43Dm+nxA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedtkedgudehjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpeekjeduleevuedthfelhfeiheetudevteeutdfhtdefffejhfeugfffvdet teefvdenucffohhmrghinhepvghlrdhimhenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 Apr 2023 17:04:03 -0400 (EDT) Content-Language: en-US In-Reply-To: <2BDA88D0-A870-4FE3-BAF8-350FBAA943BF@gmail.com> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260540 Archived-At: On 23/04/2023 03:28, Yuan Fu wrote: > What do you think of extending the parser to support these macros instead? (So we fork tree-sitter-c.) If we can fix the parser, we don’t need to retrofit hacks onto font-lock, indent, etc, separately, and it truly fixes the problem. The downside is compiling from grammar source to grammar.c needs rust and node tools. But I guess depending on the grammar maintained by tree-sitter’s author isn’t too much different from depending on the grammar maintained by another individual (ie, me)? We had also talked at some point about replacing the actual text that the parser sees with something else. If this can be done in a straightforward way (with tracking the subsequent correspondence of "real" text back to the buffer for syntax highlighting), that might be the perfect solution: we'd have a defcustom which would hold a list of macros used in the current codebase in the form of templates, and we'd set a bunch of them in emacs/.dir-locals.el. I'm not sure how difficult this is to implement and maintain, but it's probably going to be less work to maintain than a fork of the grammar.