From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Sat, 18 Sep 2021 09:16:21 +0700 Message-ID: References: <83r1f7hydn.fsf@gnu.org> <6A4CE984-6ACE-4E66-8EF2-F3D351C02248@gmail.com> <83r1dscpt2.fsf@gnu.org> <83o88wcof9.fsf@gnu.org> <83lf3zdh4z.fsf@gnu.org> <8965C4A0-79D3-4D77-A6BA-D07A6C93F7FE@gmail.com> <83ilz3cs4k.fsf@gnu.org> <04D19C1A-CD64-4156-B932-1C9FEEE4EC7B@gmail.com> <83zgsebc0r.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> 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="12586"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuan Fu , Theodor Thornhill , =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= , Emacs developers , Eli Zaretskii , Stephen Leake To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 18 04:17:25 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 1mRPuv-0003A4-IM for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Sep 2021 04:17:25 +0200 Original-Received: from localhost ([::1]:44130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRPuu-0001Es-EZ for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 22:17:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRPuF-0000Xg-NI for emacs-devel@gnu.org; Fri, 17 Sep 2021 22:16:43 -0400 Original-Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:42884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRPuC-00055D-Cd; Fri, 17 Sep 2021 22:16:43 -0400 Original-Received: by mail-pf1-x42b.google.com with SMTP id q23so8748483pfs.9; Fri, 17 Sep 2021 19:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gGVxX3LB/V1+QSotUEn5eVtdm26wKMt9STiMtXmQd4g=; b=i7jw0fGcSUBUTgEO1IZikTfMFgdvs+G1uMVuQhSvQgR0dPAOsc3V7gz/+idt0SnVZv YmLJHAJq/xF3ex/5gXvTH8Zqm4DQkg962+89F3pHSYRNGNz4uNjMzjdhzmdCsX3jhS3A Y/IIFpSf8hGYiTdY6TtwVPws2rNcTaB+NC8rw5Mp4slixeCjoopkTXJr5ZcH06BC5HOW W3JrQEDZZy9cFOV54B/lDLfpVNHeRpIREjWH8+1yVam5xFvZrgP7+F9aT7lWpDyMcvj7 T31iYV8h66dgGYYVXThtROCLUcxH4AFYXTwsve2x8NYZ/pvJ5kO07MT73kAYPKtoBsmR 3SGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gGVxX3LB/V1+QSotUEn5eVtdm26wKMt9STiMtXmQd4g=; b=Us2jM/KDTzQBhza+JMgZw1E3STkGA31ZblK+RmQwAgtxYB5Uviq2jvf7m3s5tMvcXb +pqNbhHnrhUOeQfgqopy+Zzz/DDW6UeUQtzRNY09GOYOwzD0wfE3QemsliyKoUyWO1ax kjiuQtKJf/oB2GM3JcyzzBknwKL2pViLRmooidIWmCOtdLi2NMIzfPBLdxZZ6vwT3wN5 atG+YwYNf4IGdNDspwRb6gBiPETFHt6J2TZy0wDmW0788KqYFkfsf2sbxeO1NtrG3eNa I96fvdZHrkj9BfSv2h3FQ2OvvMpX4hufn0MH4kPCNW2DGR4smoPRKivyyKKEOFB9dD34 sLpg== X-Gm-Message-State: AOAM5312uZiJPfVtOcNR2mWYUGHk8KlMbhgsHz4n7835Afn/ReooF6be h9CUxNzgE55Y2uTWLdzNuRhiURc8oEZjs/D/WYk= X-Google-Smtp-Source: ABdhPJyPJ3+W/3kjgz6iXjrd6CxswBRdv87DpWC5y57ny8Oadm10ky4bf/n7KxbbnKh7PN63v52iVsPSE4mn+mgHMY8= X-Received: by 2002:a65:4486:: with SMTP id l6mr12776363pgq.145.1631931398415; Fri, 17 Sep 2021 19:16:38 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=ubolonton@gmail.com; helo=mail-pf1-x42b.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.23 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:274950 Archived-At: > > It can be both, with one being the underlying mechanism for the other. = (That's > > what I do in my packages.) The alist is a central place that's more con= venient > > for users (not mode writers) to customize, e.g. in case a major mode ha= sn't > > added itself yet: > > > > (add-hook 'foo-mode-hook (lambda () (setq tree-sitter-language-name= 'foo))) > > > > is less convenient than > > > > (add-to-list 'tree-sitter-major-mode-language-alist '(foo-mode . fo= o)) > > Since in most cases TS support will require a fair bit more than just > the language's name, I'm not sure it will be useful for very many users. It has been useful (not "will be"). Of course it's more than just the langu= age's name. > So I'd start with just `tree-sitter-language-name` (which should anyway > be the main/canonical way to provide the language's name). Yes, that's a good start. > An alist indexed by a major mode is a "design smell" in my book. > > >> [ Among other things because it won't signal an error when > >> `tree-sitter.el` is not loaded. ] > > We can make `tree-sitter-major-mode-language-list` autoloaded. > > Autoloaded variables are also a design smell ;-) These are non-arguments, but let's move on. This is among the most trivial = ones in the list of design decisions to make for tree-sitter integration. We don= 't need to spend more time on it. --=20 Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n Software Engineer