From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Newsgroups: gmane.emacs.devel Subject: Re: Initial fontification in sh-mode with tree-sittter Date: Thu, 17 Nov 2022 11:53:35 -0700 Message-ID: References: <6C8B0F8E-DF61-4BC3-B0D0-56DBB66BE637@gmail.com> <7AE71CCA-6F18-4DE6-8608-7D9B3E9E52FB@gmail.com> <9BA853EA-8B7F-41A0-A174-D86DF5CE7788@gmail.com> <83sfj3cfl0.fsf@gnu.org> <03309451-1AEB-458C-88FD-9715CECC27A2@gmail.com> <83mt9bc9ke.fsf@gnu.org> <8335b19ndr.fsf@gnu.org> <39ECD413-BD10-4BF3-90AC-36F02276607E@gmail.com> <8A2361BB-1081-4550-AC29-B9E99BFC2FB8@gmail.com> <42DBD4F5-71D9-434E-B7B4-4E0FF89F934F@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fbd73005edaf1b51" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14097"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 17 19:54:18 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 1ovk1i-0003RT-BN for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Nov 2022 19:54:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovk1K-0006KE-Jw; Thu, 17 Nov 2022 13:53:54 -0500 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 1ovk1J-0006K5-Ip for emacs-devel@gnu.org; Thu, 17 Nov 2022 13:53:53 -0500 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovk1H-0005mz-GG; Thu, 17 Nov 2022 13:53:53 -0500 Original-Received: by mail-ed1-x529.google.com with SMTP id x102so3988644ede.0; Thu, 17 Nov 2022 10:53:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lGEmqsf1tPjdMclYx53Ap3sZc+DE8DgTDiMmfqR/vp0=; b=poJVVRKQuehdWnop6qMyoZUsJ/wMuZ58eHnEBWVBs6PfwnjcB9QC/lUbvEfdnu7YmU 73JYMYJakh72b6TnmwhZPJ22uq94TNsMTXJGHKa9hjJq+Yz9pbO0hPJ4iu4xaynWSTok FfoV2rWGBqCZNiHjHi5DUagoP+kVYKLLY38WTJ5VouJhP7XbXy0Jyw5n8Yx1ZAjOP7cY Hsq3NTvPXJL08q1+1n8bioJ7weuO/z27+asFDBK1aolva/WLN2p4rCynfMMtTo4VOd5V 0W5ItzyU4APNOwJMBHIcELKv7+kFyIoZYe6Xv7LMld/+PGGxdj906E+yOn0L/HU7nK78 JZ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lGEmqsf1tPjdMclYx53Ap3sZc+DE8DgTDiMmfqR/vp0=; b=aTAv8eh9V1LeQyac6GUhN3+KgLAX4qCjmFiqr5G8/r/tqFLtDdV3q3INLwORtmx3Ks Ro64WwSN1beqfu/lCJkp/GK5lggzwKueW+gc0HnR7YQ/Zlz/KeZUw0mxAlGUyngOIwSq 3HPcloH4sMhWSn7BORgXDb+sDC2d++6lRvIugXQMc9iSiBP3PDwN1D72LprtsQ8louOC iWUoM5Y17YIKXwUBXeV1jDCc+ns5SfStwx+K5bK4P7c+9nR76mAkX6opZzW6nmJaj30h SCPQf3LOx0D1xdNOqyeo3+q2OPEdvksoSXpo1eS6U8yefeOUNKuA40eOdgcagff1bmMj DmFQ== X-Gm-Message-State: ANoB5pnFljPzi90LtxKDs8+crTgCOpqEe++WfIUvC4LX3x3kVex/RHuv ++0ZdnTz1HUsOqw3elzne65xRKAxUALItZbKyfccycWG X-Google-Smtp-Source: AA0mqf7iO8EQLHrri1oRKHg8iSqhong901TsKkxJNJ/OPLi4vcLymZpC3bRACWIN4Cli0RA0zWK2uAP4lW6rJsayCGU= X-Received: by 2002:a05:6402:538a:b0:458:fbd9:e3b1 with SMTP id ew10-20020a056402538a00b00458fbd9e3b1mr3317815edb.6.1668711228100; Thu, 17 Nov 2022 10:53:48 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=jaopaulolc@gmail.com; helo=mail-ed1-x529.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, HTML_MESSAGE=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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300069 Archived-At: --000000000000fbd73005edaf1b51 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > 1. I added commit message for your patch as an example. For future patche= s > it=E2=80=99s best if you can also have this ChangeLog style commit messag= e, I think > you can find more detailed explanation in in CONTRIBUTE file. > > (I don=E2=80=99t know if you know the following already, bug FYI:) > > 2. Docstring sentences always end with a period > 3. All comments and sentences should be complete sentences, with two > spaces at the end. > 4. The first line of a docstring shouldn=E2=80=99t exceeds 80 columns. > I did not. Thanks for the corrections and improvements. I will keep those in mind for future patches. > > For the second commit, I changed all the feature names to singular, and > decl-commands to declaration-command. I also simplified the rule for > declaration-command, IIUC you want to highlight the command keywords? > The changes to singular make sense to me. I considered your simplified version as well, but decided against alternation queries to avoid hardcoded command names. Matching a node via its type rather than comparing the spelling might be fast, but my code also had a string=3D there, so in the e= nd the simpler version works well. Also, right now these command keywords are highlighted in builtin face, > should they be fontified in keyword face? I=E2=80=99m no expert of bash s= o I can=E2=80=99t > tell. But keyword face seems more natural to me. > You are correct in the sense that all declaration commands are builtin commands. I decided to highlight them differently than other builtin commands because they are used to define variables, and it might be useful to be able to distinguish them visually. But this is not required nor more correct than using the builtin face for both types of commands. --=20 Jo=C3=A3o Paulo L. de Carvalho Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canad= a joao.carvalho@ic.unicamp.br joao.carvalho@ualberta.ca --000000000000fbd73005edaf1b51 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C2=A0
1. I added commit messa= ge for your patch as an example. For future patches it=E2=80=99s best if yo= u can also have this ChangeLog style commit message, I think you can find m= ore detailed explanation in in CONTRIBUTE file.

(I don=E2=80=99t know if you know the following already, bug FYI:)

2. Docstring sentences always end with a period
3. All comments and sentences should be complete sentences, with two spaces= at the end.
4. The first line of a docstring shouldn=E2=80=99t exceeds 80 columns.
<= /blockquote>

I did not. Thanks for the corrections and improvements= . I will keep those in mind for future patches.=C2=A0

For the second commit, I changed all the feature names to singular, and dec= l-commands to declaration-command. I also simplified the rule for declarati= on-command, IIUC you want to highlight the command keywords?

The changes to singular make sense to me. I considere= d your simplified version as well, but decided against alternation queries = to avoid hardcoded command names. Matching a node via its type rather than = comparing the spelling might be fast, but my code also had a string=3D ther= e, so in the end the simpler version works well.

Also, right now these command keywords are highlighted in builtin face, sho= uld they be fontified in keyword face? I=E2=80=99m no expert of bash so I c= an=E2=80=99t tell. But keyword face seems more natural to me.

You are correct in the sense that all declaration co= mmands are builtin=C2=A0commands. I decided to highlight them differently t= han other builtin commands because they are used to define variables, and i= t might be useful to be able to distinguish them visually. But this is not = required nor more correct than using the builtin face for both types of com= mands.=C2=A0

--
Jo=C3=A3o Paulo= L. de Carvalho
Ph.D Computer Science | =C2=A0IC-UNICAMP | Campinas , SP= - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmonto= n, AB - Canada
--000000000000fbd73005edaf1b51--