unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: emacs-29 56cd810b9d1: Don’t signal warning when loading go-ts-mode.el without grammar
Date: Thu, 2 Mar 2023 19:05:27 -0800	[thread overview]
Message-ID: <6B49E4E7-8FB6-47A6-A380-538BEE2DE1E1@gmail.com> (raw)
In-Reply-To: <83r0u7eh2f.fsf@gnu.org>

> 
> Yuan, why was this change made?  The fact that loading go-ts-mode.el
> without a grammar library causes a warning is the intended behavior:
> users who don't have tree-sitter setup for Go shouldn't load this
> mode, and if they do, they should know it failed, and why.  The above
> change makes it fail silently, which is not a Good Thing.

I thought that we’d want the warning to appear when user calls go-mod-ts-mode or open a file that uses that mode, rather than at load time. What I had in mind is when someone only install tree-sitter-go and want to edit some Go file, and they get this warning of go-mod being not available. This is what I encountered which prompted this change. I didn’t know that was intentional; since it’s intentional, please revert it (maybe you already have), and sorry for the hiccup :-)

> made this even worse: now we have a byte-compilation warning in a
> build without tree-sitter, and this code will signal a generic error
> (whose text is not very helpful to users) if the file is loaded in a
> build without tree-sitter.  This is all against the intended behavior
> of these modes.
> 
> Again, what problem were you trying to fix with that change?

Treesit-ready-p is intended to be used for major modes, so it includes checks for current buffer’s size, which doesn’t make much sense when called when loading the file. But if you intentionally used that function for the warning, I guess there is no harm using it this way, as the default size threshold is rather large.

Yuan




  reply	other threads:[~2023-03-03  3:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02  7:41 emacs-29 56cd810b9d1: Don’t signal warning when loading go-ts-mode.el without grammar Eli Zaretskii
2023-03-03  3:05 ` Yuan Fu [this message]
2023-03-03  7:41   ` Eli Zaretskii
2023-03-03 22:06     ` Yuan Fu
2023-03-04  7:05       ` 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=6B49E4E7-8FB6-47A6-A380-538BEE2DE1E1@gmail.com \
    --to=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).