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: Tree-sitter api Date: Sat, 18 Dec 2021 18:48:02 -0800 Message-ID: References: <83r1f7hydn.fsf@gnu.org> <1F752923-F357-4A18-B6E2-0120F1B9BD37@gmail.com> <83fsu5bzem.fsf@gnu.org> <83zgsdad5j.fsf@gnu.org> <83sfy391ni.fsf@gnu.org> <03386E3C-A975-4ECD-BF89-6AC62F751725@gmail.com> <83ilyz8xdl.fsf@gnu.org> <86czp6ukpj.fsf@stephe-leake.org> <1AEED8A5-BF5E-45E5-AE22-9B405A710F9B@gmail.com> <83czp313tf.fsf@gnu.org> <7447C582-70CB-4599-BC76-AD5687D64250@gmail.com> <784947A6-6164-4158-993B-01E881690ADF@gmail.com> <83zgrxji7q.fsf@gnu.org> <8E8D28F9-258E-490B-BF48-7EF8D6CA0817@gmail.com> <838rzgk6ll.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) 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="30826"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= , Theodor Thornhill , =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Emacs developers , Stefan Monnier , Eli Zaretskii , Stephen Leake , john@yates-sheets.org To: =?utf-8?Q?Daniel_Mart=C3=ADn?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 19 03:48:54 2021 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 1mymFq-0007qW-FE for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Dec 2021 03:48:54 +0100 Original-Received: from localhost ([::1]:46780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mymFp-0003Ml-1z for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 21:48:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mymF5-0002Eg-LE for emacs-devel@gnu.org; Sat, 18 Dec 2021 21:48:07 -0500 Original-Received: from [2607:f8b0:4864:20::232] (port=45688 helo=mail-oi1-x232.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mymF4-0007c8-0M; Sat, 18 Dec 2021 21:48:07 -0500 Original-Received: by mail-oi1-x232.google.com with SMTP id 7so10031420oip.12; Sat, 18 Dec 2021 18:48:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=QgYeC4/DmW58+NblJZPOZxBzjOF/nZct5nkQBtGiRbM=; b=ViaxzpBh9D86n8+c0qHX2qzhROFT7OCojBXWWT6CBvO96xu8hcf8FOfVcul9HRXZOz NBfNBZvdAOZF1viVoqtvuEmplD0/1D8A49cYJPq7XKSz+bNqJ66al+B1W+CsiYSg4n0z gS/YfMAuJxNOgssHMf+7Z32IHnUq+lbehw6B2tFjbgvHXYd31rO5BcaSxMs7a1iqu3VN KmQWliqKqyHN2v7F7bkTMpwwErmYwjdvqQYpTQBlAHAA/m2zGpTNuFprvWxm2AZyuMcv bhtnYVmFBx8+EBgsCB00ShIIfIX+4vkaUMheSVIgvM6mMu5V7+JDi7VNaeD/lFrdYqWl +gIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=QgYeC4/DmW58+NblJZPOZxBzjOF/nZct5nkQBtGiRbM=; b=rECbg9Z9u9r7VS1VtZGBAMga9lFlByqSSsXInEgYWsn9ZBerGxNMoUc8O+u6SUwH0z uU8gPGKo36S1ePDDXpNtYQgCWgQisuWk75CvkXQSlKfVEi6TCu0tGWMqgfphlCo3+cxA X9WrysUyOHw+z8awak1kazzmyLjTeie5G84iRigy2oofEvgO/uCcuLokhCeqWiGE0mVv HThSsZlCFR8Vs3+NmSuYkS8Gt0vCm+YXn3LfnXPlV2kjk98C8ysVvyDlulcf1hcs+GpN 5F6fX9/ZgpW231WHvHQDMqvBNVhWF9ORIRUl/ShlRCTV8gSC8i4XAxwHt27tzkt/Fl5R kyCw== X-Gm-Message-State: AOAM531qt6Rn5URt5tp9sA3he6IH7ima60Bd+fNzfxmN+8x3ecK8BAvo LsM5upeM5ObtMBWdPdr7Qr4= X-Google-Smtp-Source: ABdhPJyc/HO3grAQcFUIJnfhcX6uWZ2D+2fGT1OYThhgTjDokypeNOwJhS/gg+YtOR+srMXLSFZPcQ== X-Received: by 2002:aca:b387:: with SMTP id c129mr13189601oif.6.1639882084663; Sat, 18 Dec 2021 18:48:04 -0800 (PST) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:ad6a:ccd:800a:f7e5]) by smtp.gmail.com with ESMTPSA id i29sm2524221ots.49.2021.12.18.18.48.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Dec 2021 18:48:04 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::232 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=casouri@gmail.com; helo=mail-oi1-x232.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:282354 Archived-At: > On Dec 18, 2021, at 5:39 AM, Daniel Mart=C3=ADn = wrote: >=20 > Yuan Fu writes: >=20 >> It=E2=80=99s been a while and no one provided further comments on the = indent >> and font-lock integration of tree-sitter, so I finished the manuals >> for indent and font-lock integration. They are under 24.6 Font Lock >> Mode and 24.7 Automatic Indentation of code. Once the author of >> tree-sitter allow tree-sitter to change malloc implementation at >> runtime, tree-sitter integration will be ready. (Though I suspect = that >> won=E2=80=99t come soon. The author is still actively developing = tree-sitter >> but he didn=E2=80=99t reply to my request.) >>=20 >> As before, the code is at https://github.com/casouri/emacs on ts = branch. >>=20 >> Yuan >=20 > Thank you for your work. I had some troubles getting the latest code = to > compile, so I've sent you a pull request with potential fixes: > https://github.com/casouri/emacs/pull/4 I have signed the FSF papers. Yes, sorry, I forgot to push fixes after merging. I included your fix = for the switch case. Thanks. >=20 > I have a general question about the major modes. I see there's a = couple > of sample major modes, one for C and another for JSON, but they are in > tree-sitter.el. How would those new major modes be included with = Emacs? > Will there be a c-ts mode, separate from cc-mode, which will implement > font lock and indentation in terms of tree-sitter (when Emacs is > compiled with tree-sitter support)? Or the plan is to extend the core > language modes to offer an option to support tree-sitter? (I'm not = sure > how complicated and clean that would be.) They are just my experiments and I included them in tree-sitter.el as = examples for anyone want to try out tree-sitter. They will be removed = when tree-sitter integration merges into master. Each major mode should = optionally take advantage of tree-sitter features according to = tree-sitter-enable-p. (At least that=E2=80=99s my plan, no one has = objected to this approach so far.) Yuan