From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Fri, 17 Sep 2021 13:18:16 -0400 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 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15341"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Yuan Fu , Eli Zaretskii , Theodor Thornhill , =?windows-1252?Q?Cl=E9ment?= Pit-Claudel , Emacs developers , Stephen Leake To: =?utf-8?Q?Tu=E1=BA=A5n-Anh_Nguy=E1=BB=85n?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 17 19:20:49 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 1mRHXd-0003mp-Da for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 19:20:49 +0200 Original-Received: from localhost ([::1]:45936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRHXc-0000i2-0q for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 13:20:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRHVL-0007N0-9K for emacs-devel@gnu.org; Fri, 17 Sep 2021 13:18:28 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRHVE-0007W1-MV; Fri, 17 Sep 2021 13:18:23 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 24E4A10018A; Fri, 17 Sep 2021 13:18:19 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7EADE100054; Fri, 17 Sep 2021 13:18:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1631899097; bh=xEQZJn09UoU9EcxiN3GGwYbvf5oAAWNIO3/05H53hUs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WMuxaRTRZChlTKGkuOB+yNOy3y8DrBdyG9C0oL4ozsZ/BCTl+jSx/5i3X88ywBLwM ATVIzvcJu7cbZ55w+7pIeTWPdnMMojUhDs5deXLt6GNOPzrK8Wa0GXA7FaGvlFbZGp 1B2Z9n5LYCpYOWLm4n9F6A67gLx/gJt3ISC9WbuQW/RXl4NnSmbvX6UldM08J9nbBB TWVMkfa6TWuc1qR5kKf+EuaVUqhPut1/NSCsVAvNMe6sYgRZDe1i8kf8BvBEmO33st uZ9gfhbl0lwYwk1vtQGpGTPZm0ngM3ZtTdqilstwHUoTA6nb26ZHELgIQdimY/hP0O Oo2na3DF0aUnQ== Original-Received: from ceviche (modemcable063.211-21-96.mc.videotron.ca [96.21.211.63]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4881E120270; Fri, 17 Sep 2021 13:18:17 -0400 (EDT) In-Reply-To: (=?utf-8?Q?=22Tu=E1=BA=A5n-Anh_Nguy=E1=BB=85n=22's?= message of "Fri, 17 Sep 2021 20:39:27 +0700") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:274906 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 convenient > for users (not mode writers) to customize, e.g. in case a major mode hasn'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 . foo)) 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. So I'd start with just `tree-sitter-language-name` (which should anyway be the main/canonical way to provide the language's name). 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 ;-) Stefan