all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Noah Peart <noah.v.peart@gmail.com>
Cc: 70361@debbugs.gnu.org, eliz@gnu.org
Subject: bug#70361: [PATCH] Add font-locking for operators in go-ts-mode.
Date: Mon, 15 Apr 2024 22:57:43 -0700	[thread overview]
Message-ID: <AC377FCE-E45A-4998-8D89-701E592C87E8@gmail.com> (raw)
In-Reply-To: <CAPVBTScmTQ_jXt483miDqyRsivrLWtXU9g7gztFP=aZO5XHrBQ@mail.gmail.com>


Noah Peart <noah.v.peart@gmail.com> writes:

> Thankyou, this all makes sense.  I do think it would be nice if it was easier to somehow 
> add user customizations to the font-locking, especially since it is so easy to write tree-sitter
> font-locking rules.

Right. We (well, I) were focusing on support for writing major modes and
didn’t give enough attention to the customization aspect, especially for
beginners.

>> We just don’t want a central tree-sitter-font-lock-feature-list that controls
> the feature list of every major mode in a single place.
>
> What would you think of something like a `user` feature that could be enabled
> globally and users could add their mode-specific rules there? Eg.
>
>     (defvar my-treesit-font-lock-rules
>       (treesit-font-lock-rules
>        :language 'go
>        :feature 'user
>        '((identifier))
>
>        :language 'typescript
>        :feature 'user
>        '((identifier))
>        ;; ...
>        ))
>
> This wouldn't work very well in certain cases where ordering of the rules
> was important, however.

I think that’s a good start. I like that it’s tied to each language
rather than a major mode, so it avoids problems with derived major
modes.

Indentation can also use some easy customization options.

On a separate note, something like this might be better off in a ELPA
package, such that it has more freedom to evolve and break things.
Things that are added to Emacs core tend to fossilize, or at least
become very hard to change. (To be precise, I mean the interface tend to
be hard to change, implementation details can and do change all the
time.)

I’d say that order wouldn’t be a problem since I imagine most of
tht time, the user wants their fontification override all else.

Yuan





  parent reply	other threads:[~2024-04-16  5:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13  5:23 bug#70361: [PATCH] Add font-locking for operators in go-ts-mode Noah Peart
2024-04-13  7:20 ` Eli Zaretskii
2024-04-13  7:27   ` Noah Peart
2024-04-13  7:32     ` Noah Peart
2024-04-13  7:40       ` Eli Zaretskii
2024-04-13  7:53         ` Noah Peart
2024-04-13  9:33           ` Eli Zaretskii
2024-04-14 23:25 ` Yuan Fu
2024-04-14 23:34 ` Yuan Fu
2024-04-15 12:05   ` Noah Peart
2024-04-16  1:49 ` Randy Taylor
2024-04-16  5:57 ` Yuan Fu [this message]
2024-04-16  5:58 ` Yuan Fu
2024-04-16 12:34   ` Eli Zaretskii
2024-04-17  2:47 ` 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=AC377FCE-E45A-4998-8D89-701E592C87E8@gmail.com \
    --to=casouri@gmail.com \
    --cc=70361@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=noah.v.peart@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.