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.devel Subject: Re: Recent updates to tree-sitter branch Date: Sun, 25 Sep 2022 14:17:24 +0800 Message-ID: <87wn9srn9n.fsf@localhost> References: Mime-Version: 1.0 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="9020"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , Theodor Thornhill To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 25 08:19:32 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 1ocKzE-0002BY-T0 for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Sep 2022 08:19:32 +0200 Original-Received: from localhost ([::1]:58480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocKzD-0002JJ-El for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Sep 2022 02:19:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocKwU-0001LV-Pw for emacs-devel@gnu.org; Sun, 25 Sep 2022 02:16:42 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:40900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocKwP-0004q4-0Q for emacs-devel@gnu.org; Sun, 25 Sep 2022 02:16:38 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id b21so3607056plz.7 for ; Sat, 24 Sep 2022 23:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=dE70HzW9tcZtGR7cxrI8hSyQYxVNIjAZj7g8Q1uGRMU=; b=jaL9L+EXqGQe0FCCvat+VvVeTlPUqVEf4fTKvO9fZAryXgvOOx7MKS1kt6MkDYnhY/ Xdstl6ZXrWh07KPeePAIDo2x4gVcDSNeOHC33BRn6KbzUNYvU0QAyyqTAugkZvTLlwye sVFBNDI8d4bXn8oKte5qvCRPjS9rp7aCe9whdFzcWwFyniSS5Fp2kXYP3gTMs3BFG8aO BhgEpLYJ9Ub9ArCQsDjL9OEDyCXUWm9bfP5FxIVU1rw17Zc5DAk6XzMLFMIymiNOT9on dPbrgmqfM/h2xvbZAJHJlSB+L/g+VOjNIc5m3jQ3hwG71ZOLDNxzaUwCfCnlFq7TRXyz lfZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=dE70HzW9tcZtGR7cxrI8hSyQYxVNIjAZj7g8Q1uGRMU=; b=5Hq752ikiwoa4VEJVvHk07gR4iA/KNWY6pDu2XST/tcOrSZ8f4FzoA7oIVCDRYqcAQ yIRO3qxh+HCLJkK3mI9dkuvU+F6wh9W8n3axb312QLN7UiHFHAN1aqPwOAu/HbX4m0CR y6Rc3efvjyWt+PVpOUqcpX9Ew68296OrcJbqBGrMRKasL/0jBXGow4YBWO1Gf42musuS pcrDjNu/ru1++APLbTn0Cx2vullH2oxc83NpCYvizQX7cR9+PvBDlZ/L/qRDC2n2nq68 /FRtuY9KXi9CE8okQArhO7gwi9cVzsvaQ/CPK8xT6IK8g7th0dYbrQjhpXusa5ZSbM5t P9PQ== X-Gm-Message-State: ACrzQf1W8F+3y2R9H4sazz+pfuHFrQjmvqFYILXN6a0mL/seWR6Iisn+ QCiPvtgDqaiawOnslbzrwWc= X-Google-Smtp-Source: AMsMyM77b4YB3FjVFVbFKa4XI3cmtfKEiIsL44wpqRmWlvzE3EvACJtb6SU919Z56X01qcdlZLLefg== X-Received: by 2002:a17:90a:fc98:b0:202:52cf:c117 with SMTP id ci24-20020a17090afc9800b0020252cfc117mr29320609pjb.26.1664086594503; Sat, 24 Sep 2022 23:16:34 -0700 (PDT) Original-Received: from localhost ([2409:8970:a80:3a4:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id p3-20020a170902e74300b00176ab6a0d5fsm8868913plf.54.2022.09.24.23.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Sep 2022 23:16:33 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=yantar92@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:296197 Archived-At: Yuan Fu writes: > 2. Although treesit-font-lock-settings didn=E2=80=99t change, treesit-fon= t-lock-defaults is abandoned. You are also now supposed to use treesit-font= -lock-rules to build the queries and set it to treesit-font-lock-settings. = It is much cleaner than setting treesit-font-lock-settings manually. I am not sure if it has been discussed, but may I ask a few questions regarding treesit-font-lock-rules. If my understanding is correct, the font-lock rules are somewhat equivalent font-lock-keywords, but much more limited. font-lock-keywords elements can have a form of MATCHER (MATCHER . SUBEXP) (MATCHER . FACENAME) (MATCHER . HIGHLIGHT) (MATCHER HIGHLIGHT ...) (eval . FORM) where MATCHER is either a regexp or a function. treesit-font-lock-rules rules take a form of (MATCHER FACENAME) or (MATCHER FUNCTION) where MATCHER can only be a query. Is there any reason why MATCHER in treesit-font-lock-rules cannot be a function with access to the fontified node? It will allow more flexible fontification, when programmatic query can be used to decide the fontification. Further, can OVERRIDE FLAG of the MATCH-HIGHLIGHT as in font-lock-keywords be supported? "If OVERRIDE is t, existing fontification can be overwritten. If keep, only parts not already fontified are highlighted. If prepend or append, existing fontification is merged with the new, in which the new or existing fontification, respectively, takes precedence." --=20 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