unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Kangas <stefankangas@gmail.com>,
	60511@debbugs.gnu.org
Subject: bug#60511: 29.0.50; treesit-ready-p should not emit warning by  default
Date: Sat, 7 Jan 2023 17:31:16 -0800	[thread overview]
Message-ID: <B1EA10E7-5AC1-4F81-869A-112CCF8AED80@gmail.com> (raw)
In-Reply-To: <CADwFkmmHnV1efr0o8utz6Oj4+LALGADF+cdZC_9EBHXj_WLeeg@mail.gmail.com>


Juri Linkov <juri@linkov.net> writes:

>>>> This currently emits a warning if the ruby grammar is not installed:
>>>>
>>>>     (treesit-ready-p 'ruby)
>>>>
>>>> I think it should *not* emit a warning, as no other predicates in Emacs
>>>> do (e.g. `featurep', `integerp', etc.).
>>>>
>>>> It could have an optional flag to emit a warning, if there's a strong
>>>> need for that.  But personally, I'd rather see a new function for that.
>>>>
>>>> I also don't see much need for the `message' symbol as the second
>>>> argument, so I'd simplify the API by dropping that part.  It's currently
>>>> unused in our tree.
>>>
>>> Like the argument NOERROR of `require', the argument QUIET of `treesit-ready-p'
>>> could do the same.
>>
>> Maybe rename it to treesit-check-readiness?
>
> I think treesit-ready-p already is a good name.
> We just need to support more values in its argument QUIET,
> with a new value that does nothing in case of an error,
> and just returns nil.

It already has such option: if QUIET is t, treesit-ready-p returns nil and don’t emit anything.

I can make treesit-ready-p not emit any warning by default, and change
the quiet parameter to WARN, and accept either 'warn or ‘message.

Basically:

(treesit-ready-p lang) => t/nil
(treesit-ready-p lang 'warn) => t/emit warning
(treesit-ready-p lang 'message) => t/message

Eli, WDYT?

Yuan





  parent reply	other threads:[~2023-01-08  1:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 11:19 bug#60511: 29.0.50; treesit-ready-p should not emit warning by default Stefan Kangas
2023-01-03 17:44 ` Juri Linkov
2023-01-04  7:02 ` Yuan Fu
2023-01-04  7:47   ` Juri Linkov
2023-01-08  1:31 ` Yuan Fu [this message]
2023-01-08  5:53   ` Eli Zaretskii
2023-01-08  8:39     ` Juri Linkov
2023-01-08 11:03       ` Eli Zaretskii
2023-01-08 17:35         ` Juri Linkov
2023-01-08 17:57           ` Eli Zaretskii
2023-01-08 18:11             ` Juri Linkov
2023-01-08 18:48               ` Eli Zaretskii
2023-01-08 18:14     ` Stefan Kangas
2023-01-08 18:28       ` Juri Linkov
2023-01-08 18:49         ` 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=B1EA10E7-5AC1-4F81-869A-112CCF8AED80@gmail.com \
    --to=casouri@gmail.com \
    --cc=60511@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=stefankangas@gmail.com \
    /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).