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: Initial fontification in sh-mode with tree-sittter Date: Sat, 12 Nov 2022 11:45:53 -0800 Message-ID: References: <83y1sgmjax.fsf@gnu.org> 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="3245"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 12 20:46:29 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 1otwST-0000dt-3E for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Nov 2022 20:46:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otwS7-0003lO-5q; Sat, 12 Nov 2022 14:46:08 -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 1otwS0-0003ks-NU for emacs-devel@gnu.org; Sat, 12 Nov 2022 14:46:00 -0500 Original-Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otwRy-0000fi-WB; Sat, 12 Nov 2022 14:46:00 -0500 Original-Received: by mail-pf1-x42a.google.com with SMTP id k22so7664384pfd.3; Sat, 12 Nov 2022 11:45:57 -0800 (PST) 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 :message-id:reply-to; bh=8D0RlhKTPP+zLfv3A3qVGnJdOwrUqxQ9jeS5rUAev6E=; b=NMaDs8TjLAfWSFyNdQ/WuK+6Yg+dYjW6ODyp4cTIpQydDNd1o0wOk++k1ek5cRhI5w Gl5Lm6NUW3grOVZ2Ih0pbCifLD5SGrnNY+yOVGN75VSYG5mYRgZs1VgwU/HsioTcWSSM SrXpwl81s1Ue/IcDMcwGChlILxrfyKC1TEMhUEwtunB29Z1XMpdJt8J6Dm0zwKeYKdfS xR6QpiP+TkTFn5ooPHJd/YRqdHbdjUJ1U7WxauEZxB/qKNYi/rvFnR8FIN4A9RDk1rWY 4EgzoVuJeU8c3zcTFoOhSbjnLlC0mZ0zqihmgFU+BtZtgerGEHOjymp8rDFuxYgq44vY NiBQ== 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:message-id:reply-to; bh=8D0RlhKTPP+zLfv3A3qVGnJdOwrUqxQ9jeS5rUAev6E=; b=Z++M/bGuhWeHCdv0pzDE4RZlgghOKcVBUxvrBi2LPz7BB+zLhhUiB50drZv+uY7dEM ReC+2x/tgQRXWNONTzhBqSikNTufA8tZXU5WnunrrR6pm1R7cGqFSDfxGFVLFdnmTyo2 d1iiyiVafKlGh8/g3rL7IB+1vtau4wDfz95sOsSTKzNe7P7HvlnCWQ6tTjPV/mu5AaAy fDpQwsOTody41aRPzckBFdRGPHTsd7pqqvQDOGN9Iw7hIhsDH5fCyZL8Fl4XEoTYEt85 8GFq8Bp/1tYU9XWGbOn1FGiZsBU+mWqZDw4Kqx2dtas/GBwi7oy+X8Snch7cEsSyEM/l 1+VA== X-Gm-Message-State: ANoB5pkjmA8KBdFHIP2AVt3eayujyYZPsTkNG7xUGECjdaEtOL++T7kE 6pBNz4Tm8wHEh5QskrUe6cOiq+214qg= X-Google-Smtp-Source: AA0mqf7m+j0V+ZGvp9kIlwgdWAVobZt6ejmE8gXjCpih3msDsAMBp8XioEHCpR7IUN4RmyiubDgajg== X-Received: by 2002:a63:3601:0:b0:46e:fa6d:497 with SMTP id d1-20020a633601000000b0046efa6d0497mr6149513pga.60.1668282355813; Sat, 12 Nov 2022 11:45:55 -0800 (PST) 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 k92-20020a17090a4ce500b00211d5f93029sm6788461pjh.24.2022.11.12.11.45.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Nov 2022 11:45:55 -0800 (PST) In-Reply-To: <83y1sgmjax.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=casouri@gmail.com; helo=mail-pf1-x42a.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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299673 Archived-At: > On Nov 12, 2022, at 4:47 AM, Eli Zaretskii wrote: >=20 >> From: Jo=C3=A3o Paulo Labegalini de Carvalho >> Date: Wed, 2 Nov 2022 12:55:31 -0600 >>=20 >> I missed the update that adds override as the last argument of the = capture function. Fixed now. >>=20 >> On Wed, Nov 2, 2022 at 12:22 PM Jo=C3=A3o Paulo Labegalini de = Carvalho wrote: >>=20 >> Here is another version of the path. This has the queries separated = into language related terms and >> groups them into lists of features. >>=20 >> Looking forward to your feedback. >>=20 >> Thanks. >>=20 >> On Thu, Oct 27, 2022 at 4:01 PM Jo=C3=A3o Paulo Labegalini de = Carvalho wrote: >>=20 >> Hi everyone, >>=20 >> Please find the patch for enabling fontification in sh-mode = (currently only for bash) using >> tree-sitter. >>=20 >> I welcome all comments and suggestions to improve the patch. >>=20 >> I noticed a weird behavior with heredocs. Take the code below: >>=20 >> echo <> This is a here document. >> EOF >> echo "Done." >>=20 >> My patch correctly fontifies the code above, but if I kill the whole = line with the "This is a here >> document." text, then the sh-heredoc face bleeds out and all the = subsequent comments get >> fontified as part of the heredoc. >>=20 >> A similar behavior happens if tree-sitter is not enabled, if the = heredoc is empty then all >> subsequent commands are fontified as heredoc. However, as soon as = anything is added to the >> heredoc, then everything goes back to the correct fontification.=20 >>=20 >> Such "refreshing" does not happen with tree-sitter enabled, but if I = execute M-x sh-mode then the >> buffer gets refreshed and everything looks good. >>=20 >> What am I doing wrong? >=20 > Yuan, any comments? If you think this is OK for the tree-sitter > branch, please install there. I think there are still some details need to be addressed, eg,=20 > Also, when defining sh-mode--treesit-settings, instead of using the = value sh-shell as the language, it=E2=80=99s better to just use =E2=80=98b= ash. Here is what happened to me: my default value for sh-shell is fish, = so sh-mode--treesit-settings was defined with language =3D fish. When I = open heredoc-issue.sh, sh-mode parses the shebang and sets sh-shell to = bash. Since bash does have a parser, (treesit-ready-p =E2=80=99sh-mode = sh-shell) returns t, and tree-sitter is activated. However when = font-lock tries to use the query, it errors because query tries to load = a parser for fish. (I can make the change myself though) Yuan=