From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Feb 2023 19:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 61235@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167536721626765 (code B ref -1); Thu, 02 Feb 2023 19:47:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Feb 2023 19:46:56 +0000 Received: from localhost ([127.0.0.1]:35834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNfXr-0006xd-Ma for submit@debbugs.gnu.org; Thu, 02 Feb 2023 14:46:56 -0500 Received: from lists.gnu.org ([209.51.188.17]:59062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNfXq-0006xU-6e for submit@debbugs.gnu.org; Thu, 02 Feb 2023 14:46:54 -0500 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 1pNfXp-0003uK-VG for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 14:46:53 -0500 Received: from mail-am7eur03on2136.outbound.protection.outlook.com ([40.107.105.136] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNfXm-0005Vf-Eu for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 14:46:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P3Wnhxn7Nv6AFnv519u/bF2mCj8FwQpb86gxlDaCXPCFjonPEO69mKcVa2aZ4puLoMPoiG4wYTpmqadDZtUjtIm1ePETqi9mVoD7JsvcXH5M32uOYpEy7XEm3YOqa1MSzNWkLqVVbsqWvWnLnMZ7LJoUUApPbCi4kPX3+nDfYZi5h6IF1/U4k0Sy7vicedaywEZJS0PRIC8AyYTwyVi62a0bCGKLadg54umEB57cn5Hslh+e9vdBVaT7b5J6+ZN7xU5jZq5AR8b5HN11gmxy/lyJcROlgMkec2Maa1qeVHVsVPoj729cg+ddZmZqKLt57wIV60x044HPtQ5JJaBDGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=77LLB3ELvbYHscYtxRTKCH4iNZiElHfKdqvacZ59aWo=; b=WGsVcXclkJTXje2p4pdbNjM1qt9AKPNmHZ0QHQ2s6GfL7MyB7B6ZUJrEa9l/slu681uHCDGda2rlmJukojIW9XOYchef9pU5+7zpaWVc5pujUkDgL9HpmGX0vJc0y8M6uuekMsFZVFjLkdU1ANGcOURwmBG0JKmm/+1oo+a/HpsNSD65wtCuMzceGOV3BZLzjW4tCdW78/D73gm2kiMezenFAYgtLZpCB+LYydtwOlXN1nzv96f/iBp2YcPL7AD2wisl9ihu0bZ4atDUH/B8MWvuBXjQ4oHAjjGRLBvaYCAkcXPK3qroJrya1pHkBXePd6VmkiSamOdW72UwKgJQIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=77LLB3ELvbYHscYtxRTKCH4iNZiElHfKdqvacZ59aWo=; b=Kpb33RPB9aWFdgTF2LwZNX2ONPesvwA6DmQ4AV/KJ5OtvcAeiljWKnj8V4i+gb9fBwOBcWC5j0jhfrIOWeCmvcLacB8POFkcbiWpRtBxAp4B1YatZTe/K8vUjRt+YmDKlLjfmYX8XfFcAzIpQbVTUuWsVtZo12b9esL5uGni3dg= Received: from CWLP265CA0531.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:18d::23) by LO0P265MB6326.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2d1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.24; Thu, 2 Feb 2023 19:46:47 +0000 Received: from CWLGBR01FT021.eop-gbr01.prod.protection.outlook.com (2603:10a6:400:18d:cafe::24) by CWLP265CA0531.outlook.office365.com (2603:10a6:400:18d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 19:46:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by CWLGBR01FT021.mail.protection.outlook.com (10.152.40.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 19:46:46 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 9B5F1114002; Thu, 2 Feb 2023 19:46:46 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1675367206; bh=77LLB3ELvbYHscYtxRTKCH4iNZiElHfKdqvacZ59aWo=; h=From:To:Subject:Date:From; b=UZBHyUfD4WYWVjX4Uwk5o4agnm8wrPPcTMhjcC16lEiE00POocAflafDPKaoLOqTR XHMTzQ8m4enR97yOzSGYo0hVLnIxJfoBc5q1S1W3dq/hZGVQAAh3CzCfKFTxpnrdvL GDtof/o0XSixuoM6T5cK3Wyalu2CRQS1CT4IGyuQ= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 From: Mickey Petersen Date: Thu, 02 Feb 2023 19:46:41 +0000 Message-ID: <87h6w3hmu6.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLGBR01FT021:EE_|LO0P265MB6326:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 117b9f0b-8c48-4344-3a18-08db05563822 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yLqzleeuxNU759aHHvkRwgzqOEjKGToAimgh3NnQbUDR2OmIuF7u9DF15sgBFzjLFkxF7ZFuBPGngFZFVAC99Y+bo9r9FHqkYMKHT67hzexmVWmtEyP/rk8kSaALmNqoA1UZPHCWNC4a73gKmXTKlv4F+9vqOkfaQpnSZ6Hc42C7kl2+/WoGh0hewGsAPCX9zDKelb+IGWqd2dv85qJYTZmI1vqVIXIOVKHU+oCoItT9RSDRXUrGd47DGcG5lpMDHoCiliIKUc92X4e9FQsFZbcanZqjAI+AYo+MSJQn/aTPWcsQiVRrXbRZzfoHQQkg0e/UaJDGA/ni1TW7Fg3gejICpvRuDScLVDd4fhDTtc0XETTuH2yyYcv0Ii/A2vuJsEeVCKkBRAOIisLVQjCOW3SvUPUXdyT8kuOm4KNXcJ4gQ8M+x+miLtzT0LyTZ4KivKpS7gZSXryNtwlDT01QcJgHu426HajI7xrD8H3AQqObpvfRYjUWaOPI5UPvnJ9WB7D7i+xwpAkCYT4dWvS/aGrbZ0ySgu4ThvredqiZGKn+BDVzgJLlzgesqpTTrwfeTU6kXswDCioUyZzaPtwlkKEM/QMa5G/zRpwrUgLN79u3NqAmnTfFapQVspAbbHmAYxPRouspj5+UEy+ZmxauGfLG3+/2UikKDrDF/oN2Yj6NdcTnLNwjzCpsENhGTHLIABwmiTCRp31I9XhahQlxa5ntMpP1WVqdPJ+mltQJH3nSslvT61/dy6wzRs6L6a8TKgKP2P+N+CRDlfWhpFPSNDl4fJu9JAcbRPF6QghJ7NMR4dn82DP0XmGrn6l/8QgW X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(346002)(39830400003)(136003)(396003)(376002)(451199018)(36840700001)(46966006)(70586007)(47076005)(6916009)(70206006)(36860700001)(41300700001)(8676002)(8936002)(6666004)(83380400001)(5660300002)(336012)(7636003)(478600001)(7596003)(40480700001)(42186006)(86362001)(82310400005)(316002)(2906002)(36756003)(2616005)(356005)(26005)(6266002)(186003)(38230200001)(81973001)(43043002)(14776008)(79816003); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 19:46:46.9525 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 117b9f0b-8c48-4344-3a18-08db05563822 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: CWLGBR01FT021.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB6326 Received-SPF: pass client-ip=40.107.105.136; envelope-from=mickey@masteringemacs.org; helo=EUR03-AM7-obe.outbound.protection.outlook.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) There's no way to tell if a node belongs to a now-deleted parser. Checking if it is `missing' or `outdated' returns nil; there is no way to ascertain this state except by catching an error if you try to get its node text, type, etc. In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-01-25 built on mickey-work Repository revision: 8b87d095acfb23b527f955873a59dd9c13ffc9b4 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.3 LTS Configured using: 'configure --with-native-compilation --with-json --with-mailutils --without-compress-install --with-imagemagick CC=gcc-10' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser References: <87h6w3hmu6.fsf@masteringemacs.org> In-Reply-To: <87h6w3hmu6.fsf@masteringemacs.org> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 04:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mickey Petersen Cc: Eli Zaretskii , 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167565748728282 (code B ref 61235); Mon, 06 Feb 2023 04:25:01 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 04:24:47 +0000 Received: from localhost ([127.0.0.1]:47122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOt3f-0007M6-Ce for submit@debbugs.gnu.org; Sun, 05 Feb 2023 23:24:47 -0500 Received: from mail-pj1-f51.google.com ([209.85.216.51]:55082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOt3d-0007Ll-VH for 61235@debbugs.gnu.org; Sun, 05 Feb 2023 23:24:46 -0500 Received: by mail-pj1-f51.google.com with SMTP id mi9so10458560pjb.4 for <61235@debbugs.gnu.org>; Sun, 05 Feb 2023 20:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=41iM6mgiUkQwqyHfSO5HQVfUI6NNBepwrUtxTFaLwgc=; b=LoiG3r3PWaa70FcVhbmitlkTGFq7s+rsMFtcR6utrETihjedvwk4JGuviiStcb+cEh OK7w0pf50MEXOIKw4Jamp+XzBhE2lSTJQfGA7yMKnGiwly3Ism3Z9lwIGSIDq9Wzc5qt bIpFW8+X1yoFZgCfgAInsDS2AWP4wrp2014FbOOCMMnzr4pFPld/k/exOEoM43y0gFET IP8+WAbNZOl7zNP83DK9jIWzgoWNcFR676G8oTtpVLjJ7a3XctC/zgvuKHgPzOmkSudR l3WfV7tgr0DdnqblZuUdDxJ+5lGn9HW5yf2avaTFZU/0E2WZSgveRswfGDYHuOvoIE35 arqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=41iM6mgiUkQwqyHfSO5HQVfUI6NNBepwrUtxTFaLwgc=; b=IO9K6mdvrYZfqUI+dteQCxvdLe4xZpF1ikF8VvfK2LxWfaL2zazdh8RKa+jKw4bd0c pYiH2Z5+GAskxd6zrHbj3gltiixmF8GfR8Vkh/qzTz9bNsxSCs+yOT5qP9Qp1VuL4FXb SY0/o0v+Cao1kRNh2hwCvv3GD4oYU2bDCQHX1nrmS7DwwNArmv7LIz8PmXQt9TxvXnhZ Qcjc7/2BGH0nS1Vj6GS39rHNdCI0VnSXjDnZbq8t9bKywOZx3Hw7Z7QThukPwq3qfofA jCPfrBft5kzss1By91jObtRF+CYeFzjRRoSs1dgU/qCB46gq9qklAEfLcF61nP9bQsBd XeQA== X-Gm-Message-State: AO0yUKW+g5Cs9n+zMbSyb7KvKqQBxQRUsBEa/EnwFydReiZfvsx7iDsc rRSo4BrXKKq/p/3CvtUvn54= X-Google-Smtp-Source: AK7set9mmsZiJ7HhN5zm6W6RxWAQzJeAu7NMSM9NivWWuqbbrDY0E7e4k6xCJmwnzHNimmkpDMEtLA== X-Received: by 2002:a17:903:24e:b0:196:5472:c115 with SMTP id j14-20020a170903024e00b001965472c115mr22002157plh.41.1675657479895; Sun, 05 Feb 2023 20:24:39 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id e6-20020a170902d38600b00192aa53a7d5sm721117pld.8.2023.02.05.20.24.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Feb 2023 20:24:38 -0800 (PST) From: Yuan Fu Content-Type: multipart/mixed; boundary="Apple-Mail=_6AFB3945-DC39-407B-BB3E-755BC1D363A3" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Message-Id: Date: Sun, 5 Feb 2023 20:24:27 -0800 X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_6AFB3945-DC39-407B-BB3E-755BC1D363A3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Mickey Petersen writes: > There's no way to tell if a node belongs to a now-deleted > parser. Checking if it is `missing' or `outdated' returns nil; there > is no way to ascertain this state except by catching an error if you > try to get its node text, type, etc. That sounds reasonable. I can add treesit-parser-live-p, and add a "live" PROPERTY to treesit-node-check. treesit-parser-live-p only returns t when the parser is not deleted AND its buffer is live. I assume that=E2=80=99s more useful than just = checking whether the parser is deleted, for whatever usecase you have? Eli, should we add this in the release branch or Emacs 30? This functionality is possible to implement in Elisp, albeit a bit clunky. I attached a patch of how would it look like (without documentation/test). Yuan --Apple-Mail=_6AFB3945-DC39-407B-BB3E-755BC1D363A3 Content-Disposition: attachment; filename=livep.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="livep.patch" Content-Transfer-Encoding: quoted-printable =46rom=209d7651bb7b97faff034186a2667d90e42f6f9e5b=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Sun,=20= 5=20Feb=202023=2020:22:52=20-0800=0ASubject:=20[PATCH]=20Demo=0A=0A---=0A= =20src/treesit.c=20|=2027=20++++++++++++++++++++++++---=0A=201=20file=20= changed,=2024=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/src/treesit.c=20b/src/treesit.c=0Aindex=208e772523cc7..94c523950d1=20= 100644=0A---=20a/src/treesit.c=0A+++=20b/src/treesit.c=0A@@=20-1471,6=20= +1471,20=20@@=20DEFUN=20("treesit-parser-language",=0A=20=20=20return=20= XTS_PARSER=20(parser)->language_symbol;=0A=20}=0A=20=0A+DEFUN=20= ("treesit-parser-live-p",=0A+=20=20=20=20=20=20=20= Ftreesit_parser_live_p,=20Streesit_parser_live_p,=201,=201,=200,=0A+=20=20= =20=20=20=20=20doc:=20/*=20Check=20whether=20PARSER=20is=20not=20deleted=20= and=20its=20buffer=20is=20live.=20=20*/)=0A+=20=20(Lisp_Object=20parser)=0A= +{=0A+=20=20treesit_check_parser=20(parser);=0A+=20=20if=20(XTS_PARSER=20= (parser)->deleted)=0A+=20=20=20=20return=20Qnil;=0A+=20=20else=20if=20= (NILP=20(Fbuffer_live_p=20(XTS_PARSER=20(parser)->buffer)))=0A+=20=20=20=20= return=20Qnil;=0A+=20=20else=0A+=20=20=20=20return=20Qt;=0A+}=0A+=0A=20= /***=20Parser=20API=20*/=0A=20=0A=20DEFUN=20("treesit-parser-root-node",=0A= @@=20-1904,7=20+1918,8=20@@=20DEFUN=20("treesit-node-check",=0A=20=20=20=20= =20=20=20=20Ftreesit_node_check,=20Streesit_node_check,=202,=202,=200,=0A= =20=20=20=20=20=20=20=20doc:=20/*=20Return=20non-nil=20if=20NODE=20has=20= PROPERTY,=20nil=20otherwise.=0A=20=0A-PROPERTY=20could=20be=20`named',=20= `missing',=20`extra',=20`outdated',=20or=20`has-error'.=0A+PROPERTY=20= could=20be=20`named',=20`missing',=20`extra',=20`outdated',=0A= +`has-error',=20or=20`live'.=0A=20=0A=20Named=20nodes=20correspond=20to=20= named=20rules=20in=20the=20language=20definition,=0A=20whereas=20= "anonymous"=20nodes=20correspond=20to=20string=20literals=20in=20the=0A= @@=20-1920,7=20+1935,9=20@@=20DEFUN=20("treesit-node-check",=0A=20the=20= node=20was=20created.=0A=20=0A=20A=20node=20"has=20error"=20if=20itself=20= is=20a=20syntax=20error=20or=20contains=20any=20syntax=0A-errors.=20=20= */)=0A+errors.=0A+=0A+A=20node=20is=20"live"=20if=20its=20parser=20is=20= live=20(i.e.,=20not=20deleted).=20=20*/)=0A=20=20=20(Lisp_Object=20node,=20= Lisp_Object=20property)=0A=20{=0A=20=20=20if=20(NILP=20(node))=20return=20= Qnil;=0A@@=20-1943,9=20+1960,11=20@@=20DEFUN=20("treesit-node-check",=0A=20= =20=20=20=20result=20=3D=20ts_node_is_extra=20(treesit_node);=0A=20=20=20= else=20if=20(EQ=20(property,=20Qhas_error))=0A=20=20=20=20=20result=20=3D=20= ts_node_has_error=20(treesit_node);=0A+=20=20else=20if=20(EQ=20= (property,=20Qlive))=0A+=20=20=20=20result=20=3D=20= Ftreesit_parser_live_p=20(XTS_NODE=20(node)->parser);=0A=20=20=20else=0A=20= =20=20=20=20signal_error=20("Expecting=20`named',=20`missing',=20= `extra',=20"=0A-=09=09=20=20"`outdated',=20or=20`has-error',=20but=20= got",=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "`outdated',=20`has-error',=20or=20`deleted',=20but=20got",=0A=20=09=09=20= =20property);=0A=20=20=20return=20result=20?=20Qt=20:=20Qnil;=0A=20}=0A= @@=20-3444,6=20+3463,7=20@@=20syms_of_treesit=20(void)=0A=20=20=20DEFSYM=20= (Qextra,=20"extra");=0A=20=20=20DEFSYM=20(Qoutdated,=20"outdated");=0A=20= =20=20DEFSYM=20(Qhas_error,=20"has-error");=0A+=20=20DEFSYM=20(Qlive,=20= "live");=0A=20=0A=20=20=20DEFSYM=20(QCanchor,=20":anchor");=0A=20=20=20= DEFSYM=20(QCequal,=20":equal");=0A@@=20-3577,6=20+3597,7=20@@=20= syms_of_treesit=20(void)=0A=20=20=20defsubr=20(&Streesit_parser_list);=0A= =20=20=20defsubr=20(&Streesit_parser_buffer);=0A=20=20=20defsubr=20= (&Streesit_parser_language);=0A+=20=20defsubr=20= (&Streesit_parser_live_p);=0A=20=0A=20=20=20defsubr=20= (&Streesit_parser_root_node);=0A=20=20=20/*=20defsubr=20= (&Streesit_parse_string);=20*/=0A--=20=0A2.33.1=0A=0A= --Apple-Mail=_6AFB3945-DC39-407B-BB3E-755BC1D363A3-- From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 12:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 61235@debbugs.gnu.org, mickey@masteringemacs.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167568688323047 (code B ref 61235); Mon, 06 Feb 2023 12:35:02 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 12:34:43 +0000 Received: from localhost ([127.0.0.1]:47539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP0hn-0005zd-D6 for submit@debbugs.gnu.org; Mon, 06 Feb 2023 07:34:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP0hm-0005zN-6V for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 07:34:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP0hg-0000tC-Bx; Mon, 06 Feb 2023 07:34:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=MOH48D7LkArLHpREmJrFzIODnnw21qXHHvEz8zpspxU=; b=ECUiZKpQYrZ2 fPMOm2ehKGyFDMZnpyh4kY0MTqyF8U0zGHcpqDzUQmrAcn07LmBvv8czQWWIhqFfOIsfLz24B3cTM eMx49wx2e4/GFXwY15cIte0zRNe61JKTWIVlHczKyTjLQNUnjIPz9Iz62C6HrOym072bOfXnC4bFd 6dMTbr3MDll8zBKgCzhdTDr+g/5dFPfICYvxMAwjRS2BaxyyoL86vpbddbfm/hE02k/CFAt1PokAz 0SrMNKKjZMiJj4r8vEj1CAI0t8QqOFbdigGzKz2KSAODfo7mbeRuZR9nRrVymKOAqZ4agrz2sbbVY 6jXiT9/9o2jeE3UkDQ8PvQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP0hc-0007fX-Bq; Mon, 06 Feb 2023 07:34:35 -0500 Date: Mon, 06 Feb 2023 14:34:44 +0200 Message-Id: <83edr3q8ez.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Sun, 5 Feb 2023 20:24:27 -0800) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Sun, 5 Feb 2023 20:24:27 -0800 > Cc: 61235@debbugs.gnu.org, > Eli Zaretskii > > Mickey Petersen writes: > > > There's no way to tell if a node belongs to a now-deleted > > parser. Checking if it is `missing' or `outdated' returns nil; there > > is no way to ascertain this state except by catching an error if you > > try to get its node text, type, etc. > > That sounds reasonable. I can add treesit-parser-live-p, and add > a "live" PROPERTY to treesit-node-check. I'm not sure I understand the need. AFAIU, a parser is deleted only if we call treesit-parser-delete; are we saying that a Lisp program doesn't know that it deleted a parser? What exactly is the practical situation where this problem happens, and why? Frankly, I don't think we should at this stage add APIs without a very good reason. We should instead collect experience, both from users and from Lisp programs, and analyze them before deciding whether more APIs are necessary. > +DEFUN ("treesit-parser-live-p", > + Ftreesit_parser_live_p, Streesit_parser_live_p, 1, 1, 0, > + doc: /* Check whether PARSER is not deleted and its buffer is live. */) > + (Lisp_Object parser) > +{ > + treesit_check_parser (parser); > + if (XTS_PARSER (parser)->deleted) > + return Qnil; > + else if (NILP (Fbuffer_live_p (XTS_PARSER (parser)->buffer))) > + return Qnil; > + else > + return Qt; > +} Doesn't treesit_check_parser signal an error if the parser was deleted? If so, how will the above be useful, if someone wants to avoid errors? From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 12:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Yuan Fu , 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167568713323497 (code B ref 61235); Mon, 06 Feb 2023 12:39:02 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 12:38:53 +0000 Received: from localhost ([127.0.0.1]:47543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP0lg-00066k-3S for submit@debbugs.gnu.org; Mon, 06 Feb 2023 07:38:52 -0500 Received: from mail-vi1eur05on2108.outbound.protection.outlook.com ([40.107.21.108]:26081 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP0le-00066R-9c for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 07:38:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IOCJwuDzECu4kB2s7rU3toOcDwLIj5BqWVhYBSOej0GdX39ST2s4NLJrKG5MZsbasWUxspNji6FWA/dY56LRdpIwUdGkPZtE2RiEYJGE1Kj7Y6GLRZFQkJt4rgjAET/3HD6vvRy747K81Ec6lvwXp4/hJBWdA2g0Rht0Hru0Jmjl+IA6MGV7dS29yCqFtjx0+9Fb4fg/rpKM24DV1wXfSLt2zK0bijKg71fbl+ecA9Kf25MGL3cLweYmk5CihULwGLLmNwbesp81ol4LL91Wlmol0Ez0cI22f1x2aFtEg+L0iPHpOt+N91sYaAgFT9vC4khDGEgPmrZKbXU1HEouxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8SDH/8NKfGvG8E9SbwmbACDJI5JLajHe5jDOij5mUv4=; b=cLrCGUR7czBmaGK9eLid/Nq8SdVhjkoXijXFj32LS2jZh7E4QxNAPWj5ivgH9JqpA8ppEc6Dtr6im3R9Pgxobp7IeZ2JypKvkuXYpRyTaFfut97gLTFcdM4pcBKEg+RaQA1bDTsLfKRteFphQSJ/qmXlgzQQv/S5KHYRphHICJyJ9+avKW84PEwjsEBuM5OYKYiT+MeWE3rs8CAUMljXG8ueu9qVjm4YrIX042BhET2y2NR/2+YcVhOQunoEENw2kqP/xllN8af/yUlPW2PeDmujQCWLR85YHJWCJKor8y40BWD+iOaPhVS2ep9fh/oiPmzW6nwn9KURIf8oO6vvyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8SDH/8NKfGvG8E9SbwmbACDJI5JLajHe5jDOij5mUv4=; b=ngqtFB+WnCa1Dcj4+l4Btr2H9dolknonICjuW0Rb0zNWb0SqzYCrAG8TqWzGVRVjABVLOYx6SsrvKmpxxCrwPN1DVRe97rg5HCNV3TzovzrGCa6z7sQigKSI/fJkPBHjwhbCn7RZnPRTobUGwchybdJIkzwf5xLVhiK5MMPzIzY= Received: from LO4P123CA0247.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a7::18) by LO3P265MB2092.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 12:38:35 +0000 Received: from CWLGBR01FT021.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:1a7:cafe::eb) by LO4P123CA0247.outlook.office365.com (2603:10a6:600:1a7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 12:38:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by CWLGBR01FT021.mail.protection.outlook.com (10.152.40.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.32 via Frontend Transport; Mon, 6 Feb 2023 12:38:35 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 173D9114002; Mon, 6 Feb 2023 12:38:35 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1675687115; bh=GwjubfLwWl5n4m2vSVplInNKY9b+oVOSeQJ962oaVjY=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=n98eJqbHBW/0T3FBCn6ZCK+6oH9awWQGmXFjfynuohse6owUGh2cjAUVTjswskCmt ACqXzwFUGpO5/qEUBsJh0Ez61LiHlKgO2Ubwo6iNConjp2XlXMyINpyIFY7xB5HllQ 73SUc8eHdVCIHh8Cze5YuvvjWdKvjjjg5QmYtd80= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 References: <83edr3q8ez.fsf@gnu.org> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen Date: Mon, 06 Feb 2023 12:35:20 +0000 Organization: Mastering Emacs In-reply-to: <83edr3q8ez.fsf@gnu.org> Message-ID: <87o7q7dl4o.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLGBR01FT021:EE_|LO3P265MB2092:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e039b944-ce63-458c-fb34-08db083f1056 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1aa/v67kpbj991WUxGH9CukWBXXeIJFgan989578Ui33m7CNMzokQbUncOEvP2JZMWhwR9CKzSu7TRdCV24lkzgdIl4KKO9opwoh8jf3JglWBnHTiGyDlkbGZQwUV/dbtl13KiEgbzmQERQ9QxGFixyePpkqE9Eg/pi+hm8OTmGaB1NJB2mGJ6zAwOvXRbPuR6PjiWevz0c+DLsa9LAGJ75LPkijWzrFRX1z7Ef9dzTVjzog/qj9QDQS20vNdHTcXSX817IF1w0VotlC8DpUaYGzimRcvROM6I8obHC1L0vKO+/pEJvnBF3ujr3eNVK//B9zznC+H3+lUMUKHD4ejK3AW6EgyZors12KnpygoO8tnps7U0wPKSomHxR64dsSBU5mR5A+E23FL5X29/CajaeWKUKVG5aiksaipp1hI2j7cgKnrxjGqqGZ+ucHZPjVGnRnAUZG0xL6Cn2WToYGLh79ekrdQf4iEy4FvUq33GHoG2BbpfpiIE61JRTClVhPewZUwF0rH8WLFjH4rmzFj0oo2MrdclePelEEtY1JYOuV/scyAhkX++HU3OaoqgCXZyoZLj/kpBqnxr97YLftd+VfKNCVIeU5iSnE8/k92fnAg60sBD0NgX2eySNuHgsTiRCaVFl9rZSU2VGbvQk6VA0wK2YV/wy3P++u7nd8A0ulxI+/uuj13QH0S5Gl/ZphGky0KHRpKQ14PVfBN0Qyy5f50W4yIpJg5bBJAOQG7O2eYqX8bN6J9+Q3SYGDvOGb5b6RUrG3dDWIYJtm5g7tCHETeLt7Ua5s7KtAWHp+ByB3RbeeZfH0mlfTp2JeINLC X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(136003)(376002)(39830400003)(346002)(396003)(451199018)(46966006)(36840700001)(6266002)(478600001)(36916002)(42186006)(316002)(186003)(2616005)(6666004)(26005)(82310400005)(36756003)(5660300002)(86362001)(40480700001)(7636003)(7596003)(83380400001)(336012)(47076005)(70206006)(4326008)(8676002)(2906002)(70586007)(356005)(8936002)(36860700001)(41300700001)(6862004)(38230200001)(81973001)(43043002)(14776008)(79816003); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 12:38:35.2529 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e039b944-ce63-458c-fb34-08db083f1056 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: CWLGBR01FT021.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO3P265MB2092 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Yuan Fu >> Date: Sun, 5 Feb 2023 20:24:27 -0800 >> Cc: 61235@debbugs.gnu.org, >> Eli Zaretskii >> >> Mickey Petersen writes: >> >> > There's no way to tell if a node belongs to a now-deleted >> > parser. Checking if it is `missing' or `outdated' returns nil; there >> > is no way to ascertain this state except by catching an error if you >> > try to get its node text, type, etc. >> >> That sounds reasonable. I can add treesit-parser-live-p, and add >> a "live" PROPERTY to treesit-node-check. > > I'm not sure I understand the need. AFAIU, a parser is deleted only > if we call treesit-parser-delete; are we saying that a Lisp program > doesn't know that it deleted a parser? What exactly is the practical > situation where this problem happens, and why? > > Frankly, I don't think we should at this stage add APIs without a very > good reason. We should instead collect experience, both from users > and from Lisp programs, and analyze them before deciding whether more > APIs are necessary. > Because node references are retained even after a parser is deleted. Retrieving a node; somehow deleting the parser (maybe you closed the buffer, or you were doing some off-hand parsing); and then doing _anything_ with the aforementioned node yields an error for which there is no way to test for. This is particularly the case when you mix and match parsers in the same buffer. >> +DEFUN ("treesit-parser-live-p", >> + Ftreesit_parser_live_p, Streesit_parser_live_p, 1, 1, 0, >> + doc: /* Check whether PARSER is not deleted and its buffer is live. */) >> + (Lisp_Object parser) >> +{ >> + treesit_check_parser (parser); >> + if (XTS_PARSER (parser)->deleted) >> + return Qnil; >> + else if (NILP (Fbuffer_live_p (XTS_PARSER (parser)->buffer))) >> + return Qnil; >> + else >> + return Qt; >> +} > > Doesn't treesit_check_parser signal an error if the parser was > deleted? If so, how will the above be useful, if someone wants to > avoid errors? From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 13:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mickey Petersen Cc: casouri@gmail.com, 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167568956028303 (code B ref 61235); Mon, 06 Feb 2023 13:20:02 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 13:19:20 +0000 Received: from localhost ([127.0.0.1]:47584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP1Oy-0007MR-AA for submit@debbugs.gnu.org; Mon, 06 Feb 2023 08:19:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP1Ow-0007MD-Fk for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 08:19:19 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP1Oq-0001Ey-P0; Mon, 06 Feb 2023 08:19:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=A3CMFxxNNmW72zj5b+Ncj1LfI98EhNoMAPwjDQgh1nA=; b=Q6KY17zcuG1p MS77ecpccMq4qQ54FNpZEM1H+4Dba1LiMk760vVNk6+Jk+KHyNV8mG02QA5gesrlJLebtOO2MaGzW vkaCQiXstYfe2CGoYIzqih1oe8c32pFf5N2+DgPaL0APrr3C34WSN7KKhqXDosgV54Khqi5yS2/8S 0hS9EvgvBNjvMlJEPSx+A6F/4ZD3UNMC1vKmBPsoaDF8OEacE2CGKIexwJEbhwCXNkmVAGzzM9SHh Q9zs50RGVGVrLszCcsIZYuBfhK8hzOYyLzxo85+cjyy3Y6+CRLvulxEvYCRbSsbvprfo9sdpHK4Uj FoJ1Em4AWcayyKNIebOizA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP1Oq-0005bn-7N; Mon, 06 Feb 2023 08:19:12 -0500 Date: Mon, 06 Feb 2023 15:19:23 +0200 Message-Id: <83a61rq6ck.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87o7q7dl4o.fsf@masteringemacs.org> (message from Mickey Petersen on Mon, 06 Feb 2023 12:35:20 +0000) References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mickey Petersen > Cc: Yuan Fu , 61235@debbugs.gnu.org > Date: Mon, 06 Feb 2023 12:35:20 +0000 > > > I'm not sure I understand the need. AFAIU, a parser is deleted only > > if we call treesit-parser-delete; are we saying that a Lisp program > > doesn't know that it deleted a parser? What exactly is the practical > > situation where this problem happens, and why? > > > > Frankly, I don't think we should at this stage add APIs without a very > > good reason. We should instead collect experience, both from users > > and from Lisp programs, and analyze them before deciding whether more > > APIs are necessary. > > > > Because node references are retained even after a parser is deleted. > > Retrieving a node; somehow deleting the parser (maybe you closed the > buffer, or you were doing some off-hand parsing); and then doing > _anything_ with the aforementioned node yields an error for which > there is no way to test for. > > This is particularly the case when you mix and match parsers in the > same buffer. I'm asking why the Lisp program cannot track the parsers its uses and deletes, and instead expects the core to do the janitor's job for it. From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 13:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167569012529342 (code B ref 61235); Mon, 06 Feb 2023 13:29:02 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 13:28:45 +0000 Received: from localhost ([127.0.0.1]:47597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP1Y5-0007dB-8C for submit@debbugs.gnu.org; Mon, 06 Feb 2023 08:28:45 -0500 Received: from mail-he1eur04on2112.outbound.protection.outlook.com ([40.107.7.112]:26689 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP1Y3-0007cw-6w for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 08:28:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vg0k7T28pC8Aj1J3vfT9URYHcbPOI0vz8PBO7m/xQhhiwO3kQf23yX+9G2APLYn+GGk+AuX7UW84z1qS8KYamm2V/gfHJ3XK6gnh+InkWBhazeu+RvQMt65XYIIByQLAQYQjTXNKpGa/+8x21GH+iG/JiaLIqJCH/FdcFVYtqvyIhqCJi7KMjcvu3hqDzrBQKsKd0IhUKyQRZTvqB7YHLDn51OnMBIGPiRmUV38MYlgIgStW86atQLuqYThTS1S9PUexsopYCdu9QTX/gx+ip9kkeAyUCBnoQHLY0PiNkDrgzA8ab+rDNp4NyUuDKh8kBejaVqfu60O+OOieshuHIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7JvPdzB4uGD4b2O0pEtU02RrsRihS3sm+Hfr3al9jDs=; b=JgI5zRyV99Gz2mMYg0gk6Vcv5S8vasEyg+rfQLYkmajbUaVbazRSil9L6We9jAloo4J2ZHXJZi9EF+i8imwNzyQ0wNTIn2OXQFd6y64vphJoQ+nhu4v+VbuqpXbcFFE3Tj2nmph4hl6tPSlilEr0tmCQ1/unupqLL76rGus2Krh6o2RdnBiYl1qCTH+rJfWOivo7ym6jpz5ptcbLiJqiaMVR5kPEW4lfE7R8e78n3CUmyaZkiCPeUUWHa47PsOAeNX0DggAiP3vnJv59zDKkSVoW5nZrwmYRb4x7ATByiCJPM0hqbMVKCN/NU40fGvYUESPTWe5EQqSFKb84Ms+fCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7JvPdzB4uGD4b2O0pEtU02RrsRihS3sm+Hfr3al9jDs=; b=OaCwzBkmKw3nKP0swpG/ET1D0cj+1mLppnRvuQvbk/JZDA68tR4VBGV2eVV1AtT8WwdOt3xWqXdmZfzvW/N7DrlcqIo/hWoGq4A6+QQqLnIOFYhSFjNCH1hljX8UIeaalNgIgwjQFtd5zY3E3MK7k84djDewAm1/xespw7rmkBY= Received: from CWLP123CA0223.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:19f::6) by LO2P265MB4990.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:22d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 13:28:34 +0000 Received: from CWLGBR01FT007.eop-gbr01.prod.protection.outlook.com (2603:10a6:400:19f:cafe::88) by CWLP123CA0223.outlook.office365.com (2603:10a6:400:19f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 13:28:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by CWLGBR01FT007.mail.protection.outlook.com (10.152.40.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.32 via Frontend Transport; Mon, 6 Feb 2023 13:28:33 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 5A462114002; Mon, 6 Feb 2023 13:28:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1675690113; bh=3bamt0W741r57uT69W6etCfJVC3+hCzH+TL7uYq3V8w=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=JqYYAljQ/FdMkxpr0mHgM3Ol047XMk6e3z8Vpbgxw+bCj3kkRB5kPDcREx3lWGFTu G4gzSaFrPAZPFoEPfDXhHWcXCsCaAz+pQhLffcx+37HJw2Nf1aEP9K48lXKKjaCn1N c1ZTBNos91Y1Kp8zrFm69a8yN1184QGaUE6YRfoc= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen Date: Mon, 06 Feb 2023 13:19:57 +0000 Organization: Mastering Emacs In-reply-to: <83a61rq6ck.fsf@gnu.org> Message-ID: <87k00uexdt.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLGBR01FT007:EE_|LO2P265MB4990:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e6d31c43-2e85-48a2-5167-08db08460b83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G0U+2GD/l29TGJu2922lAtLM62g7qEpRXLbMiErlOcaG7e499vm6dcvSUNJe2AsM6IbvQciL+tmXzNuJnWtxZrqdX1D1QYQfa10zde0e7kr+jzO6N3qmRJuH04Rx+jC5MFNOyHpa60NS0jTi1SyrxWmH4n5Sh+vA+b8h+rT8z4z5oX0Dfj0zUOY2NazXgRZiuEscDIW6fol2EEMcQdEEnSxo5coZ8e83twftON1xvSwOdYFiymEOPd9zQlHC3xVJtTExM9i7WwGe3pwatWHnLUo/8hdyoLGve12o7vdXJ3Pn+zHFTqA6V15I2rpCPudkx1gXZ/osIPq3sdY6ETjDtW23/Z/b/PUxZKe+X96Dbmg5tJGTb0izeyUAE2pP5mYX6dN+FMmHK28uYW5FHtTU0Kawo1I8JAOAYP/f39PXXcKDUIVl0v49y/T9zOmqS0qtuRVJ2W6qDE8eWoaL6J95PPGggVLeaHU/b+QtPDNDiJJymM4x3zcf6WZh+CFZo1v/MQEBLIGIZGSnpkbaaQVJ+xSnzygf9SFqiu6Yzj79A/BcNUd+8fYtGhFMxEl0+hvkdVGXGEDdklyiYmieHhtPWGQFVtcj5ft6ygGGReBjI/8L4mXwajlj9IQQ16ozp3WK8a0Mij+gL7H6FxjSSObcEmgPZLA69QbG6Nf07zwfnokNm8iMyB1EsKeqfQI9sAB9VsCuduFJ0YykCPuF0JANeCGCy6QkfovYtCn8n1gKtwNXNEV38oL8HHkYB6xCHX64jk8cC79049EPO3OmlOaakr1GdInX9ABA7n4/8hpsYc+HoR57m/KfT2CJdDcuFxin X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(346002)(39830400003)(396003)(136003)(376002)(451199018)(46966006)(36840700001)(36756003)(36916002)(478600001)(316002)(2906002)(42186006)(7636003)(86362001)(40480700001)(356005)(82310400005)(7596003)(47076005)(336012)(2616005)(66899018)(70586007)(6666004)(83380400001)(70206006)(8676002)(4326008)(8936002)(6862004)(41300700001)(5660300002)(6266002)(186003)(26005)(36860700001)(38230200001)(81973001)(43043002)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 13:28:33.6320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e6d31c43-2e85-48a2-5167-08db08460b83 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: CWLGBR01FT007.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO2P265MB4990 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Mickey Petersen >> Cc: Yuan Fu , 61235@debbugs.gnu.org >> Date: Mon, 06 Feb 2023 12:35:20 +0000 >> >> > I'm not sure I understand the need. AFAIU, a parser is deleted only >> > if we call treesit-parser-delete; are we saying that a Lisp program >> > doesn't know that it deleted a parser? What exactly is the practical >> > situation where this problem happens, and why? >> > >> > Frankly, I don't think we should at this stage add APIs without a very >> > good reason. We should instead collect experience, both from users >> > and from Lisp programs, and analyze them before deciding whether more >> > APIs are necessary. >> > >> >> Because node references are retained even after a parser is deleted. >> >> Retrieving a node; somehow deleting the parser (maybe you closed the >> buffer, or you were doing some off-hand parsing); and then doing >> _anything_ with the aforementioned node yields an error for which >> there is no way to test for. >> >> This is particularly the case when you mix and match parsers in the >> same buffer. > > I'm asking why the Lisp program cannot track the parsers its uses and > deletes, and instead expects the core to do the janitor's job for it. Because I have a proxy-like object of a real node because they're invalidated if a buffer is edited, even if the parcel of code I hold a node reference to is untouched. That's just how tree-sitter works, so I deal with it like this. That part works fine for I can of course use `treesit-node-check' to determine if it's outdated and thus needs refreshing (or not.) The problems begin when the parser is also, for one reason or another, destroyed. Now I can no longer determine if it is safe to use the existing (real) node reference. Any attempt to use a "dangling" node reference that points to a dead parser throws a nasty error. Thus, the extension to `treesit-node-check' that can tell if a node belongs to a dead parser --- something that tree-sitter and the C core clearly knows about internally. From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mickey Petersen Cc: casouri@gmail.com, 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.16756923331590 (code B ref 61235); Mon, 06 Feb 2023 14:06:01 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 14:05:33 +0000 Received: from localhost ([127.0.0.1]:47650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP27h-0000Pa-2o for submit@debbugs.gnu.org; Mon, 06 Feb 2023 09:05:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP27e-0000PK-JI for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 09:05:31 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP27X-0001aN-WE; Mon, 06 Feb 2023 09:05:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1p4XBNDB76yYfT8IOjyciRxPZ5DlkjtoEWDETxqi7CA=; b=QwR8FDxO+o9Q jP0MxkEjKzmb8eQmMhv0XZHTfmtsRwPSLHtpY9SaGB16DoNg48a8ujLZHmcgcd76ISEeBp0UCiVqQ Yar/mvA2UYeVSLz/RGyv/BYiMRjrRr6XvrP5HDpK0szVOzB3FLgdxRm3cFpL3PURYDL7KGaeIcN0U H/PKd7g4s3vQJi8bgICeC8If8zkGxBGqN9Q7IJmYytxBZrIxnMyTuciW6tr7gUwiKMIwm7z2MG3dC PevSk4IPbXf2iHIJIWqTsu1BCuW6R7iS+cemV7ZayQWuKS1smMUPP3td7LFF0Ym+zdepMo1FAxIWr JNnJnAaaLnHTJ9s0bCMzYA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP27W-0003oZ-3w; Mon, 06 Feb 2023 09:05:23 -0500 Date: Mon, 06 Feb 2023 16:05:30 +0200 Message-Id: <835yceris5.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87k00uexdt.fsf@masteringemacs.org> (message from Mickey Petersen on Mon, 06 Feb 2023 13:19:57 +0000) References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mickey Petersen > Cc: casouri@gmail.com, 61235@debbugs.gnu.org > Date: Mon, 06 Feb 2023 13:19:57 +0000 > > > I'm asking why the Lisp program cannot track the parsers its uses and > > deletes, and instead expects the core to do the janitor's job for it. > > Because I have a proxy-like object of a real node because they're > invalidated if a buffer is edited, even if the parcel of code I hold a > node reference to is untouched. That's just how tree-sitter works, so > I deal with it like this. That part works fine for I can of course use > `treesit-node-check' to determine if it's outdated and thus needs > refreshing (or not.) > > The problems begin when the parser is also, for one reason or another, > destroyed. But it is only destroyed if your program calls treesit-parser-delete, no? Anyway, I'm okay with exposing treesit_check_parser to Lisp, if you really insist. But please be sure you want to insist, because I'm not really convinced. From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 14:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.16756927982488 (code B ref 61235); Mon, 06 Feb 2023 14:14:01 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 14:13:18 +0000 Received: from localhost ([127.0.0.1]:47665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP2FC-0000e3-1k for submit@debbugs.gnu.org; Mon, 06 Feb 2023 09:13:18 -0500 Received: from mail-he1eur04on2127.outbound.protection.outlook.com ([40.107.7.127]:4101 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP2F9-0000df-JT for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 09:13:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JmVM1TR0SHEnbyVoNKTX+4FGd+80YHk5RFswNRWLoynK7Hkxcae5AljieJja7HqYyjSKAUXCCvnpTFaKtmdqrIy0jIUfSwtf18eE2Ditox2oH2gQdtd5tGbsywf7uv1h7SbJMQjGqeEhEyJPUmTCMXJjL5zUOQJXjwDns2ICU5imrBMIRYz0sv6rTKSowsJ2XXrpBZcEmxRv7z7v0bWxvDvEafZKHtdnMCKrqWT8aZSQtQA+bi/MopsQ/VUY++uXVHiAvKBlsej8TtBl9nQTQ8czYajDJ/j9QvdvlsymgLNSrpUMPJ5VEOHBdYBtZje9AkFcQeARoqH9BIyCoHZexA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nL0DVsS6t5fHT301SxFKRQ5YBuZlpWv9qfYd0Mg8d64=; b=OWj+FIP8NdxW32PZsWykZHTYMf+XgWh2YZHiKk41rA0uPptvRbk0ELd1ybfaXFgTe26r8XENYaWgyTv0d+kkrIiPt+UFnxHQcWFPdk/DwTWRCMSRoCUTM7QrBIrn1akvwxo4HQvwldXNr7xWqM+WKHe1C40+sFdqQ3cVKugh6Td9hosQRXqPHFq5ECWt1SPSMOiPoP5/tf9MyFkvsyD1xpGQCfBV3363qr1h1j1ymGsOW/qaQaXCJNYAgmNvO62KC3xNMQfTr7OUGug0xm1e7ZuuEs67lmw21Q0zgWCnR8i/l9cnr72DArCdjZLt6082RmTx9hUSF6GDqNcJYJhAFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nL0DVsS6t5fHT301SxFKRQ5YBuZlpWv9qfYd0Mg8d64=; b=YzbJ161YFjlzAgcrWcbKQk/+IbobyKOvHY8VZzJhXx9hgYblutLMRTfrKFM2dUwIth9w/wEYM0roGNDJSWCZi22lme4TdNFu0ueJNwIrIdEgpIVBqw6pDXI74c34p093MTf2ctoGfGh2WogKD5Itlp11zYOXXUW1s2qmzPzWNk4= Received: from LO2P265CA0090.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::30) by LO6P265MB6505.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2d9::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 14:13:08 +0000 Received: from LO2GBR01FT003.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:8:cafe::b5) by LO2P265CA0090.outlook.office365.com (2603:10a6:600:8::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 14:13:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by LO2GBR01FT003.mail.protection.outlook.com (10.152.42.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34 via Frontend Transport; Mon, 6 Feb 2023 14:13:07 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 8B051114002; Mon, 6 Feb 2023 14:13:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1675692787; bh=joCs/LgR6c2yiwRhE9K+OouVSiLyPsYtnW+Erp+SbIA=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=PkS+WaCMOF7ZPB64aaehnwg/f/KeIrbkWKqanz+oirfSQUwkFugg6F4DiAM9C7jMd jUTmd4sSJbm9dZQd2CUTxtKL9SIP9OgyqXF4EIzwq7w+Qt3YHSTI7x9drM3NCOCFdk g+vmTgWKJ31QERBbmU3A/9RZ+uYM7yg2vA9+awCg= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen Date: Mon, 06 Feb 2023 14:08:46 +0000 Organization: Mastering Emacs In-reply-to: <835yceris5.fsf@gnu.org> Message-ID: <87fsbievbi.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2GBR01FT003:EE_|LO6P265MB6505:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 1644f462-6b47-4bc0-6672-08db084c4573 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2B4FNi4Gi2mlHJhu2L29KJ6X0Eceyx9RqC5N7OOviSt4BdMxxjyXNOnD+MFbPMUcDBjLizFZYJmdGohX9VABVca6NjbAK1VOd5Ui7HQfMKjix6tpy2Rm6AEMisX3zlJXu1b3Quh4NWdmz4WxzsrKSonHkuCBp+/I3GIRhENauaAi7JhkdHK62m9ClnrqFXvoF8nNY2z6wOBythWcszZWOtFwa8WgfB6gT8eLsdYRm8jMCBZfdHebFOI/A8B+9KRq2C48wR+lPW9Uh3AMyeXQHJHxQtEvQ4WLrKQzCBFTu/xQxWBy3vMDmI4A6b5s3xpSH0bXtiQxzGSmcl1gKnSBP5y79IWZZqGvw9OkkohX9/G5P0cVI76Vn5MldNmv67ub/2eHXtlLsE28N8iqaP881mSYRrqvCb2RwCR/EpJCvvQrNdKB8r9+3OqQSdPz6bL3ihESACx1cAqwqKu9ZRDtsVkp0Y63pQ33JBZ9+H41jd8t3TyJCjhNupOkPGLZ2gO+FAzGrryqrH/vBtxaGjdEKG2/fHsJiS4vmpOQ1hv8YcZ+o4j0zf3Z+hJNxf65vUjwgSGP5oT7Vq5Iat5EeBOy8/Tig59BRL4vtK9UtU0Tqw8XzMYl9xKHtigW3kVpjo9mUu7HFsn0fdkFUjMhfOCx6NqnFW7fRR82a0VRR/A+61H6tzlYLIffJy9fAdBcq/FA9LAO2GoUEFVKskBV7pRX2y/WGGHxrruJnQpLBDbj0j8ABINPSkIYcQt/zHaR69+xQIqDK8i5JvjNMAyRd8UjaipJPG2O1niumWjSK4fkt27f7ae3Ldx572bP1Gp1Me3c X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(136003)(376002)(346002)(396003)(39830400003)(451199018)(36840700001)(46966006)(66899018)(36860700001)(8676002)(42186006)(70586007)(4326008)(70206006)(41300700001)(8936002)(6862004)(7636003)(7596003)(356005)(86362001)(316002)(36756003)(6666004)(26005)(186003)(6266002)(83380400001)(2906002)(40480700001)(336012)(82310400005)(5660300002)(47076005)(36916002)(478600001)(2616005)(38230200001)(81973001)(43043002)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 14:13:07.8315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1644f462-6b47-4bc0-6672-08db084c4573 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT003.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO6P265MB6505 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Mickey Petersen >> Cc: casouri@gmail.com, 61235@debbugs.gnu.org >> Date: Mon, 06 Feb 2023 13:19:57 +0000 >> >> > I'm asking why the Lisp program cannot track the parsers its uses and >> > deletes, and instead expects the core to do the janitor's job for it. >> >> Because I have a proxy-like object of a real node because they're >> invalidated if a buffer is edited, even if the parcel of code I hold a >> node reference to is untouched. That's just how tree-sitter works, so >> I deal with it like this. That part works fine for I can of course use >> `treesit-node-check' to determine if it's outdated and thus needs >> refreshing (or not.) >> >> The problems begin when the parser is also, for one reason or another, >> destroyed. > > But it is only destroyed if your program calls treesit-parser-delete, > no? > > Anyway, I'm okay with exposing treesit_check_parser to Lisp, if you > really insist. But please be sure you want to insist, because I'm not > really convinced. All I want is a way for treesit-node-check to tell me if the node belongs to a dead or alive parser. It is already capable of telling me if a node is outdated, for instance, another rather important feature. Knowing its status is pertinent if you do any sort of light refactoring or if you end up destroying a block of code that has its own nested parser. Whether I destroy a parser explicitly (which is how I found the issue) or indirectly (through some other mechanism) is, I think, orthogonal to the problem of determining liveness (of a node, of a process, or any of the `xxxxxx-live-p' functions we presently have) Thanks, Mickey From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 15:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mickey Petersen Cc: casouri@gmail.com, 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167569687312023 (code B ref 61235); Mon, 06 Feb 2023 15:22:01 +0000 Received: (at 61235) by debbugs.gnu.org; 6 Feb 2023 15:21:13 +0000 Received: from localhost ([127.0.0.1]:49626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP3Iv-00037r-1O for submit@debbugs.gnu.org; Mon, 06 Feb 2023 10:21:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pP3It-00037d-9u for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 10:21:11 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP3In-0003Wj-L4; Mon, 06 Feb 2023 10:21:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=bgBHgncYKSmtC7SJUJ4HN9uVxN+HUlgXJJwLruXzaDU=; b=i7hi7061OmQN oGVHhEXIi6FO8QbqkUXWGLUXsVdAr0W+wQ+fEvoceT9t5oij0WTyhE8z9A/acuKjFh9uwEUKtqiuQ /+fcfITps0oww6Lj3ALpFOjd9whycJUc8n3iB2GmmTgFN8mbupwU2ghm9SSrRQ7KooTgE35SQYCdD YVel3aXQ2iuvh/0PMyPclccUIh7AwJt6GSV3Z9Q2wGpvsyME4O3U0qNV+O4YnqHx/ybNKm4zAqAAl mSjwairtqo78ZoTNSsz2vwi66WT0o3esee9DpFT0d2NBYQl01LQ/6iS7S/PXwUqKkNm6oUunsk1vd vaMhUAFdiSqmgkt8iC4XGQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP3Im-00085Q-Tc; Mon, 06 Feb 2023 10:21:05 -0500 Date: Mon, 06 Feb 2023 17:21:18 +0200 Message-Id: <83y1paq0pd.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87fsbievbi.fsf@masteringemacs.org> (message from Mickey Petersen on Mon, 06 Feb 2023 14:08:46 +0000) References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mickey Petersen > Cc: casouri@gmail.com, 61235@debbugs.gnu.org > Date: Mon, 06 Feb 2023 14:08:46 +0000 > > All I want is a way for treesit-node-check to tell me if the node > belongs to a dead or alive parser. That'd be fine by me, but the patch posted by Yuan was a different one. Yuan, any reason not to extend treesit-node-check instead? From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2023 03:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 61235@debbugs.gnu.org, Mickey Petersen Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167574063427865 (code B ref 61235); Tue, 07 Feb 2023 03:31:02 +0000 Received: (at 61235) by debbugs.gnu.org; 7 Feb 2023 03:30:34 +0000 Received: from localhost ([127.0.0.1]:50563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPEgk-0007FM-8Q for submit@debbugs.gnu.org; Mon, 06 Feb 2023 22:30:34 -0500 Received: from mail-vs1-f46.google.com ([209.85.217.46]:43617) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPEgf-0007F7-Hl for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 22:30:33 -0500 Received: by mail-vs1-f46.google.com with SMTP id g3so3572143vsr.10 for <61235@debbugs.gnu.org>; Mon, 06 Feb 2023 19:30:29 -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=n1q5OmhlNa1fC8SJeBOntpjLU8PsH2rVEhB/9x2/hwY=; b=cMltyiuBIhyntysMg5DeSfaKrIu7pPfE9XYRXZKignIDxQNHnx/V+Ar2FrpazXEaFg v9ySFXmgd6DHCGGBfDq0sExiJr35/2e7pdKoRUiJLfvshlnmCoxUHeOsRgeelXoEVyck SPM5mdJ4ai6pQeZxdG4m0DvpKnPrx++fNTGCruNmy10k4EusX0ZWC7RghvTtk31tshb0 LESSJKeKzIuP67vuHNzra71JehAZPm6XzivvqWcaSkZN229F2h3+wfXd/sdzuWdtbdQu OsY2txpp5+zMtcprtkjhHTVQgvr0IoHOHy66tGuaXewMuLrYLMjI7wbxuEyF0VkM6mlo JNBw== 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=n1q5OmhlNa1fC8SJeBOntpjLU8PsH2rVEhB/9x2/hwY=; b=K4iaWBl/iBlBjaDVaO8O1Vk3euIc1p+7Ks6wlpPVRVbWiHBvPKVbFivdbBi+eZoCNG zN18il0W4VKzj+Gcn0iuV2fzQpHuEwkn/A4D+NbTUDPHKlvMIS6bImceoGpsX0QFk9WS VOmsvFIowyLg+IS7Ml+gr6Mupa6GO/hhUimkXG21lN3Xm8pMdggRXRnfySb5z42NhbNV 1qEHnHcn5ENYe+mWs66pFkxUYd3Y+SwHOH84zdVg9hKjryYzavu05hlTavNXNq2rbhap JTLYjtkzpP/Nj5z/fnrcg+3qNlnC4vml7Y2t714vpsQ2BXDxRzH1jAy81l2nMxy20Y4Q nbrQ== X-Gm-Message-State: AO0yUKXDanZJjSho7WNSBoE2/ow9smHUParv/JEVo7iJTkuRXItreTqi ZjR5NSMoqs3V5b0134Qii1I= X-Google-Smtp-Source: AK7set8xvThCRtjA7U1JEAhveOGTOro2WOz56Ngl0HkS9S4HA1TOEV6s+BVqgMzEGQJzWhx/pVnQvQ== X-Received: by 2002:a17:902:e888:b0:199:1f1b:3634 with SMTP id w8-20020a170902e88800b001991f1b3634mr1247966plg.26.1675738842071; Mon, 06 Feb 2023 19:00:42 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id v3-20020a170902e8c300b0019602274208sm7022609plg.186.2023.02.06.19.00.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2023 19:00:41 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <83y1paq0pd.fsf@gnu.org> Date: Mon, 6 Feb 2023 19:00:30 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Feb 6, 2023, at 7:21 AM, Eli Zaretskii wrote: >=20 >> From: Mickey Petersen >> Cc: casouri@gmail.com, 61235@debbugs.gnu.org >> Date: Mon, 06 Feb 2023 14:08:46 +0000 >>=20 >> All I want is a way for treesit-node-check to tell me if the node >> belongs to a dead or alive parser. >=20 > That'd be fine by me, but the patch posted by Yuan was a different > one. >=20 > Yuan, any reason not to extend treesit-node-check instead? I did extend treesit-node-check in the patch. But I also added a = function treesit-parser-live-p, which makes the same check but directly = on a parser. It just made sense to me that if we let treesit-node-check = check the nodes=E2=80=99 parser=E2=80=99s status, we=E2=80=99d also add = a function to allow directly checking the status of a parser. Micky, the function I added (and the extension to treesit-node-check) = checks that the parser is not deleted AND its buffer is live. That makes = the most sense to me, but would it cause any problem for your use case? Yuan= From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2023 03:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 61235@debbugs.gnu.org, mickey@masteringemacs.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167574066427933 (code B ref 61235); Tue, 07 Feb 2023 03:32:01 +0000 Received: (at 61235) by debbugs.gnu.org; 7 Feb 2023 03:31:04 +0000 Received: from localhost ([127.0.0.1]:50568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPEhD-0007GT-Mk for submit@debbugs.gnu.org; Mon, 06 Feb 2023 22:31:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPEhC-0007Ft-Oo for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 22:31:03 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPEh7-00054S-Cn; Mon, 06 Feb 2023 22:30:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=0eQuJkKVvkLI/IwNDtWHJtKHnGR1iHq5ZF0ENmO9atg=; b=noERorO5LPMWciiowdnC vQzHh/IKjdqzPsMtjj3ySCyWIu3C5NfubvOUUnjn4qCwmRA+CZGbjnl7+iUj47EGTLtH/r2aAiH7l n829B8HgA36ZziMqp5sGp0+foI8Tb6PNZt9gXCtFg5ZC8tMd9+FvFlWqj8Q7xSzGaQXo22CduzsCQ MulUDo+M62BrMvqOTc/mBbsPT8BkCTQ/A2zt4pCkk14xYmVEEc3IWDLZTxhT8vz8ZXSzeSCbE8V5e rf2jvAHhgY4yaRTJmsANFnNoyaoqCH8fu+Kzn0nbkIRD5a23gKeVFUIkpF3peg4/UVjON09J0P4ub NZiFkDWqa1D3qQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPEh6-0003WK-Ry; Mon, 06 Feb 2023 22:30:57 -0500 Date: Tue, 07 Feb 2023 05:31:11 +0200 Message-Id: <83ilgep2ww.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Mon, 6 Feb 2023 19:00:30 -0800) References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Mon, 6 Feb 2023 19:00:30 -0800 > Cc: Mickey Petersen , > 61235@debbugs.gnu.org > > > Yuan, any reason not to extend treesit-node-check instead? > > I did extend treesit-node-check in the patch. But I also added a function treesit-parser-live-p, which makes the same check but directly on a parser. It just made sense to me that if we let treesit-node-check check the nodes’ parser’s status, we’d also add a function to allow directly checking the status of a parser. That additional function would signal an error in the case discussed here, so I'm not sure we should add it in that shape, or at all. Why isn't treesit-node-check enough? From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2023 04:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 61235@debbugs.gnu.org, Mickey Petersen Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.16757457584062 (code B ref 61235); Tue, 07 Feb 2023 04:56:02 +0000 Received: (at 61235) by debbugs.gnu.org; 7 Feb 2023 04:55:58 +0000 Received: from localhost ([127.0.0.1]:50683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPG1N-00013R-SK for submit@debbugs.gnu.org; Mon, 06 Feb 2023 23:55:58 -0500 Received: from mail-pg1-f180.google.com ([209.85.215.180]:35639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPG1M-00013E-9N for 61235@debbugs.gnu.org; Mon, 06 Feb 2023 23:55:56 -0500 Received: by mail-pg1-f180.google.com with SMTP id n2so7102999pgb.2 for <61235@debbugs.gnu.org>; Mon, 06 Feb 2023 20:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=spjDL0/GGaWlh5RDaV4DQp3n58UddRdSwiL8sqxIQsg=; b=Sfjty9j1E5ePQlMoOFdsJobtZM2/P9pP6ZsF16DysAhE/si8bJWw+7Xf59MUA6PeDP g04zJAdpXdB3fVUK6CN0zFC9m1NIZ0PkKA/O4cEzc5qw5fGmkXQ8uzjAKu2ceqkc8wov 1dcf/h2RMppJafBBPMZ6HiboWxC85wSenhkSepb48T1zfC7RSKUWbi56fwWFx7/TpuyH 5H9bnTCTyPOmMEDMSWh7Bu1YuYO2Q0F6h087SES+z+k0ayyPHmkDhQL1U55I0064EDMf huzLdsIiSKJdQsHT48ttdkvCf7FdJC6EleMKmgw85UqbMR2QXygBJ1hlLFUCyOtg2EBR QnOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=spjDL0/GGaWlh5RDaV4DQp3n58UddRdSwiL8sqxIQsg=; b=uMYFs2Egv8NI3JhFqExinQvYhY2b4FdnSAXdjyUq36+p2dwvYRWyOsppCecIkmlDl3 T9CRvWOEktTsrtXOmdwVi/yEcV6l+d9W6G8V3mIpgmu8B/k1IhUeHFcIyGVeWSrNfPBS qqaVysSbZ/O82jxU0Dcz9s2lLh+OMcnmNaiaDjvad9BawpefQiC0el0fyztMrq6JEH4R nGQuXNCrWVxPhRiNuOV+a0Pe8ZmAZ+TGs6BIDoXEkkYCjC3HHgKXswav+sH6q0WjcTfQ O1VIq++JXF3bsaXk1mJonED78hdrZiwADQtqeyqPZIapSWjZSB4pnW17fc0rQE5r7laZ ujJg== X-Gm-Message-State: AO0yUKVBx46nzA5Ju/+7/TfNBnt6PDq+NwN8MUv/cqYZuil1EDD4qL7y VUoTEGhWD1BgjiS2Oniyb9k= X-Google-Smtp-Source: AK7set8xNPLGm69L+wuLTx2oFb1Z9HkFoF34bLkj8UzsCpMykvoqjLFodqW2Cr9XXez2JXXhDK8z7w== X-Received: by 2002:a62:184c:0:b0:5a7:a3dd:e5fa with SMTP id 73-20020a62184c000000b005a7a3dde5famr774346pfy.32.1675745750143; Mon, 06 Feb 2023 20:55:50 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id z9-20020aa79589000000b0058e23ca0ca7sm8024784pfj.3.2023.02.06.20.55.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2023 20:55:49 -0800 (PST) From: Yuan Fu Message-Id: <4C7AB77E-FBB6-4F34-A73A-297243E2E3AF@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_095F708C-51FC-40E8-9975-1E3905E416BA" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Date: Mon, 6 Feb 2023 20:55:38 -0800 In-Reply-To: <83ilgep2ww.fsf@gnu.org> References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> <83ilgep2ww.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_095F708C-51FC-40E8-9975-1E3905E416BA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Feb 6, 2023, at 7:31 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Mon, 6 Feb 2023 19:00:30 -0800 >> Cc: Mickey Petersen , >> 61235@debbugs.gnu.org >>=20 >>> Yuan, any reason not to extend treesit-node-check instead? >>=20 >> I did extend treesit-node-check in the patch. But I also added a = function treesit-parser-live-p, which makes the same check but directly = on a parser. It just made sense to me that if we let treesit-node-check = check the nodes=E2=80=99 parser=E2=80=99s status, we=E2=80=99d also add = a function to allow directly checking the status of a parser. >=20 > That additional function would signal an error in the case discussed > here, so I'm not sure we should add it in that shape, or at all. Why > isn't treesit-node-check enough? Oops, it shouldn=E2=80=99t have. The updated patch fixes that. = Treesit-node-check is enough, it just made more sense = implentattion-wise, to implement that function that checks a parser, and = let treesit-node-check use that function to check the node=E2=80=99s = parser. We can choose to not expose that function, and only expose this = feature through treesit-node-check, if you prefer so. Yuan --Apple-Mail=_095F708C-51FC-40E8-9975-1E3905E416BA Content-Disposition: attachment; filename=livep.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="livep.patch" Content-Transfer-Encoding: quoted-printable =46rom=2008765f4f61d63398307e3401313c45a60d65edee=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Sun,=20= 5=20Feb=202023=2020:22:52=20-0800=0ASubject:=20[PATCH]=20Demo=0A=0A---=0A= =20src/treesit.c=20|=2026=20+++++++++++++++++++++++---=0A=201=20file=20= changed,=2023=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/src/treesit.c=20b/src/treesit.c=0Aindex=208e772523cc7..f2c3e9845d1=20= 100644=0A---=20a/src/treesit.c=0A+++=20b/src/treesit.c=0A@@=20-1471,6=20= +1471,19=20@@=20DEFUN=20("treesit-parser-language",=0A=20=20=20return=20= XTS_PARSER=20(parser)->language_symbol;=0A=20}=0A=20=0A+DEFUN=20= ("treesit-parser-live-p",=0A+=20=20=20=20=20=20=20= Ftreesit_parser_live_p,=20Streesit_parser_live_p,=201,=201,=200,=0A+=20=20= =20=20=20=20=20doc:=20/*=20Check=20whether=20PARSER=20is=20not=20deleted=20= and=20its=20buffer=20is=20live.=20=20*/)=0A+=20=20(Lisp_Object=20parser)=0A= +{=0A+=20=20if=20(XTS_PARSER=20(parser)->deleted)=0A+=20=20=20=20return=20= Qnil;=0A+=20=20else=20if=20(NILP=20(Fbuffer_live_p=20(XTS_PARSER=20= (parser)->buffer)))=0A+=20=20=20=20return=20Qnil;=0A+=20=20else=0A+=20=20= =20=20return=20Qt;=0A+}=0A+=0A=20/***=20Parser=20API=20*/=0A=20=0A=20= DEFUN=20("treesit-parser-root-node",=0A@@=20-1904,7=20+1917,8=20@@=20= DEFUN=20("treesit-node-check",=0A=20=20=20=20=20=20=20=20= Ftreesit_node_check,=20Streesit_node_check,=202,=202,=200,=0A=20=20=20=20= =20=20=20=20doc:=20/*=20Return=20non-nil=20if=20NODE=20has=20PROPERTY,=20= nil=20otherwise.=0A=20=0A-PROPERTY=20could=20be=20`named',=20`missing',=20= `extra',=20`outdated',=20or=20`has-error'.=0A+PROPERTY=20could=20be=20= `named',=20`missing',=20`extra',=20`outdated',=0A+`has-error',=20or=20= `live'.=0A=20=0A=20Named=20nodes=20correspond=20to=20named=20rules=20in=20= the=20language=20definition,=0A=20whereas=20"anonymous"=20nodes=20= correspond=20to=20string=20literals=20in=20the=0A@@=20-1920,7=20+1934,9=20= @@=20DEFUN=20("treesit-node-check",=0A=20the=20node=20was=20created.=0A=20= =0A=20A=20node=20"has=20error"=20if=20itself=20is=20a=20syntax=20error=20= or=20contains=20any=20syntax=0A-errors.=20=20*/)=0A+errors.=0A+=0A+A=20= node=20is=20"live"=20if=20its=20parser=20is=20live=20(i.e.,=20not=20= deleted).=20=20*/)=0A=20=20=20(Lisp_Object=20node,=20Lisp_Object=20= property)=0A=20{=0A=20=20=20if=20(NILP=20(node))=20return=20Qnil;=0A@@=20= -1943,9=20+1959,11=20@@=20DEFUN=20("treesit-node-check",=0A=20=20=20=20=20= result=20=3D=20ts_node_is_extra=20(treesit_node);=0A=20=20=20else=20if=20= (EQ=20(property,=20Qhas_error))=0A=20=20=20=20=20result=20=3D=20= ts_node_has_error=20(treesit_node);=0A+=20=20else=20if=20(EQ=20= (property,=20Qlive))=0A+=20=20=20=20result=20=3D=20= Ftreesit_parser_live_p=20(XTS_NODE=20(node)->parser);=0A=20=20=20else=0A=20= =20=20=20=20signal_error=20("Expecting=20`named',=20`missing',=20= `extra',=20"=0A-=09=09=20=20"`outdated',=20or=20`has-error',=20but=20= got",=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "`outdated',=20`has-error',=20or=20`deleted',=20but=20got",=0A=20=09=09=20= =20property);=0A=20=20=20return=20result=20?=20Qt=20:=20Qnil;=0A=20}=0A= @@=20-3444,6=20+3462,7=20@@=20syms_of_treesit=20(void)=0A=20=20=20DEFSYM=20= (Qextra,=20"extra");=0A=20=20=20DEFSYM=20(Qoutdated,=20"outdated");=0A=20= =20=20DEFSYM=20(Qhas_error,=20"has-error");=0A+=20=20DEFSYM=20(Qlive,=20= "live");=0A=20=0A=20=20=20DEFSYM=20(QCanchor,=20":anchor");=0A=20=20=20= DEFSYM=20(QCequal,=20":equal");=0A@@=20-3577,6=20+3596,7=20@@=20= syms_of_treesit=20(void)=0A=20=20=20defsubr=20(&Streesit_parser_list);=0A= =20=20=20defsubr=20(&Streesit_parser_buffer);=0A=20=20=20defsubr=20= (&Streesit_parser_language);=0A+=20=20defsubr=20= (&Streesit_parser_live_p);=0A=20=0A=20=20=20defsubr=20= (&Streesit_parser_root_node);=0A=20=20=20/*=20defsubr=20= (&Streesit_parse_string);=20*/=0A--=20=0A2.33.1=0A=0A= --Apple-Mail=_095F708C-51FC-40E8-9975-1E3905E416BA-- From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2023 08:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: Eli Zaretskii , 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.16757571401788 (code B ref 61235); Tue, 07 Feb 2023 08:06:02 +0000 Received: (at 61235) by debbugs.gnu.org; 7 Feb 2023 08:05:40 +0000 Received: from localhost ([127.0.0.1]:50928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPIyy-0000Sm-9J for submit@debbugs.gnu.org; Tue, 07 Feb 2023 03:05:40 -0500 Received: from mail-vi1eur05on2124.outbound.protection.outlook.com ([40.107.21.124]:34721 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPIyw-0000SX-0T for 61235@debbugs.gnu.org; Tue, 07 Feb 2023 03:05:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UetHv4E4zFbFkiJOc3gQ+akuPYQ91jmckeRjjolzoSMz7BrVAkGviVwrooV05L79Md4dYoEq8qhmv2BpsOxZfqSAt+aMuEl3i8t7bWGytGu1hG7/OFSHMh8B7hU5rs4hXW8hVy+375sdkGMAmBXEAhopWLvclyu5apPFsjqTOoMTH+YxkXTX0LP5ft8g7My41ym2gyNqMSvO/kSIBPxUg88O1aVUXcYGdjyIAlF+g9SMZUAs2l4jTA+HtvhEiTfB7B8TG4IcxrwBbNSX6pQ2ibPR78Y5MIXGw7KZoS7FwMh52c97LxpttHcF0UK+Ttsm/8lGziXtmKDjpWyDlVj1Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/eYaVqgP8024MWlFQvcB25AO357ak0tm3o4LiUbowRU=; b=XB5uuZt5yO8bobpEXG9R+k6z/FOWBbXydBWnb4WvmOvj/NDKOAKsU+iWN6+GNSjW1Iq+TGsOtdygAdrK8cul/rYu0UT+Cg1JPq48y65XWmsaBY9LAMEWO17BFo6rIF2itGn51pxvoJQJrJETmxQIbyGhbeE9KaSJtxeaNdg35Mwy6HhgVEyquKVQD0NLUBSHmp3viCopcu228m3Vbde0F8QiG8SmIitfwGc/g8/VnNZV6WR45XFcaXQ3tNzTwDePeKpSbiLLLrKjKZtH817lWRtZsHZuOwmI93kCoViwpYrPzazQNrOQEflUp+gZElo/105lUwRA9DPKEliqnggleA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/eYaVqgP8024MWlFQvcB25AO357ak0tm3o4LiUbowRU=; b=PJOuE4x4hun428C38iG07d2tEiGD/Ybcpvqtq798q4i3KW4Vh/rGSIDenwdXJ7esVS2us8Ab1P03osdCg1wSMX9CX2KTwsmspM7Q+HNAbvopgHWI/Z3ZonFPzVfUxT6igTMtMiOeGq24DtyelbK2MNTVIR2rcOCVeu5hFyMOQG8= Received: from LO2P123CA0019.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::31) by LO4P265MB6747.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2f1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Tue, 7 Feb 2023 08:05:31 +0000 Received: from LO2GBR01FT030.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:a6:cafe::bb) by LO2P123CA0019.outlook.office365.com (2603:10a6:600:a6::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Tue, 7 Feb 2023 08:05:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by LO2GBR01FT030.mail.protection.outlook.com (10.152.42.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Tue, 7 Feb 2023 08:05:30 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 848B9114002; Tue, 7 Feb 2023 08:05:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1675757130; bh=/eYaVqgP8024MWlFQvcB25AO357ak0tm3o4LiUbowRU=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=AmCZp8gp0tVEzt3HI/mG0LmbGPA77mbsmBTqq0j7jKQrnc+mxe3kVaInxt9MBAcPH oiN0ryPXU3rB1ABNyuxJVwSd/cgflYihThGk+9l5mfxsW/l7oo+REqW7Sd88IHEQGN ++LQ/dJNyjnDIb69D4e2QHVLOn/1+w+iWa2vDNGI= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen Date: Tue, 07 Feb 2023 08:03:56 +0000 Organization: Mastering Emacs In-reply-to: Message-ID: <877cwtew8o.fsf@masteringemacs.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2GBR01FT030:EE_|LO4P265MB6747:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9aec5b65-87f6-4396-d9cb-08db08e214f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PM9LU5K+rahPJHsLDPPiaD1oYc2OzjoLNkjA0ZqP7xqKRjqoYUaY7MC/MLOv+Oz80G3XDt2WNhovpVFx6jW13fe5rE0GP5o3PwuS3s3g2CDzeDS0Tdv1dNgDr1FWdjTLGBGIIHsHuy3Z67JMEhSuF4ZBq3Zvv9J192kMXGubgH7m+zuGgQTWO+KsrgSxH0SIflA7XfryvHggxZ5xBlqorKyUH1JZioQJK/TfQuY45UIDVCLO1uk4iaH0kafn6XVR7A+L1iIzfg6MHdC9ghcz1Tm4oNgBgZzg4s9ZBD89TlA+KeRzIjnDZKEvilNRAlgsMze90HLNyk//eFR19u/az9itxvLH/2bzmc03ZqfExHERBF0umcWByEmpCddgrVm8+1py+2faFfCWC1nhOK6NIVu/2Dh6zv6G6L1C65ojAK/rm+yDYHncvVCLebSX6j15W8CvALI0RXAojVlG2M5Cvzt4iR4yrPtqhkFhDJEmYFFFrAJSrHSIHbPmCBGpIuoLMsd39+eR0eDt2yQYMyaVyQeqD+0UlF1os8Sf0hyG5YS7XnPL9zTBD+HpVXaolnwVCIjLWLEoaYIAEIUA7PYTD5cwT8XO/OTIEa1BIegV26ivtKCNAfdraQGEU7IUxSUv638hnFnON69YT5vnFRJJ6unOkITIENEzJvokmrUxAU8XS4yBQe2H99VYFru8/6osnxkD2L6sSiipUSXED3oBVRRDfyOLZraGO1kg0gBflq+Cv5DFqLAKzBYUTlnQDIZzXAWlP34h6uhjrShBhVju2vu/TylG3G1EKYlIhRTP0AbbOgD7WUX9gZYKJuPW+J6G X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(136003)(376002)(346002)(39830400003)(396003)(451199018)(36840700001)(46966006)(6266002)(36916002)(42186006)(316002)(478600001)(53546011)(82310400005)(6666004)(2616005)(186003)(26005)(36756003)(5660300002)(86362001)(7636003)(336012)(7596003)(4326008)(40480700001)(83380400001)(70206006)(47076005)(8676002)(70586007)(2906002)(356005)(8936002)(6862004)(36860700001)(41300700001)(38230200001)(81973001)(43043002)(14776008)(79816003); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2023 08:05:30.9548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9aec5b65-87f6-4396-d9cb-08db08e214f0 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT030.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO4P265MB6747 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan Fu writes: >> On Feb 6, 2023, at 7:21 AM, Eli Zaretskii wrote: >> >>> From: Mickey Petersen >>> Cc: casouri@gmail.com, 61235@debbugs.gnu.org >>> Date: Mon, 06 Feb 2023 14:08:46 +0000 >>> >>> All I want is a way for treesit-node-check to tell me if the node >>> belongs to a dead or alive parser. >> >> That'd be fine by me, but the patch posted by Yuan was a different >> one. >> >> Yuan, any reason not to extend treesit-node-check instead? > > I did extend treesit-node-check in the patch. But I also added a > function treesit-parser-live-p, which makes the same check but > directly on a parser. It just made sense to me that if we let > treesit-node-check check the nodes=E2=80=99 parser=E2=80=99s status, we= =E2=80=99d also add a > function to allow directly checking the status of a parser. > > Micky, the function I added (and the extension to treesit-node-check) > checks that the parser is not deleted AND its buffer is live. That > makes the most sense to me, but would it cause any problem for your > use case? Thanks for turning around the features so fast. I can use `treesit-node-buffer' and `buffer-live-p' to accomplish that, so perhaps leaving out that check makes sense? > Yuan From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2023 12:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 61235@debbugs.gnu.org, mickey@masteringemacs.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167577264214474 (code B ref 61235); Tue, 07 Feb 2023 12:25:02 +0000 Received: (at 61235) by debbugs.gnu.org; 7 Feb 2023 12:24:02 +0000 Received: from localhost ([127.0.0.1]:51412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPN0x-0003ky-4l for submit@debbugs.gnu.org; Tue, 07 Feb 2023 07:24:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPN0v-0003kk-AE for 61235@debbugs.gnu.org; Tue, 07 Feb 2023 07:23:57 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPN0p-0007WV-GR; Tue, 07 Feb 2023 07:23:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1NQ102AQJhwil0x+p4CnAbDhab+UK74lAen9FfsyFh0=; b=Xdsd10Fs74LvZK8AM8jq HFGSXr2kOTKZZITcOvkTJ7ZVgv0Syj8mr9sxXPj4F2RughjaL0BMaUM4nCiEPmaI3eBShWRFuVdnD TQ33F0/OfBa1rMx7AZ1uWXlWYZHbVcSUX3LSDgv6WQpwTiRM1wmOwDj74C6TWv5v2ia4/2jYkGtxx 8ZglIZiu2o7GlqchhC9ybwe2TxSPrL/9OaaN/XU072E79bf9qb26Wvrapb4O175VN8KCLTyZ0QHrV PdS1v4khclFQH7WUdH+xm9UYDuq5PIAakfVUnVKMtLevNia74yU/T7Z3oPZFvmF2p26lMJ5aI9zIe 2gt0UyHxjmXz2w==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPN0o-0000OC-WB; Tue, 07 Feb 2023 07:23:51 -0500 Date: Tue, 07 Feb 2023 14:24:06 +0200 Message-Id: <83fsbhpst5.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <4C7AB77E-FBB6-4F34-A73A-297243E2E3AF@gmail.com> (message from Yuan Fu on Mon, 6 Feb 2023 20:55:38 -0800) References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> <83ilgep2ww.fsf@gnu.org> <4C7AB77E-FBB6-4F34-A73A-297243E2E3AF@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Mon, 6 Feb 2023 20:55:38 -0800 > Cc: Mickey Petersen , > 61235@debbugs.gnu.org > > >>> Yuan, any reason not to extend treesit-node-check instead? > >> > >> I did extend treesit-node-check in the patch. But I also added a function treesit-parser-live-p, which makes the same check but directly on a parser. It just made sense to me that if we let treesit-node-check check the nodes’ parser’s status, we’d also add a function to allow directly checking the status of a parser. > > > > That additional function would signal an error in the case discussed > > here, so I'm not sure we should add it in that shape, or at all. Why > > isn't treesit-node-check enough? > > Oops, it shouldn’t have. The updated patch fixes that. Treesit-node-check is enough, it just made more sense implentattion-wise, to implement that function that checks a parser, and let treesit-node-check use that function to check the node’s parser. We can choose to not expose that function, and only expose this feature through treesit-node-check, if you prefer so. I think treesit-node-check alone should be enough. One comment: > @@ -1943,9 +1959,11 @@ DEFUN ("treesit-node-check", > result = ts_node_is_extra (treesit_node); > else if (EQ (property, Qhas_error)) > result = ts_node_has_error (treesit_node); > + else if (EQ (property, Qlive)) > + result = Ftreesit_parser_live_p (XTS_NODE (node)->parser); Ftreesit_parser_live_p returns a Lisp object, whereas 'result' is a C 'bool' type. This won't compile if you configure with "--enable-check-lisp-object-type". From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Feb 2023 03:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mickey Petersen Cc: Eli Zaretskii , 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167582839929741 (code B ref 61235); Wed, 08 Feb 2023 03:54:02 +0000 Received: (at 61235) by debbugs.gnu.org; 8 Feb 2023 03:53:19 +0000 Received: from localhost ([127.0.0.1]:54452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPbWI-0007jd-OU for submit@debbugs.gnu.org; Tue, 07 Feb 2023 22:53:19 -0500 Received: from mail-pj1-f45.google.com ([209.85.216.45]:46595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPbWH-0007jS-Ue for 61235@debbugs.gnu.org; Tue, 07 Feb 2023 22:53:18 -0500 Received: by mail-pj1-f45.google.com with SMTP id rm7-20020a17090b3ec700b0022c05558d22so967943pjb.5 for <61235@debbugs.gnu.org>; Tue, 07 Feb 2023 19:53: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=s2As/9NxBZz8eV/jzHGCjNLAuaAgbvbAUTySzVpD2vM=; b=hE7QcoUk0u5hpN+yRIbh9FwX5rA0zdF57xG2iumzg3C6+ULlGbbz+GVOybRxW6XBiQ exZcaD9b4d4TAaJer6/oId4RhRHDwq0eWxIRHf07KClLHD5KP+amr3qWG66COV2oQBuP 1Estv2YPlt9a67lUeafongq2cX58UptpR1XNMcnvRvexjhNktYfS4vPc+B6pwbccLXGu pPSKlfqW6nPrasm4KIPNzMiq5+KpB71t6vIpWY4MOp23xFaj1T0IDaWzLMOqb/MCnI+m OFna7EKgq3HZN1EbGhRFqJVUAaykTmVQipGneBvYtFAZ951nYCcpUbDgfzpWy821Q0qH gGDw== 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=s2As/9NxBZz8eV/jzHGCjNLAuaAgbvbAUTySzVpD2vM=; b=j9esAaZjbYlG23zD5/nw7thjpOn/Q1cOM3EO/FHD+nUDwoVeZy3GQgWeGgWnO3bNq1 EGnm4FbD+pEUkvwAvjH2S/kW33GN6Ew8xyRinvIuX3pWaXIOfPzt0arCwquNHXBa1Yrv aspG9QzzvmyM3tBUK7R/IDkS7j7PHe4hzljKjONQYJN+PifEupMVk+OCsgnmhkNeOaEA 3SsCb/XxnHvP3fosCb6WgKQoFUkGsKl/3Pkp1CYXYl/I86TKD/oCcslyK6OglDMXxI0W lOErH1n9nBUvpNWsOaZ6ejQNPBfcPuV1XCP5psuaagcpHjDHRWZRH4USf7YvOj8avKfc Z0vQ== X-Gm-Message-State: AO0yUKU7LE8VX1zKvG/3/gViW9XcniWYlpTxnDgiHHWyh9KDGRquEDgs LHBn+Vnhg9P5mrr94R+qYKeOxbR9Yw0= X-Google-Smtp-Source: AK7set82necgHD5i8M4WvMAzLis6WMmd9s2dQgDrLlQwl8QB2hObLhn9FCIxbMa4J8a62pv4COqOKg== X-Received: by 2002:a17:902:e285:b0:199:12d5:5b91 with SMTP id o5-20020a170902e28500b0019912d55b91mr4334833plc.41.1675828391855; Tue, 07 Feb 2023 19:53:11 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id a4-20020a1709027e4400b0019942377f0bsm362417pln.91.2023.02.07.19.53.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2023 19:53:10 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <877cwtew8o.fsf@masteringemacs.org> Date: Tue, 7 Feb 2023 19:52:56 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <5F2D3873-1CC2-4820-A0F5-F15BF0DDCEDD@gmail.com> References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> <877cwtew8o.fsf@masteringemacs.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Feb 7, 2023, at 12:03 AM, Mickey Petersen = wrote: >=20 >=20 > Yuan Fu writes: >=20 >>> On Feb 6, 2023, at 7:21 AM, Eli Zaretskii wrote: >>>=20 >>>> From: Mickey Petersen >>>> Cc: casouri@gmail.com, 61235@debbugs.gnu.org >>>> Date: Mon, 06 Feb 2023 14:08:46 +0000 >>>>=20 >>>> All I want is a way for treesit-node-check to tell me if the node >>>> belongs to a dead or alive parser. >>>=20 >>> That'd be fine by me, but the patch posted by Yuan was a different >>> one. >>>=20 >>> Yuan, any reason not to extend treesit-node-check instead? >>=20 >> I did extend treesit-node-check in the patch. But I also added a >> function treesit-parser-live-p, which makes the same check but >> directly on a parser. It just made sense to me that if we let >> treesit-node-check check the nodes=E2=80=99 parser=E2=80=99s status, = we=E2=80=99d also add a >> function to allow directly checking the status of a parser. >>=20 >> Micky, the function I added (and the extension to treesit-node-check) >> checks that the parser is not deleted AND its buffer is live. That >> makes the most sense to me, but would it cause any problem for your >> use case? >=20 > Thanks for turning around the features so fast. >=20 > I can use `treesit-node-buffer' and `buffer-live-p' to accomplish > that, so perhaps leaving out that check makes sense? I=E2=80=99m hoping to write the function as I described, ie, return t = only if the parser is not deleted and its buffer is live. So I wonder if = this definition of =E2=80=9Clive=E2=80=9D would work for you? Yuan= From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Feb 2023 03:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 61235@debbugs.gnu.org, mickey@masteringemacs.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167582846329858 (code B ref 61235); Wed, 08 Feb 2023 03:55:02 +0000 Received: (at 61235) by debbugs.gnu.org; 8 Feb 2023 03:54:23 +0000 Received: from localhost ([127.0.0.1]:54456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPbXL-0007lW-99 for submit@debbugs.gnu.org; Tue, 07 Feb 2023 22:54:23 -0500 Received: from mail-pj1-f43.google.com ([209.85.216.43]:35528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPbXJ-0007lG-1E for 61235@debbugs.gnu.org; Tue, 07 Feb 2023 22:54:21 -0500 Received: by mail-pj1-f43.google.com with SMTP id n20-20020a17090aab9400b00229ca6a4636so1038587pjq.0 for <61235@debbugs.gnu.org>; Tue, 07 Feb 2023 19:54:20 -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=bHO1EV3d7reXUCGE4vC5j6gv0Did60jGgRHAeu31M5A=; b=KBf7uzo39z1f/RW535d1w/9i2pHXShDvT/3oV+tMlNXNol6IwbPtCkWgNk+f5dF2EY jGMPEcveGk8NlFi0BnTlVsg+hItuVKyjitqhkNmNDPBmqYeqvRsmR0C/+Slbq3W2CFJJ j/rBUj0wD0s8AfMZ+3CDRd0c9mdJJargYJg7H9hIXWNF5fbgtKJE0nfkbi0xifze9diE C6s8giTJpJxQ/up7Qm537zMTGEV+Zfhf2xTXjiWevC8ie/hwh0avjXk+NbMkGatclVBB UNXCc9Z9r/rhNnL8xZsBhodLYkrjeGwnhJz0kqfFXw8CNgXnWS85C5ara73CTICrTeZx rfAw== 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=bHO1EV3d7reXUCGE4vC5j6gv0Did60jGgRHAeu31M5A=; b=RFJzfuzmMTgR/zVxUbLYQ0YpAOi+OPmnQxJtI/k0kx+ScKsDab4gxLVwPLMNXfMu2o /K7QF0hfgSHbhnlkliLtRSjU6vyBSsrokrwoPRuKZHsaZDivoqpHxh5M3hwcZ6pT3ulw cVFGqLO06iPJF2Y919vLVSLrpEo7t3migc5qlroyYGBrZLycymth6Vj75l5C1CJXf3yT QoDZstsAINRm9dZWqSf6MZKrehxisONJzfwIv00Cqy/dKeaSKbH3HiouktGE6jjUwCuN SbLsHTAACwZ9FT53UkuXd8ckNI5otuOwEb2B/uy9t2yQ6bqXd2z+dkJQuzznpNjYyDmo WzFg== X-Gm-Message-State: AO0yUKUfLv/rs3rLV3IUyFr+cq/NHd2rl7Rnt3bNHtMVoaUte0GlaOyl 7J2GcAI+Q+PX0OqXGMssZKI= X-Google-Smtp-Source: AK7set+GBwkZtHjLxfG7S6XHsB5DZ4FD5pzwKD4dMf7Waat4md2n3XJ0wiEDMBsJTzyC3FZHDat++w== X-Received: by 2002:a17:903:234a:b0:199:2353:1eff with SMTP id c10-20020a170903234a00b0019923531effmr6858110plh.21.1675828455342; Tue, 07 Feb 2023 19:54:15 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id je12-20020a170903264c00b00198e663a856sm8675385plb.205.2023.02.07.19.54.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2023 19:54:15 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <83fsbhpst5.fsf@gnu.org> Date: Tue, 7 Feb 2023 19:54:03 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <0469A0B1-784F-4C08-81C2-549CB894C9B2@gmail.com> References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> <83ilgep2ww.fsf@gnu.org> <4C7AB77E-FBB6-4F34-A73A-297243E2E3AF@gmail.com> <83fsbhpst5.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Feb 7, 2023, at 4:24 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Mon, 6 Feb 2023 20:55:38 -0800 >> Cc: Mickey Petersen , >> 61235@debbugs.gnu.org >>=20 >>>>> Yuan, any reason not to extend treesit-node-check instead? >>>>=20 >>>> I did extend treesit-node-check in the patch. But I also added a = function treesit-parser-live-p, which makes the same check but directly = on a parser. It just made sense to me that if we let treesit-node-check = check the nodes=E2=80=99 parser=E2=80=99s status, we=E2=80=99d also add = a function to allow directly checking the status of a parser. >>>=20 >>> That additional function would signal an error in the case discussed >>> here, so I'm not sure we should add it in that shape, or at all. = Why >>> isn't treesit-node-check enough? >>=20 >> Oops, it shouldn=E2=80=99t have. The updated patch fixes that. = Treesit-node-check is enough, it just made more sense = implentattion-wise, to implement that function that checks a parser, and = let treesit-node-check use that function to check the node=E2=80=99s = parser. We can choose to not expose that function, and only expose this = feature through treesit-node-check, if you prefer so. >=20 > I think treesit-node-check alone should be enough. Cool, I=E2=80=99ll only modify treesit-node-check, then. >=20 > One comment: >=20 >> @@ -1943,9 +1959,11 @@ DEFUN ("treesit-node-check", >> result =3D ts_node_is_extra (treesit_node); >> else if (EQ (property, Qhas_error)) >> result =3D ts_node_has_error (treesit_node); >> + else if (EQ (property, Qlive)) >> + result =3D Ftreesit_parser_live_p (XTS_NODE (node)->parser); >=20 > Ftreesit_parser_live_p returns a Lisp object, whereas 'result' is a C > 'bool' type. This won't compile if you configure with > "--enable-check-lisp-object-type=E2=80=9D. Right, sorry :-( Yuan From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Feb 2023 08:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: Eli Zaretskii , 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.16758457575261 (code B ref 61235); Wed, 08 Feb 2023 08:43:02 +0000 Received: (at 61235) by debbugs.gnu.org; 8 Feb 2023 08:42:37 +0000 Received: from localhost ([127.0.0.1]:54763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPg2H-0001Mn-4w for submit@debbugs.gnu.org; Wed, 08 Feb 2023 03:42:37 -0500 Received: from mail-db8eur05on2105.outbound.protection.outlook.com ([40.107.20.105]:21600 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPg2E-0001MU-Q1 for 61235@debbugs.gnu.org; Wed, 08 Feb 2023 03:42:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EFNFWKaLCGlTeTypRJcS9AmAHpIgDEVgsA91g2m07CbkwpCJN08kqTW9HzH8UF/pFE8/QQqo7Wp9SZgfyASZWFNpyJfCXGihSCDDKR21+u65cWH4Mkh9Gm6Bb3yD92suBUewJAOoEO793h9Q/iGfHUQx0eeQMz6CUuA9eYg9uIe9KUkUhwjt7r/12POrg2kMHt/J/zuDlWzxev+MaB0C1mPxP5iqPTnsqSvei4vHD+GD/QgyWwX/PXjkpH8nL6N5S7CDgn5Pwi62vcq2Bh3JsFRPH9AA+lHWRPqlCOxxsPQVSKt8FNSLaD8EQgAyDzCcUsBcMV6AKOqqI6D94acBwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wbZZiw1L/isv6Qg6O9mzkHRWd6I1MiI5gurTMtEJz4I=; b=X5ygfxjX7/lOANSKgktMPvdNQyNABwpHkvepVx9gp1fRrEv2G8vxpaba6wKOlvs9LfuiK5hz46XYC1fAlMJvVmSeXbNwv9LKbil8iT6pmu+po/f8EtudZX7IkOaOrfw6TKc1zQ0PnjKnhgFxZPeDXmDHJUFAan7E7D93650aiUrixS0XMLrDa0o9AjXT/ojcjewb2QnBoWO4KRYnLOErsKalxhLPFjQxrvjHbXJzLNZBjjOIqBWyfn/vDycbvBkkc+LfMAfNCIJqd8dxjTo4Vs3iP1zOi8ONPI6zkYxANZk1oNhyIFtNs6JH76HO3FkLGJF5HApb3KtlSWRbxZTWbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wbZZiw1L/isv6Qg6O9mzkHRWd6I1MiI5gurTMtEJz4I=; b=s9IZOjX0Gf50QImDorZL7QfuZH3Y2CEQSrxXn7pGQEamKUwyZxU9+/rMLudrphSqwmgu6d+3b/xXGl1vQsOpBZzX5KC5plA1WdGOVi7YxIsYgBYEfJ4466XgCxRgH7mOG61oGgplfvyHi2xQZ85ncplUyLD+JYMOIr5/WQt0MOg= Received: from LO2P123CA0076.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::9) by LO6P265MB6735.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:307::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 08:42:28 +0000 Received: from CWLGBR01FT041.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:138:cafe::ab) by LO2P123CA0076.outlook.office365.com (2603:10a6:600:138::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 08:42:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by CWLGBR01FT041.mail.protection.outlook.com (10.152.40.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 08:42:26 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 956DC114003; Wed, 8 Feb 2023 08:42:26 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1675845746; bh=wbZZiw1L/isv6Qg6O9mzkHRWd6I1MiI5gurTMtEJz4I=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=k2wGsrB72hne61xvfXP1HzVzNoiF2eDOxXmSU7jbtFqc3fudpWiafp2WvNAEf8nXR TWVLWwdRYwP21JxzTUHEQOmHQSgOgBxwpQnFIJdEKzcMmQQ44iuLm7Jbo2SavQodja tqQZ5TnGwBtrAvIltsJVrHHNZy5CmX0zmUMHQtYE= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 References: <83edr3q8ez.fsf@gnu.org> <87o7q7dl4o.fsf@masteringemacs.org> <83a61rq6ck.fsf@gnu.org> <87k00uexdt.fsf@masteringemacs.org> <835yceris5.fsf@gnu.org> <87fsbievbi.fsf@masteringemacs.org> <83y1paq0pd.fsf@gnu.org> <877cwtew8o.fsf@masteringemacs.org> <5F2D3873-1CC2-4820-A0F5-F15BF0DDCEDD@gmail.com> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen Date: Wed, 08 Feb 2023 08:41:35 +0000 Organization: Mastering Emacs In-reply-to: <5F2D3873-1CC2-4820-A0F5-F15BF0DDCEDD@gmail.com> Message-ID: <87357geefk.fsf@masteringemacs.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLGBR01FT041:EE_|LO6P265MB6735:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 86c1e1e0-89c5-4f5d-efa7-08db09b0682d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A9tDgvgjEm1BDuc61Ikb6oDoANlGhthodXHnmc16zBZfqQlxcjpKVJxDLUqMwW7J71iuLPKfx0lbaacnSq1MjHc41YC92XpAzKimaQQfFo+hYI3Fc0trIyl2CsPt5qdlblSBXFBaa2SdusXYkkpbvGROLfTumNZoCDz3D9VDsU1Mq4HF85kFNW5jc0O0s4NA8gEVxvWnCATCxfnIt9bp6KIGvYTlET+YnoykLWZie3JefjhoEl7Fx3kmSadTaSl3wzIS8Z+egetueqyuEeSojNqWyHGmluhvjpIopi02CwiFSlr/ZvBp3XB/G9iCwpHBjaBhxUsmrgh8sv4KpD0SELqkIF4aE2CAFL+HrEV/g3nYd5f8XrK0IMktVvCSqgRi5KU/1pqbmzkTRc9BCYKEEbpLrDKXlgpb5lJVPO9mXKGpm0E6XUt4lvcQsSU1JTKZxvP4/kaNdrw6Dia1XzwLCc/NNglS2/g8xFFAvOwtCtyCVj9JAXhXQW9lljA+hO9OPf52n07C30IUEiEpyCZbWfuA92ha1gwwhxF+SqXKYO7xHmv4333UpdjjSlGpwmXaGcyhPTfseXvkBebnRPJjIqzEXstN83DA97DGZpSxh+VddcvS5Z9k9qkorX8dBNeub+CgM2adrtA450Ff2MyOGOVKtISQWnq06107N4FcrH7w4vVFZE2Wly8quOh+0OkZb6lsaSWr/wWxkkxZvVclQE174454x9D8Z88YEAlo1pQ1fobC7lrk3e3uxLJrbSmwlO3KNqYbQlZT/vNLIHSedmkIW4XO/R3TuEKuFYDHqyvho69tVYBEkgpknNoqY7IM X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(376002)(346002)(396003)(39830400003)(136003)(451199018)(46966006)(36840700001)(26005)(186003)(53546011)(2906002)(6266002)(6666004)(36756003)(5660300002)(478600001)(356005)(82310400005)(8936002)(41300700001)(40480700001)(6862004)(2616005)(36916002)(47076005)(8676002)(36860700001)(336012)(70586007)(70206006)(4326008)(83380400001)(86362001)(7636003)(316002)(42186006)(7596003)(38230200001)(81973001)(43043002)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 08:42:26.9323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86c1e1e0-89c5-4f5d-efa7-08db09b0682d X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: CWLGBR01FT041.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO6P265MB6735 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan Fu writes: >> On Feb 7, 2023, at 12:03 AM, Mickey Petersen = wrote: >> >> >> Yuan Fu writes: >> >>>> On Feb 6, 2023, at 7:21 AM, Eli Zaretskii wrote: >>>> >>>>> From: Mickey Petersen >>>>> Cc: casouri@gmail.com, 61235@debbugs.gnu.org >>>>> Date: Mon, 06 Feb 2023 14:08:46 +0000 >>>>> >>>>> All I want is a way for treesit-node-check to tell me if the node >>>>> belongs to a dead or alive parser. >>>> >>>> That'd be fine by me, but the patch posted by Yuan was a different >>>> one. >>>> >>>> Yuan, any reason not to extend treesit-node-check instead? >>> >>> I did extend treesit-node-check in the patch. But I also added a >>> function treesit-parser-live-p, which makes the same check but >>> directly on a parser. It just made sense to me that if we let >>> treesit-node-check check the nodes=E2=80=99 parser=E2=80=99s status, we= =E2=80=99d also add a >>> function to allow directly checking the status of a parser. >>> >>> Micky, the function I added (and the extension to treesit-node-check) >>> checks that the parser is not deleted AND its buffer is live. That >>> makes the most sense to me, but would it cause any problem for your >>> use case? >> >> Thanks for turning around the features so fast. >> >> I can use `treesit-node-buffer' and `buffer-live-p' to accomplish >> that, so perhaps leaving out that check makes sense? > > I=E2=80=99m hoping to write the function as I described, ie, return t onl= y if > the parser is not deleted and its buffer is live. So I wonder if this > definition of =E2=80=9Clive=E2=80=9D would work for you? Sounds good to me, and I think others will find it useful as well! From unknown Sun Jun 22 00:35:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser References: <87h6w3hmu6.fsf@masteringemacs.org> In-Reply-To: <87h6w3hmu6.fsf@masteringemacs.org> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Feb 2023 01:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61235 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mickey Petersen Cc: Eli Zaretskii , 61235@debbugs.gnu.org Received: via spool by 61235-submit@debbugs.gnu.org id=B61235.167599253024544 (code B ref 61235); Fri, 10 Feb 2023 01:29:01 +0000 Received: (at 61235) by debbugs.gnu.org; 10 Feb 2023 01:28:50 +0000 Received: from localhost ([127.0.0.1]:33951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQIDZ-0006Nm-UV for submit@debbugs.gnu.org; Thu, 09 Feb 2023 20:28:50 -0500 Received: from mail-pj1-f44.google.com ([209.85.216.44]:45822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQIDX-0006NT-Vn for 61235@debbugs.gnu.org; Thu, 09 Feb 2023 20:28:48 -0500 Received: by mail-pj1-f44.google.com with SMTP id f15-20020a17090ac28f00b00230a32f0c9eso4072880pjt.4 for <61235@debbugs.gnu.org>; Thu, 09 Feb 2023 17:28:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=WZ3NNBnCwkMurKAk0CYve42mYl7U0Jqqf82eorRwG5w=; b=LkqlFOs98upFA6HSYw2MMC7NapzB4e0+bsbWI6wDbTLPp6NW7/fD5tpjZXXGNnnm+X nlnn/B/raCfMH+XI5wJgJG6TwLLJLY7NMUsDsnY1GbAvrkHpBmQCu8P/sig/K5BNMYs2 1ePZUp1XhRAQ1KUQtl8iCoHi9Kf4Wr8s92SH4uU9WgkSYmjNT6IFs93Yeh/ChyBLMQW+ yX9t2NEBkvlOkMNN59SWAZx3+PkHOpjsuR73+EcATRMHJZ4vkKYILmntmU+wD+GA7uSQ Wxo5pomXYf7ggwgNDYAZ8dFAM2VQOHTevIxPT9Sa43tvzV4Oq3MIci40dnRcNBuusPx+ eGIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WZ3NNBnCwkMurKAk0CYve42mYl7U0Jqqf82eorRwG5w=; b=Q+8t4euk4yUPv8Mo3jSTDCLqUN8HmzQc0cVgSDtMBTyQNt0Ed8ZgXTEVg5DoFGQTFe 7KjG6S0szCjzlWSTW2J+xCx6Gm0XvM7UIYGUwaCUTjmysxDlbW9iA/jsDS2zi/8G+8gv x+XTbe5IJDxQ8/sSjUhontn3NURhljmKQPepf+MTQ9ZqwAkV13WE/kA+u0sfNrMSHgsi 5qgnrVD9LkhV73CjvwchyAQKLSfIOyk64gtvnx+yXH9TeWDk4JZYtsnqcSJ7nfLgB36d KUIgRUnOthe8X2lts9c9rgHtSHX09fvkqER84wtBvajuc1uPMG68lDRz3DgHSEQV8MHG 4m/w== X-Gm-Message-State: AO0yUKWOnykl6zCVqNquv1fNfK8URHeq1goEKwKrOleJz9Yz6C5Bw0Sx W/51kjGwz3e75+nlU2pwVpY= X-Google-Smtp-Source: AK7set+fmmdLCgBwlEl8U9Ww3UuG28/laNlaWEbaJnz4jpT7G8SJ8x7/1Ms+HxVwC6YCuxZe36bg7w== X-Received: by 2002:a17:90b:3b8b:b0:231:1c47:1654 with SMTP id pc11-20020a17090b3b8b00b002311c471654mr7487554pjb.27.1675992522334; Thu, 09 Feb 2023 17:28:42 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id m3-20020a632603000000b0049f77341db3sm1839652pgm.42.2023.02.09.17.28.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2023 17:28:41 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Message-Id: Date: Thu, 9 Feb 2023 17:28:30 -0800 X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mickey Petersen writes: > Yuan Fu writes: > >>> On Feb 7, 2023, at 12:03 AM, Mickey Petersen = wrote: >>> >>> >>> Yuan Fu writes: >>> >>>>> On Feb 6, 2023, at 7:21 AM, Eli Zaretskii wrote: >>>>> >>>>>> From: Mickey Petersen >>>>>> Cc: casouri@gmail.com, 61235@debbugs.gnu.org >>>>>> Date: Mon, 06 Feb 2023 14:08:46 +0000 >>>>>> >>>>>> All I want is a way for treesit-node-check to tell me if the node >>>>>> belongs to a dead or alive parser. >>>>> >>>>> That'd be fine by me, but the patch posted by Yuan was a different >>>>> one. >>>>> >>>>> Yuan, any reason not to extend treesit-node-check instead? >>>> >>>> I did extend treesit-node-check in the patch. But I also added a >>>> function treesit-parser-live-p, which makes the same check but >>>> directly on a parser. It just made sense to me that if we let >>>> treesit-node-check check the nodes=E2=80=99 parser=E2=80=99s = status, we=E2=80=99d also add a >>>> function to allow directly checking the status of a parser. >>>> >>>> Micky, the function I added (and the extension to = treesit-node-check) >>>> checks that the parser is not deleted AND its buffer is live. That >>>> makes the most sense to me, but would it cause any problem for your >>>> use case? >>> >>> Thanks for turning around the features so fast. >>> >>> I can use `treesit-node-buffer' and `buffer-live-p' to accomplish >>> that, so perhaps leaving out that check makes sense? >> >> I=E2=80=99m hoping to write the function as I described, ie, return t = only if >> the parser is not deleted and its buffer is live. So I wonder if this >> definition of =E2=80=9Clive=E2=80=9D would work for you? > > Sounds good to me, and I think others will find it useful as well! Done. Yuan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 19 15:58:09 2023 Received: (at control) by debbugs.gnu.org; 19 Feb 2023 20:58:09 +0000 Received: from localhost ([127.0.0.1]:49785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTql7-0005gx-AG for submit@debbugs.gnu.org; Sun, 19 Feb 2023 15:58:09 -0500 Received: from mail-pj1-f41.google.com ([209.85.216.41]:54051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTql5-0005fs-9V for control@debbugs.gnu.org; Sun, 19 Feb 2023 15:58:07 -0500 Received: by mail-pj1-f41.google.com with SMTP id ot9so1314732pjb.3 for ; Sun, 19 Feb 2023 12:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=kLKPJ+Vy8w1cXQEDDKyVPnn5pOv/uah4q8kQsZ4Cb6c=; b=A3vQS0JbMb5aP6WxZB/SQQtGe7F+17wHMV95mpczbBy5gluxYf2wDJxPA//YtVwt6q SCaBPfSMubh5jWvOF3oE39iNXQPxhpD5sKgzi8UduCcNjI1GFbJJ4i3bEPQUoZilqG+5 lCQwI48+Vc1VZppVMKpgowBRY9mvAMcAkuBMM73bV2Bm9Y5kscK+qCq5eV9PrHGOTYHV S75qpzi0vk5S0baB+xvqKeBQBSGnHdMaf6RVVy9JZ9lFm2aqnQgoGmtyKoAZA6kZtUKJ P3+54ntJ7o0u1HfChbRUzPz8mBDk/GMf/fjPUMO1YDwLQDmsVBRF6x2MzbIgH3Y32Wwm ZJuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kLKPJ+Vy8w1cXQEDDKyVPnn5pOv/uah4q8kQsZ4Cb6c=; b=C9RrCiA8bs94ed23nHtqIIN2SRaw+lB9fWMBxGnr6npa1LCSVSxCsaF+456gCQFy30 I7gaxHWkgPfrLYMM2R3LWratqK9keWeF6xA4KueyyGs4ujN+F6QiF9maVvC6tUDmtIe4 1Ys00r8S3+Bl/sO3tjEE+gKT9/6Jetg1KyBORJOdnGT9G9h+v//rkr19LmT56p0GdRaj 1ayIOjQbCEs2xMyZExWPK3MO+YsGTO4nh70rTcMk3clGn5SJSrCm3YA0A4taQdWMKj73 L57u6ctCUHlvNrBziiq5A96P20YTCKfru+0AV8FkBM3CEcqo9IbmjWf3SD1/9OcYl2Hl 0SDA== X-Gm-Message-State: AO0yUKXp9tYnrIrO4wq53aySSNTCXVjcv9aaodDm1Z5WNytrXKS32s1b NUVi7R9pi42yBibnexo293Y8jyyrzOE= X-Google-Smtp-Source: AK7set+iGNVn7FiimCC4Kp8d4RGB7LrzFYQW2qxPX9M+gFYlfwOjWVvQrI0jJvcFTsBhOHIaqjoADQ== X-Received: by 2002:a05:6a21:788c:b0:c6:bb08:a7ab with SMTP id bf12-20020a056a21788c00b000c6bb08a7abmr7985688pzc.28.1676840281087; Sun, 19 Feb 2023 12:58:01 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id d6-20020aa78e46000000b005accb31201fsm323164pfr.26.2023.02.19.12.58.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Feb 2023 12:58:00 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: control message for bug #61235 Message-Id: Date: Sun, 19 Feb 2023 12:57:50 -0800 To: control@debbugs.gnu.org X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 61235 29.1 quit