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.devel Subject: Re: Recent updates to tree-sitter branch Date: Sat, 1 Oct 2022 20:46:05 -0700 Message-ID: <59AE5D4B-39D2-4C18-BAC6-9C71B736F0D0@gmail.com> References: <87wn9srn9n.fsf@localhost> <87leq65v3t.fsf@localhost> <87k05m96cy.fsf@localhost> <09FF0751-A76E-449F-9F6C-7F3FDEC11DA1@gmail.com> <871qrs2mzl.fsf@localhost> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="23263"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , Theodor Thornhill To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 02 05:47:06 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 1oepwY-0005sU-2w for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Oct 2022 05:47:06 +0200 Original-Received: from localhost ([::1]:58372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oepwW-0004QW-HF for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Oct 2022 23:47:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oepvf-0003kY-FP for emacs-devel@gnu.org; Sat, 01 Oct 2022 23:46:11 -0400 Original-Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:37684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oepvd-0002Bi-OM for emacs-devel@gnu.org; Sat, 01 Oct 2022 23:46:11 -0400 Original-Received: by mail-pf1-x436.google.com with SMTP id c68so1182001pfc.4 for ; Sat, 01 Oct 2022 20:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date; bh=nOCRcLYzfHX3XUuF0V3mAgo9ZgRQhQ+xGdvBiaUJ+9Y=; b=Oprv+g/st/T8nwzd+bBdrzaj33rS1b7+1x1bBzXTWdfRwO8uMN0BAdqu31/l+Q1Q5z /7bfP3V8ggS+4N4isH82r1Bqnib1YtDSdMkR3cf5KXHSEWfuYe/kS0n92rqwNAJngdE2 E+iqBlyhKRWlF+NyEomG+zPYj3d26eTri9dh2uD1Z/b2eqCNzyHgq2m06BwtEVfv6YU0 zR3fUF5aIJzLjyUXg0H/mpKuIqKljCtp9VAxkbWLBCdCqarlUPfGBJvdenjZUPnfPoiy Fhr71Nss9FZx8PTXZ3HXNHbZnZlfY25vr7SM7VxVFCAR84b9TL5T51gzWnVz5IbV2Vtn cEng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=nOCRcLYzfHX3XUuF0V3mAgo9ZgRQhQ+xGdvBiaUJ+9Y=; b=kLd0yBSxZHK9O3yj4y661WZKrTrxZ3l0p29axNYhgLkL2yfrqezKmvSZqF+VuGepf8 taguD5DmSCZudbZSQv5eii6MubBLkw3KBqdYp9PJGe3mfdpkGZt/mlf2nc9585HrNei3 JG+wAns3kaG4oaMz+gKVXEeYaDRuneoP0WedDNruXZ6Q8KH4RmyLwYW43AYZYx33H6S1 vpSRjoWpGRd+CIFxq+r28/aI1nuMAw6tmcZ7VHwgrrOWG5zv6puxI9FxfOgpeYBcbzGA iuHfPq5BO6ZLlarCg8xSxy56boQp5+LMPY9kca6lGejsln90RK0OhzY60u3HtQwfvDr3 UU9g== X-Gm-Message-State: ACrzQf3e5CEHg0eqzfFQhn9L8naLKUJjbrnpazif1bNgvNxNCMiB/KY3 YHTn71H0GMrPjxxD3QIgXZQ= X-Google-Smtp-Source: AMsMyM7c5+O1f2h/Z4iz5hNs7RXdmIg7l9G/yNEjPDYesSotazTnH+ejBwST+Ix0FrNr5UwqRgWnBw== X-Received: by 2002:a65:6bd4:0:b0:443:94a1:429c with SMTP id e20-20020a656bd4000000b0044394a1429cmr6225608pgw.606.1664682367641; Sat, 01 Oct 2022 20:46:07 -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 b194-20020a621bcb000000b00540b979c493sm443524pfb.55.2022.10.01.20.46.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Oct 2022 20:46:07 -0700 (PDT) In-Reply-To: <871qrs2mzl.fsf@localhost> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=casouri@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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:296572 Archived-At: > On Sep 30, 2022, at 9:20 PM, Ihor Radchenko = wrote: >=20 > Yuan Fu writes: >=20 >>> Will the currently matched node be passed to the function? Or should = the >>> function run yet another query to determine the node it was called = on? >>=20 >> The matched node is passed to the function. >=20 > Thanks for the clarification! I missed this detail in the = documentation. >=20 >>> OVERRIDE can also be 'prepend or 'append to combine faces from = multiple >>> nodes. >>=20 >> You can=E2=80=99t really pretend or append if the only face format we = allow is symbol. >=20 > Why? > 'prepend implies that if there is an existing font-lock-face, the new > face will be prepended to it. Note the 'face text property may contain = a > list of faces: >=20 > =E2=80=98face=E2=80=99 > The =E2=80=98face=E2=80=99 property controls the appearance of = the character (*note > Faces::). The value of the property can be the following: >=20 > ... > =E2=80=A2 A list of faces. Each list element should be = either a face > name or an anonymous face. This specifies a face which = is an > aggregate of the attributes of each of the listed faces. > Faces occurring earlier in the list have higher priority. I see, yeah you are right. >>> Also, OVERRIDE nil will not apply fontification on the already = fontified >>> parts of the region. Note that the parent node might only fontify >>> fraction of the text inside the child node. The parts not yet = fontified >>> can make use of OVERRIDE nil. >>=20 >> Ok, I guess it=E2=80=99s good to have options. But I think it is more = intuitive and convenient to override by default. >=20 > I disagree. The current default in font-lock-keywords is not to > override. If programmatic font-lock behaves differently, it will be > confusing. I think the tree-sitter queries are different enough from font-lock = keywords that it will not bring confusion. Further more, default to = override should make things easier, especially to delicate things like = string interpolation, or other nested constructs, where tree-sitter = shines. By default, if the to-be-fontified region has any existing face, = the whole fontification is given up instead of filling in new = fontification. That would be IMO confusing because user would think the = match failed. Also bear in mind that the override flag can only be applied to the = whole query, rather than individual captured nodes. Yuan