unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: "\"Augustin Chéneau (BTuin)\"" <btuin@mailo.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: New tree-sitter mode: bison-ts-mode
Date: Thu, 28 Sep 2023 18:26:04 -0700	[thread overview]
Message-ID: <93113299-17F9-4657-8CF9-B285D6DD89F9@gmail.com> (raw)
In-Reply-To: <b999a251-1778-49ac-90dc-ef8d78d36d53@mailo.com>

(It seems that you forgot to CC, I added emacs-devel back.)

> On Sep 28, 2023, at 3:41 AM, Augustin Chéneau (BTuin) <btuin@mailo.com> wrote:
> 
> Le 28/09/2023 à 09:03, Yuan Fu a écrit :
>> Thanks. LGTM except some minor byte-compile warnings. I attached a diff, please see if you like those changes.
>> Once the paperwork is done I think we are good to go.
>> Yuan
> 
> diff --git a/bison-ts-mode.el b/bison-ts-mode.el.1
> index febd2d9..913c1fa 100644
> --- a/bison-ts-mode.el
> +++ b/bison-ts-mode.el.1
> @@ -30,6 +30,8 @@
> 
> (require 'treesit)
> (require 'c-ts-common)
> +(require 'c-ts-mode) ; For ‘c-ts-mode--get-indent-style’.
> +(require 'java-ts-mode) ; For ‘java-ts-mode--indent-rules’.
> 
> (declare-function treesit-parser-create "treesit.c")
> (declare-function treesit-induce-sparse-tree "treesit.c")
> 
> 
> I did that because if you don't have one of the grammars installed (for C, C++, or Java), it generates a warning about a missing grammar, such as:
> 
> Warning (treesit): Cannot activate tree-sitter, because language grammar for java is unavailable (not-found)
> 
> This is because of lines like (line 404 in java-ts-mode.el):
> 
> (if (treesit-ready-p 'java)
>    (add-to-list 'auto-mode-alist '("\\.java\\'" . java-ts-mode)))
> 
> at the end of the files.

Makes sense! I would add a comment explaining that.

> 
> By the way, shouldn't (treesit-ready-p 'java) here have its argument QUIET set to t?  Why generate a warning here, since there is already a check in define-derived-mode?
> 

Yeah, long story short, after considerable discussion, it’s decided that (at least for Emacs 29) loading the tree-sitter major modes files should automatically enable the major mode.

> 
> 
> @@ -108,8 +111,8 @@ buffer."
>             (group (1+ (in alpha "+")))
>             "\"")
>            nil
> -           t)))
> -    (match-string-no-properties 1)))
> +           t)
> +        (match-string-no-properties 1)))))
> Thanks!
> 

Yuan


  parent reply	other threads:[~2023-09-29  1:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 20:15 New tree-sitter mode: bison-ts-mode Augustin Chéneau (BTuin)
2023-09-21 22:23 ` Stefan Kangas
2023-09-22  5:52 ` Eli Zaretskii
2023-09-22 23:44   ` Yuan Fu
2023-09-23  5:52     ` Eli Zaretskii
2023-09-26  3:42       ` Yuan Fu
2023-09-22  7:38 ` Philip Kaludercic
2023-09-22 14:53   ` Augustin Chéneau (BTuin)
2023-09-22 20:40     ` Philip Kaludercic
2023-09-22 23:21       ` Augustin Chéneau (BTuin)
2023-09-22  7:42 ` Stefan Kangas
2023-09-22  8:45 ` Yuan Fu
2023-09-24 21:10 ` Yuan Fu
2023-09-26 11:52   ` Augustin Chéneau (BTuin)
2023-09-28  7:03     ` Yuan Fu
     [not found]       ` <b999a251-1778-49ac-90dc-ef8d78d36d53@mailo.com>
2023-09-29  1:26         ` Yuan Fu [this message]
2023-09-29 14:13       ` 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=93113299-17F9-4657-8CF9-B285D6DD89F9@gmail.com \
    --to=casouri@gmail.com \
    --cc=btuin@mailo.com \
    --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).