emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New tree-sitter mode: bison-ts-mode


From: Yuan Fu
Subject: Re: New tree-sitter mode: bison-ts-mode
Date: Thu, 28 Sep 2023 18:26:04 -0700

(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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]