From: Yuan Fu <casouri@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 75079@debbugs.gnu.org
Subject: bug#75079: Default parser for treesit-explore
Date: Wed, 25 Dec 2024 00:36:58 -0800 [thread overview]
Message-ID: <A8934C30-48EF-4932-AD0F-B1DC1CBA20DA@gmail.com> (raw)
In-Reply-To: <87zfkk191f.fsf@mail.linkov.net>
> On Dec 24, 2024, at 11:56 PM, Juri Linkov <juri@linkov.net> wrote:
>
> 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:
>
> 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)
Thanks Juri, have you applied the patch? If not, please feel free to do :-)
Yuan
next prev parent reply other threads:[~2024-12-25 8:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-25 7:56 bug#75079: Default parser for treesit-explore Juri Linkov
2024-12-25 8:36 ` Yuan Fu [this message]
2024-12-25 17:54 ` Juri Linkov
2024-12-25 20:08 ` Yuan Fu
2024-12-25 12:39 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A8934C30-48EF-4932-AD0F-B1DC1CBA20DA@gmail.com \
--to=casouri@gmail.com \
--cc=75079@debbugs.gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).