From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#63840: 29.0.91; c-ts-mode fails to fontify common C extension Date: Sun, 18 Jun 2023 23:43:51 -0700 Message-ID: <6871B1D5-9B52-47C0-BB6F-5C41655CD33B@gmail.com> References: <87fs7anjwq.fsf.ref@yahoo.com> <87fs7anjwq.fsf@yahoo.com> <835y86auxi.fsf@gnu.org> <692BAB16-A7DD-4080-871A-FB541329CCFC@gmail.com> <873532jq2a.fsf@yahoo.com> <83zg51tgjd.fsf@gnu.org> <868C5538-F021-4EF8-9730-0828FC9BD801@gmail.com> <834jn7uddh.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28045"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , 63840@debbugs.gnu.org, Theodor Thornhill To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 19 08:45: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 1qB8dc-00073h-9L for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Jun 2023 08:45:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qB8dM-0006Jh-1J; Mon, 19 Jun 2023 02:45:04 -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 1qB8dK-0006JW-Eo for bug-gnu-emacs@gnu.org; Mon, 19 Jun 2023 02:45:02 -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 1qB8dK-0000kz-54 for bug-gnu-emacs@gnu.org; Mon, 19 Jun 2023 02:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qB8dJ-0005C8-Q7 for bug-gnu-emacs@gnu.org; Mon, 19 Jun 2023 02:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Jun 2023 06:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63840 X-GNU-PR-Package: emacs Original-Received: via spool by 63840-submit@debbugs.gnu.org id=B63840.168715705219898 (code B ref 63840); Mon, 19 Jun 2023 06:45:01 +0000 Original-Received: (at 63840) by debbugs.gnu.org; 19 Jun 2023 06:44:12 +0000 Original-Received: from localhost ([127.0.0.1]:55416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qB8cW-0005Ar-7r for submit@debbugs.gnu.org; Mon, 19 Jun 2023 02:44:12 -0400 Original-Received: from mail-pg1-f179.google.com ([209.85.215.179]:51388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qB8cU-0005Ae-0b for 63840@debbugs.gnu.org; Mon, 19 Jun 2023 02:44:10 -0400 Original-Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-51452556acdso1066258a12.2 for <63840@debbugs.gnu.org>; Sun, 18 Jun 2023 23:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687157044; x=1689749044; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wcFO5KJ91c8n8YNWnhOAeHuWWLarwZ5OfPmEER6T0ag=; b=JZ4S8Ga33kT6Xmld9ZOQ4qARLe5Bg4sIofssYUav8Gnw3DG2VxyCJEAvQqpjccw0T3 RhuBAg1Eyjqvmb5VwprvuNP0WsWHcCUq9xp2O2o3YBkm/2L0n0EOImN5vlqJVcER8boG 9iAIaBCuAhpA5cKYW9ojWt9TDL1DbVBalXQhmQrG9M5YaQOSYzBnFL3kRNggPSgTNfbX rPSvwddzYz5pYhHeknOwzDsBDA0iaFWrHdeGQSZR68L7qFcbhrzWIaWkcAP7kJagQoEb hU/+snFDBSeCx6mGz6gyJ2rBucUXdFhKb+Hrh8rcSDrFu+/9easOQPj8RllQ6k18tUx1 2jQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687157044; x=1689749044; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wcFO5KJ91c8n8YNWnhOAeHuWWLarwZ5OfPmEER6T0ag=; b=N67BYtb0zmsDFh3N7ZAPPL0uZ1EFnMgFSt4U9KFykQG0cbtZMr9WhsHL5V/+8Qc/hQ OR64Fh8b++/SWWNGFM6FFtFs4bjUiiIimrQ9/UhWjDgLBF2F/Oqj8DvGZGeXUOwvXfgf tQLBdCaD/6PsqO8ZGy+/isAaTMcD70Je+4Rz1eWordiRYzDyB/2mMdi+AG82RJzA18F/ R6jBDtZCUapnJCr+W/k9VMRy4T4P47yiMil+Cr/bGR+MZ/igxQmsTRSUhVn1bWhWGMJl l8UojcTKRHFd4HbHfPTBvhB3hpDhSbbCcQQdXUSK0sTFak2NOf0UjvWjG0IGoI8pUrrL 04PQ== X-Gm-Message-State: AC+VfDwUxST7dIEpm3SuYNhwUaU6ZIn0rcZ5ugV5HCpfaTZ2417WYR2P uCAHoGIEkfm4qgfjCmY9O4I= X-Google-Smtp-Source: ACHHUZ6viDREF/xmdkt/YsWpwYBvnM3hin2IWrXS6I8h0mjC+V1uzVeUPaqsSXZrwIDaW9SaYWbvFQ== X-Received: by 2002:a05:6a20:e68d:b0:114:28dc:2d93 with SMTP id mz13-20020a056a20e68d00b0011428dc2d93mr5079031pzb.17.1687157043721; Sun, 18 Jun 2023 23:44:03 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id r21-20020a170902ea5500b0019309be03e7sm19682343plg.66.2023.06.18.23.44.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jun 2023 23:44:03 -0700 (PDT) In-Reply-To: <834jn7uddh.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) 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:263670 Archived-At: > On Jun 15, 2023, at 11:31 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 15 Jun 2023 22:05:33 -0700 >> Cc: Theodor Thornhill , >> Po Lu , >> 63840@debbugs.gnu.org >>=20 >>> Ping! Any progress with this? >>=20 >> The best option is to ask tree-sitter-c to recognize $. I see a PR = for it but the author closed it shortly after posting, not sure what was = going on[1]. >=20 > Any hope of re-opening it, or at least asking why it was closed > without fixing? I asked on GitHub. >=20 >> Fixing it ourselves involves checking every identifier during = fontification. Is that something we want to do? >=20 > How would that work? Can you describe how could this be implemented? > It is hard to decide whether it's something we want to do without > knowing the implications. I was going to write a demo implementation, but that actually would = change quite some lines. So let me just describe it for now. In = c-ts-mode--font-lock-settings, I would replace all the different types = of faces used for all the identifiers to a function. (If you search for = identifier in c-ts-mode--font-lock-settings, there are quite a few of = them.) This function would obviously receive the beg and end of the = identifier tree-sitter detects, and it would check if there are $ right = before or after the given range, if there is, it would extend the range = fontified. For example, for a code like abc$de, tree-sitter might consider abc as = an identifier, and $ de to be error. The function I mentioned would look = at abc=E2=80=99s beg and end, and see that c is immediately followed by = a $, so it would extend the fontification range to include abc$de. Yuan=