From: Eli Zaretskii <eliz@gnu.org>
To: Ruijie Yu <ruijie@netyu.xyz>
Cc: philipk@posteo.net, casouri@gmail.com, emacs-devel@gnu.org
Subject: Re: Code quality of some -ts-mode major modes
Date: Fri, 17 Mar 2023 13:52:46 +0200 [thread overview]
Message-ID: <83ilezegs1.fsf@gnu.org> (raw)
In-Reply-To: <sdvv8izws8x.fsf@fw.net.yu> (emacs-devel@gnu.org)
> Cc: Yuan Fu <casouri@gmail.com>, emacs-devel@gnu.org
> Date: Fri, 17 Mar 2023 18:29:52 +0800
> From: Ruijie Yu via "Emacs development discussions." <emacs-devel@gnu.org>
>
> > (require 'treesit)
> >
> > -(declare-function treesit-parser-create "treesit.c")
> > +;; (declare-function treesit-parser-create "treesit.c") ;doesn't appear necessary
>
> I noticed this portion as well as in c-ts-mode.el, where a bunch of
> `declare-function''s follow `(require 'treesit)'. Does it work if all
> calls to `(require 'treesit)' are wrapped with `eval-and-compile', and
> we remove all the `declare-function''s?
No, it doesn't. The declare-function are about functions implemented
in treesit.c, not treesit.el, so loading the latter cannot possibly
fix the need for declare-function in these cases.
> Or were these `declare-functions' calls simply there for redundancy?
No, they are there to avoid byte-compiler warnings when building Emacs
without tree-sitter support (which is optional).
> > - (when (treesit-ready-p 'yaml)
> > + (when (treesit-ready-p 'yaml) ;why not raise an `user-error'?
> > (treesit-parser-create 'yaml)
>
> Raising a `user-error' would disallow the user from staying in the TS
> mode (in this case, `yaml-ts-mode'). IIRC, someone said that a TS mode
> should be roughly the same as `fundamental-mode' if the respective TS
> grammar library is absent. Not sure exactly, so let's wait for a
> maintainer's response on that.
We _want_ this to signal an error so that the user is acutely aware
his/her system is not configured for these modes.
next prev parent reply other threads:[~2023-03-17 11:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 10:08 Code quality of some -ts-mode major modes Philip Kaludercic
2023-03-17 10:29 ` Ruijie Yu via Emacs development discussions.
2023-03-17 11:52 ` Eli Zaretskii [this message]
2023-03-17 12:37 ` Philip Kaludercic
2023-03-17 13:54 ` Eli Zaretskii
2023-03-17 15:20 ` Philip Kaludercic
2023-03-17 15:31 ` Eli Zaretskii
2023-03-17 15:49 ` Philip Kaludercic
2023-03-17 16:35 ` Eli Zaretskii
2023-03-17 16:53 ` Philip Kaludercic
2023-03-17 21:45 ` Dmitry Gutov
2023-03-18 5:59 ` Eli Zaretskii
2023-03-17 11:46 ` 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=83ilezegs1.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=philipk@posteo.net \
--cc=ruijie@netyu.xyz \
/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).