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: Sun, 18 Dec 2022 15:02:14 -0800 Message-ID: <47D9ABEB-EA9C-49DA-BC35-189A563DEC10@gmail.com> References: <167138365421.15060.2886694741391315956@vcs2.savannah.gnu.org> <20221218171414.77B8EC0060F@vcs2.savannah.gnu.org> 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="19681"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 19 00:03:08 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 1p72gV-0004xj-W1 for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Dec 2022 00:03:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p72fl-0004iz-43; Sun, 18 Dec 2022 18:02:21 -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 1p72fk-0004ir-6H for emacs-devel@gnu.org; Sun, 18 Dec 2022 18:02:20 -0500 Original-Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p72fi-0004DZ-I6; Sun, 18 Dec 2022 18:02:19 -0500 Original-Received: by mail-pf1-x42f.google.com with SMTP id 21so5094616pfw.4; Sun, 18 Dec 2022 15:02:17 -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=uiTJuzwd6DJ2lq5uJCf2KpAkaifrgIiZJ1E0SFyR5Z0=; b=jLX7xcglOla5/ViEZh7QkkoW+Agg6s29ftKFlqG6Buxq097dZH0DLQCWsfmlwJc91s s8KOrRsB5fVefLaTUJBDplhbUGdVr6B6a6DE8aGlHMpaF4OvpK09w59jqDanZtPoTv+j UdR8IVvUoYYWDEXWznYmD7JgQ2xSDj6/OOKg1hA/7B7xkz0pe1IjH3o+ALnu1DbccJak /M8lUg4EnvAjAvBegIhEpDRCGgek7RjIrW5mtbAJow0n5r6eT5Y4I+Q7h5ETRPK/TKpB BFQZm0R3F2VDqrI8svgcrjW2vSrkijitU4v/imFZE3P9YiWy+ve6q2oj/lzoGMZy+HlF Gt9w== 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=uiTJuzwd6DJ2lq5uJCf2KpAkaifrgIiZJ1E0SFyR5Z0=; b=MSKnGHQlp69AdG/dIVSwh/mruchinZnPeABF7eG2H3ki2Et/dC54UJZOf/hQOS23J+ EbO2nlVcoCD89nhc2iEO6euoWSj7ZGQIcBuF6PbvMPkaKBbvvPZT4Vuco0r/sTqxn4Xr q+mUlCKjFKJqG9uGhPwr50eQWhN82GV+8AkD7LJwxM3LyV8Gzp9bz6uMfZA5LHnqCoyq F5Fp6+254ZhIdK5Z6hjLNraB/LZWEs77E/MlQt/ofApWfC8Ri9apQ3+AEtC7p+eQlm5Y HDHO3AwZXKt9/uA3RglQJAOagH71l9VshFf5/nmO0W8SZis+k3CYIm5fIz5ZlZElwIYW 0w+A== X-Gm-Message-State: ANoB5pk35m1+nFtgOfHEigNS37tSDlchkv9c4AFixONSPoDPBJ49YnMT sjASM1UENOCppjqDB5+ikeU= X-Google-Smtp-Source: AA0mqf546rpSvJ3u3fFB/V5XU6hcnzCirlRGs0FTdkPTlGesg3u/jJ2S3l81Nk0sKnIQ06bPa3xUIA== X-Received: by 2002:a05:6a00:d67:b0:577:fdb8:e5fd with SMTP id n39-20020a056a000d6700b00577fdb8e5fdmr35657978pfv.2.1671404536755; Sun, 18 Dec 2022 15:02:16 -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 k74-20020a62844d000000b00576e4c7b9ecsm5094265pfd.214.2022.12.18.15.02.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Dec 2022 15:02:16 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=casouri@gmail.com; helo=mail-pf1-x42f.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:301621 Archived-At: > On Dec 18, 2022, at 12:19 PM, Stefan Monnier = wrote: >=20 >> +(declare-function treesit-available-p "treesit.c") >> (declare-function treesit-parser-list "treesit.c") >> (declare-function treesit-node-type "treesit.c") >>=20 >> @@ -156,7 +157,8 @@ or follows point." >> (interactive "P") >> (save-excursion >> (let ((treesit-text-node >> - (and (treesit-parser-list) >> + (and (treesit-available-p) >> + (treesit-parser-list) >=20 > How 'bout always defining `treesit-parser-list` (and making it return > `nil` if Emacs was compiled without Tree-sitter support)? >=20 > Most places that can make use of Tree-sitter probably would probably > prefer not to have to worry about the subtle distinction between > "Tree-sitter support is available but not for this major mode" and > "Tree-sitter support is not available at all=E2=80=9D. That makes sense. Also, anyone using tree-sitter functions needs to = declare functions in treesit.c in case Emacs didn=E2=80=99t build with = tree-sitter. Should we streamline it with a macro like this? Would it = work? (defmacro treesit-declare-c-functions () '(progn (declare-function treesit-node-child "treesit.c") ...)) (eval-when-compile (require 'treesit) (treesit-declare-c-functions)) Yuan