all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tad Lispy <hello@tad-lispy.com>, Yuan Fu <casouri@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Tree Sitter and highlights.scm file
Date: Fri, 01 Dec 2023 10:25:37 +0200	[thread overview]
Message-ID: <83wmty9vni.fsf@gnu.org> (raw)
In-Reply-To: <lui_X7s-LvP5tVNiPp-nsjVo4QmU1AYSDOkdwnv0O94u2sWnjGSQzWNEqz53hlWfZ0Oys_LutQIF2gcUJLa_9ISltOCPFNyEjz57whHYWKI=@tad-lispy.com> (message from Tad Lispy on Thu, 30 Nov 2023 11:35:42 +0000)

> Date: Thu, 30 Nov 2023 11:35:42 +0000
> From: Tad Lispy <hello@tad-lispy.com>
> 
> Hi! It's my first post ever to a mailing list, so I hope I do everything
> right.  I'm also not very experienced with Emacs Lisp.
> 
> Here is my context. I'm working on a major mode for a new programming
> language.  I'd like to leverage the built-in Tree Sitter support for
> syntax highlighting.  My colleague works on the Tree Sitter grammar. In
> their repository there is a file called `queries/highlights.scm`. It's a
> scheme file that contains queries for different syntactic elements. Most
> other grammars I see also have such file, so I think it's standard in
> Tree Sitter grammars. I think it's generated by the `tree-sitter`
> command line program and later customized by a grammar author. It looks
> like all the necessary information for syntax highlighting is there.
> Since it's also a lisp, it should be possible to use this file to
> automatically derive font lock rules. But all examples of tree sitter
> modes I see re-implement all the queries in Emacs Lisp with
> `treesit-font-lock-rules` function. Why is that?
> 
> Before Emacs 29 there was a suite of 3rd party packages maintained by
> Tuấn-Anh Nguyễn. One of the packages is a library of Tree Sitter
> languages, that for each language contains the `highlights.scm` file.
> See for example
> https://github.com/emacs-tree-sitter/tree-sitter-langs/blob/master/queries/elm/highlights.scm.
> So it looks like previously it was possible to utilize this file. Can we
> still do it with Emacs 29?

Yuan, any comments?



  reply	other threads:[~2023-12-01  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 11:35 Tree Sitter and highlights.scm file Tad Lispy
2023-12-01  8:25 ` Eli Zaretskii [this message]
2023-12-02  3:40   ` Yuan Fu

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wmty9vni.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=hello@tad-lispy.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.