From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60880: 30.0.50; tree-sitter `treesit-explore-mode' is buggy and does not behave properly Date: Fri, 20 Jan 2023 09:02:01 +0200 Message-ID: <83ilh1ofiu.fsf@gnu.org> References: <87wn5ls2bu.fsf@masteringemacs.org> <616F5C5A-1D12-4E14-90D4-8ABE7FD869BD@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34143"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60880@debbugs.gnu.org, mickey@masteringemacs.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 20 08:03:32 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIlQy-0008g9-0E for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Jan 2023 08:03:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIlQf-000485-LI; Fri, 20 Jan 2023 02:03:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIlQV-0003vT-Dx for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2023 02:03:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIlQU-0005cl-Bt for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2023 02:03:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pIlQT-0007sj-Ra for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2023 02:03:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Jan 2023 07:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60880 X-GNU-PR-Package: emacs Original-Received: via spool by 60880-submit@debbugs.gnu.org id=B60880.167419813530208 (code B ref 60880); Fri, 20 Jan 2023 07:03:01 +0000 Original-Received: (at 60880) by debbugs.gnu.org; 20 Jan 2023 07:02:15 +0000 Original-Received: from localhost ([127.0.0.1]:45301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIlPi-0007r8-MQ for submit@debbugs.gnu.org; Fri, 20 Jan 2023 02:02:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIlPe-0007qq-On for 60880@debbugs.gnu.org; Fri, 20 Jan 2023 02:02:13 -0500 Original-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 1pIlPY-0005NW-Hc; Fri, 20 Jan 2023 02:02:04 -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=gQFzYdXFtbQJ1GL4oEdtw1JrSsAVyrItw2v9BZCIJLM=; b=jv3Ljsq44Jrd atMWP8QgN7/ylijAdtDMrDZCiFXlPp3S7Y0uaMDpsbGGIPeSG4yYNh4dyqxgaWnn6fNJTmp0x/4U1 Fus5TDxgN9lGsxrEdkzF7VtCIvczZRkSZA605KLKO4x4cHmTUqV6rq2Y6v7kyhxaE5xsHIqKf0hWV gNFQZmlFJ1sMXWdSUp52uLS++FpX0LvdIf9duYTujJtRsb7qs6hKi9n6TIyahKNdGuS4oxVYaWwZn YpDvVxJ+wNB5d/vpFEAjt7JXZZrPEChfe9ayd2EWov4LJH+A5rj1HrirV1RAu2fSiPH+gNpjgFApg P7smerGtxW2KFY6qOpMQEg==; Original-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 1pIlPX-0007Py-Ko; Fri, 20 Jan 2023 02:02:04 -0500 In-Reply-To: <616F5C5A-1D12-4E14-90D4-8ABE7FD869BD@gmail.com> (message from Yuan Fu on Thu, 19 Jan 2023 14:30:46 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253749 Archived-At: > Cc: 60880@debbugs.gnu.org > From: Yuan Fu > Date: Thu, 19 Jan 2023 14:30:46 -0800 > > > Mickey Petersen writes: > > > A medley of issues here: > > > > 1. Executing `treesit-explore-mode' on a buffer with no valid grammar > > support causes the minor mode (and playground buffer) to stick around and "load" anyway. > > > > 2. Bailing out of the grammar prompt does not, in actual fact, stop > > explore mode from proceeding. Instead it creates an empty buffer and > > it still engages the minor mode. > > > > 3. Killing the playground buffer does not remove the explore mode buffer. > > > > 4. treesit-explore-mode is stored against a buffer during > > `desktop-save' (and subsequently read with) `desktop-read'. Thus > > broken buffers or files inherit the explore mode. This is especially > > pernicious due to #1, #2, and #3. > > Ok, I fixed those problems. Now if the language is not available, > treesit-explore-mode raises an error instead of continuing, desktop-save > will not save the explorer buffer, and killing the source buffer also > kills the explorer buffer. I don't think the desktop-save part is correct: the test should be at desktop-read time, not at desktop-save time. Because the fact we had the language available when we saved the desktop doesn't guarantee we will have it available when restoring that desktop: it could be in a different build of Emacs or even on a different machine. I'm not sure I understand the problem which desktop-read has when restoring desktop with buffers in treesit-explore-mode, but if the problems are more than just warning messages, then desktop-read should detect these problems, emit an echo-area message, and refrain from restoring the mode. Like it does with buffers that visited files which are no longer there, for example.