all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Huan Thieu Nguyen <nguyenthieuhuan@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] treesit.el: New function to describe font-lock rules
Date: Fri, 6 Oct 2023 00:05:17 -0700	[thread overview]
Message-ID: <43D13B5A-A267-4181-893E-506D955E973E@gmail.com> (raw)
In-Reply-To: <46a990f4-0cc1-43cb-b017-38e205e05777@gmail.com>

Hi Huan,

> On Oct 3, 2023, at 6:32 AM, Huan Thieu Nguyen <nguyenthieuhuan@gmail.com> wrote:
> 
> Hello emacs maintainers,
> 
> I think most major modes don't need to use multiple tree-sitter grammars, so I made a function called `treesit-font-lock-simple-rules' which saves the user from typing `:language` for every query-spec.
> 
> I have not added an announcement in the news file yet.


Sorry for the late response. I agree it’s somewhat tedious. I didn’t came up with a clean solution for it at the time and left it be.

Instead of finding :feature keywords and appending :language keywords after them, maybe we could introduce a secret keyword (say, :default-language or :global-language) to treesit-font-lock-rules, and make treesit-font-lock-simple-rules use that.

We could also just add the :default-language or :global-language keyword to treesit-font-lock-rules. If we do that, we can also add :default-override, too. But adding global keywords doesn’t look super clean to me (and it might be a bit confusing), that’s why I didn’t implement it in the first place.

Yuan


  reply	other threads:[~2023-10-06  7:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 13:32 [PATCH] treesit.el: New function to describe font-lock rules Huan Thieu Nguyen
2023-10-06  7:05 ` Yuan Fu [this message]
     [not found]   ` <1e5cd9da-7be2-486d-bbbb-7b50167e2916@gmail.com>
     [not found]     ` <35F71E15-AEAB-45FD-ACF3-50133A1766D8@gmail.com>
     [not found]       ` <2c196077-a1c7-4bfa-91b6-209ebf21b6fa@gmail.com>
     [not found]         ` <CB77885F-776A-4397-83E6-07835269FE50@gmail.com>
     [not found]           ` <91640cdb-d78a-4bd5-895c-9aacca3d4c97@gmail.com>
     [not found]             ` <E07BF33E-BD63-42F1-8B7E-FF110CE9642E@gmail.com>
     [not found]               ` <CALZcaFhB=oOFcO4arckFCMVbddkPb9xPQRAfUiDZp2_f=qd9fA@mail.gmail.com>
2023-10-21  4:11                 ` Yuan Fu
2023-10-21  7:38                   ` Eli Zaretskii
2023-10-21  8:17                     ` Yuan Fu
2023-10-21 19:49                       ` 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=43D13B5A-A267-4181-893E-506D955E973E@gmail.com \
    --to=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=nguyenthieuhuan@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 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.