From: "Jostein Kjønigsen" <jostein@secure.kjonigsen.net>
To: "Ergus via Emacs development discussions." <emacs-devel@gnu.org>,
Yuan Fu <casouri@gmail.com>
Subject: Detecting tree-sitter based major-modes for end-user customization and third party functions/packages
Date: Tue, 20 Dec 2022 12:35:57 +0100 [thread overview]
Message-ID: <6c5b1d81-b6ce-bc87-f58e-c950b57fd20b@secure.kjonigsen.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]
Hey everyone.
This may or may not have been answered in an earlier thread about the
subject, but I couldn't really find it, so if this email and question
represents a duplicate: sorry in advance.
With that said, I'll get straight down to business.
While as a major-mode author, I can decide to use tree-sitter to
implement key functionality, we don't expect end-users to (need to) have
the same level awareness about the technology used to implement the
modes they are consuming.
However end-users often want to customize Emacs based on major-mode
agnostic properties of the current major-mode none the less. Examples
are adding hooks for prog-mode, c-mode-common-mode (from cc-mode), etc.
This may also apply to other third-party packages, in how they interact
with buffers (if prog-mode do this, if text-mode do that, etc).
I expect these kinda of needs to arise for tree-sitter based major-modes
sooner rather than later, where one may be able to leverage tree-sitter
node-manipulation functions rather than use text-based equivalents.
But to be able to leverage tree-sitter based functions, one would first
need to know that one is interacting with a tree-sitter based
major-mode. And to customize one, one would need a hook.
So how do we plan to expose this to end-users and other developers?
Looking at (treesit-major-mode-setup), I can't see it leaving any traces
to be reliably detected later. Should we add some (documented)
buffer-local variables to be able to detect this later? Should we create
a mostly empty minor-mode for easy detection and ability to add hooks?
Or does anyone have any other suggestions for how we can solve this
user-facing need of tree-sitter?
--
Kind regards
*Jostein Kjønigsen*
jostein.kjønigsen.no <https://jostein.kjønigsen.no>
jostein@kjonigsen.net - jostein@gmail.com
[-- Attachment #2: Type: text/html, Size: 2523 bytes --]
next reply other threads:[~2022-12-20 11:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 11:35 Jostein Kjønigsen [this message]
2022-12-20 14:21 ` Detecting tree-sitter based major-modes for end-user customization and third party functions/packages Eli Zaretskii
2022-12-20 15:38 ` Stefan Monnier
2022-12-20 19:44 ` Jostein Kjønigsen
2022-12-20 20:03 ` Stefan Monnier
2022-12-20 20:14 ` Jostein Kjønigsen
2022-12-20 20:21 ` Stefan Monnier
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=6c5b1d81-b6ce-bc87-f58e-c950b57fd20b@secure.kjonigsen.net \
--to=jostein@secure.kjonigsen.net \
--cc=casouri@gmail.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).