From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#75079: Default parser for treesit-explore Date: Wed, 25 Dec 2024 09:56:20 +0200 Organization: LINKOV.NET Message-ID: <87zfkk191f.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33696"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Yuan Fu To: 75079@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 25 09:12:36 2024 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 1tQMVP-0008g7-Vc for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Dec 2024 09:12:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQMUv-0000BI-OB; Wed, 25 Dec 2024 03:12:05 -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 1tQMUu-0000Ai-BW for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:12:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQMUu-0003Ll-33 for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:12:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=KClmVtqm/XIbF6bx4nhEQVtsISC0EaxAX4cTw8Fyn3Y=; b=Drapue5zZZh6izThTs92HacyGxVYxzAOvfIhnhsF7IYJFM3cztTyi+Ra5uNkKCxPO5x4atn3PGo51GVZGZi6LWHZmlnVUNVD91pQyKOGtCKCgm5vQO5Ivi+dyNKU3E635Y9Z8MLfc0V9P8RcLltNhf7gve3H+qvqE2Hi+1RX6SHITvC4avOJaZiA4dXdS2x2sfq7a/M22NoOnMMflPndM+iO1ESBZ2wsCXq1Ss8xRZHYkgQLJ1sni64COMTSkDz0+BiS8bX43ncHv4GBvudd0dgSUsEalztv9MBTnbEpzwuCAiZH1dsKavRyTGvUaHVB5vQvfoODV4ZGeHJnF9V6xA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQMUs-0005so-Ms; Wed, 25 Dec 2024 03:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: casouri@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Dec 2024 08:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75079 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Yuan Fu Original-Received: via spool by submit@debbugs.gnu.org id=B.173511426722502 (code B ref -1); Wed, 25 Dec 2024 08:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Dec 2024 08:11:07 +0000 Original-Received: from localhost ([127.0.0.1]:36051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQMTy-0005qr-O6 for submit@debbugs.gnu.org; Wed, 25 Dec 2024 03:11:07 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:47684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQMTp-0005ps-Kp for submit@debbugs.gnu.org; Wed, 25 Dec 2024 03:10:58 -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 1tQMTo-0008Km-N1 for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:10:57 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQMTn-00033e-4C for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:10:56 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id DB4F9240002 for ; Wed, 25 Dec 2024 08:10:52 +0000 (UTC) X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.193; envelope-from=juri@linkov.net; helo=relay1-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:297719 Archived-At: --=-=-= Content-Type: text/plain Currently loading the desktop is disrupted by the prompt that asks for a parser name when treesit-explore-mode was enabled in a buffer before. The second part of the following patch fixes this by omitting treesit-explore-mode. But anyway it's very tedious to select the single parser every time when enabling treesit-explore-mode. So the first part of this patch avoids this unnecessary selection: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=treesit-explorer-switch-parser.patch diff --git a/lisp/treesit.el b/lisp/treesit.el index 464b7e688be..5428e84fa5a 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3911,8 +3911,10 @@ treesit-explorer-switch-parser (interactive (list (let* ((parser-alist (treesit--explorer-generate-parser-alist)) - (parser-name (completing-read - "Parser: " (mapcar #'car parser-alist)))) + (parser-name (if (= (length parser-alist) 1) + (car parser-alist) + (completing-read + "Parser: " (mapcar #'car parser-alist))))) (alist-get parser-name parser-alist nil nil #'equal)))) (unless treesit-explore-mode @@ -3952,7 +3954,13 @@ treesit-explore-mode (unless (memq 'treesit--explorer-tree-mode desktop-modes-not-to-save) (push 'treesit--explorer-tree-mode - desktop-modes-not-to-save)))) + desktop-modes-not-to-save))) + ;; Tell `desktop-save' to not save minor mode. + (when (boundp 'desktop-minor-mode-table) + (unless (member '(treesit-explore-mode nil) + desktop-minor-mode-table) + (push '(treesit-explore-mode nil) + desktop-minor-mode-table)))) ;; Turn off explore mode. (remove-hook 'post-command-hook #'treesit--explorer-post-command t) --=-=-=--