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: master 09b5f00613: ; Fix calls to treesit functions Date: Mon, 19 Dec 2022 16:12:31 -0800 Message-ID: References: <167138365421.15060.2886694741391315956@vcs2.savannah.gnu.org> <20221218171414.77B8EC0060F@vcs2.savannah.gnu.org> <831qowf54k.fsf@gnu.org> <916FA9FE-440F-4A8F-88FA-F08697EFCB3C@thornhill.no> 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="14602"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org, Eli Zaretskii To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 20 01:13:32 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 1p7QGB-0003cl-Qc for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Dec 2022 01:13:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7QFQ-0007b9-Ue; Mon, 19 Dec 2022 19:12:44 -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 1p7QFP-0007an-0P for emacs-devel@gnu.org; Mon, 19 Dec 2022 19:12:43 -0500 Original-Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7QFH-0006NI-B3; Mon, 19 Dec 2022 19:12:38 -0500 Original-Received: by mail-pl1-x629.google.com with SMTP id d7so10616881pll.9; Mon, 19 Dec 2022 16:12:34 -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=sBFwy9AN99sIB5mJ/1U3pvXARHH/LO/g0Lx/loUwQ6k=; b=F8hFJeV8eeaZvUaAgvv05SfNN8LEtDmByz9nakM3SvvSA11C5fAJRtjiMBdolFnmDc VCqLiuBJoL2tdbyh4qXigTzGtJfZ7qifMqKjhjSHMQwwlHwWhEESG5DhDGa9SO1s3ls8 ty6TOuo6bKCH6hqse0A+0XCDvmiHp2FjlKylPcQRib+IFHJEBX6uiSFarjMfoMmbpXwc eDhCIPfkj/1FHkzM9aNnwhhqToIsu7GBXlk1HWwbusGC29ggsucghMvLM8Zc8uFZV4/m zM7oJJY/N1WjKptywJf03QVfZnVszRTqhdiOu6926e3qBR3BYmqFSmXbniqEG5kQu0i1 CLRw== 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=sBFwy9AN99sIB5mJ/1U3pvXARHH/LO/g0Lx/loUwQ6k=; b=3+gn0s9SCsoYJOpK/pnJwPlJ4XgI3hi7Ab5a6LLPZDWKVRRLZ0kI9TQwghJAYTMXZj 8KB5JDOiRq5aiI1j5d/OrKhvAH82ypr/a7Yt79l315ckB+HrJ6fHt5Q90N4FPSNDLg1o 0BGNArLq29hDdXhkkcJ63o8iQytheb6RN0mWYSiA6k/Kffj7BT9aY7532xlPhiBD9KsL 5oKqygv6oDNCB+wb4Z7XXVbDqXxZ+KgkkUHWkEqO791O4sX6z7scw6BRudW9kq64V0NC p6eBmonV6Wprk4417/oB5PHpxbeTN/RhUIEwBZ02uzbksghaS8iS+lm5gsfkwrNbWykg NruQ== X-Gm-Message-State: ANoB5pkR3j5BiYT3UE7mbAxoKRvKGtXT2Ogbyu6EUXf2ckFPXePJzzWx UopJd0aNu/fqGC7VQed52n+VYJPBCKo= X-Google-Smtp-Source: AA0mqf65MMLEtN4qwb1h5dSyHDsHEWpjD09Q2Gx1sA54Iyizr0y2SKJBYBSDjOphubjR97RpokcIUA== X-Received: by 2002:a17:902:f646:b0:185:441e:224a with SMTP id m6-20020a170902f64600b00185441e224amr34195091plg.69.1671495153346; Mon, 19 Dec 2022 16:12:33 -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 jj11-20020a170903048b00b001783f964fe3sm7810118plb.113.2022.12.19.16.12.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Dec 2022 16:12:32 -0800 (PST) In-Reply-To: <916FA9FE-440F-4A8F-88FA-F08697EFCB3C@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=casouri@gmail.com; helo=mail-pl1-x629.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:301674 Archived-At: > On Dec 19, 2022, at 8:42 AM, Theodor Thornhill = wrote: >=20 >=20 >=20 > On 19 December 2022 17:13:00 CET, Stefan Monnier = wrote: >>> The treesit-parser-list is also kind of working just by accident, as >>> it isn't its job to ensure availability. >>=20 >> No, it's no accident: if Tree-sitter is not available, then indeed = the >> list of Tree-sitter parsers is empty. So defining that function to = return >> nil when Tree-sitter is not available is a perfectly correct = definition. >>=20 >>=20 >> Stefan >>=20 >=20 > Yeah, that's not what I meant. I meant that its primary purpose isn't = too be used as a guard against treesit not being available at all. I'm = fine with using it like this, but seeing how that wasn't enough by = itself we should either change it or make a similar function that has = that purpose. Fwiw I like your suggestion to make it available without = treesit being available. >=20 > Theo >=20 I expect the vast majority uses of tree-sitter involves calling = treesit-node-at (or treesit-node-on) to get a node, so that seems like a = good place to add a check. And I=E2=80=99ll make them use = (treesit-language-at (point)) by default, so that eliminates the need = for checking for a particular language. In addition we can make = treesit-parser-list work regardless of whether tree-sitter is built with = Emacs. How does that sound? Yuan=