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 09:14:17 -0400 Message-ID: References: <83r1f7hydn.fsf@gnu.org> <83r1dselyo.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="6662"; 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 15:15:08 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 1mRDhs-0001Zq-Ba for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 15:15:08 +0200 Original-Received: from localhost ([::1]:41478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRDhr-0006OD-2o for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 09:15:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRDhC-0005h5-MP for emacs-devel@gnu.org; Fri, 17 Sep 2021 09:14:26 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRDh9-0005Jy-Lp; Fri, 17 Sep 2021 09:14:25 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 238EE440BFD; Fri, 17 Sep 2021 09:14:20 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CE467440BF3; Fri, 17 Sep 2021 09:14:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1631884458; bh=LwtHU4FJVcJpM/iU7vzaKDGrb1prNLjMo8KAcDPbtbQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Sm7MHI8nEkPbMFjSy3VZJghWvs+emK0TvD6a8Oqfbe4PC56YJ4s00ynnwG4ZB0je2 Jb7+MZrv+451g6ZEuYPBgzbTItvYG+AUiW4cmG2Gh2DImNPAVXQK310gA+RkPRz0RL sfYfBslpOzrliadyZbfyUIAUoYRrv/4ibEe41L/9v65s5gb5mq6OPZqAbQNGoSWdy+ 5M4HS6/GTyh2IxzNXF+uygypfk0kYfF9CLP17QNYb7/8mdPBfBwOUtKy/oG1qi0nYC Y6Sd3uPIP4DHU9u3CknkHqOjC5EwKI2OR6jtUHYtOp6gjue4SaCNLiqy8GY3cigbDU FrZKpdr1KlSQg== Original-Received: from pastel (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6CC311202CE; Fri, 17 Sep 2021 09:14:18 -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 19:11:44 +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:274871 Archived-At: > (defvar tree-sitter-major-mode-language-alist > '((c-mode . c) > ;; And other major modes that Emacs includes, or are well-known. > (c++-mode . cpp) > (javascript-mode . javascript) > (python-mode . python)) > "Alist that maps major modes to tree-sitter language names.") Why not just `tree-sitter-language-name` which the major mode can set buffer-locally. (setq-local tree-sitter-language-name 'foo) is better than (add-to-list 'tree-sitter-major-mode-language-alist '(foo-mode . foo)) [ Among other things because it won't signal an error when `tree-sitter.el` is not loaded. ] Stefan