unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Average-user-facing interface for tree-sitter
@ 2022-10-12  6:11 Yuan Fu
  2022-10-13  0:54 ` [SPAM UNSURE] " Stephen Leake
                   ` (2 more replies)
  0 siblings, 3 replies; 63+ messages in thread
From: Yuan Fu @ 2022-10-12  6:11 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1572 bytes --]

From the suggestions I collected from the old thread, here is my proposal:

We define a custom option treesit-settings (we can discuss the name later), which controls whether to enable/disable tree-sitter for each major mode, and the default preference, like this:

(defcustom treesit-settings '((t nil nil))
  "Tree-sitter toggles for major modes.

A list of (MODE ENABLE INHERIT).  MODE is a major mode, ENABLE
can be one of the following:

  demand => Demand the use of tree-sitter, warn if can't enable.
  t => Enable if available
  nil => Don't enable

If INHERIT is nil, the setting does't apply to derived modes of
MODE, if t, the setting does apply.

If MODE is t, the settings applies to all the modes which don't
have any setting.  INHERIT doesn't matter for this special
default setting."
  :type …)

I added the INHERIT flag because I had bad experience trying to enable eglot for python-mode but not for sage-mode, which derives from python-mode.

Then a major mode can just use (treesit-enable-p ‘python-mode ‘python) to check whether to use tree-sitter, this function checks that:
- tree-sitter is built with Emacs
- buffer size is within limit
- language definition is available
- tree-sitter is enabled for this mode according to treesit-settings

This function raises warnings w/ explanation if the user sets ‘demand for the mode and we can’t enable tree-sitter.

I attached a screenshot of treesit-settings in (my) Customize. This should be easy to use and understand for any average user (right?)

Yuan



[-- Attachment #2.1: Type: text/html, Size: 2595 bytes --]

[-- Attachment #2.2: Screen Shot 2022-10-11 at 11.00.40 PM.png --]
[-- Type: image/png, Size: 63217 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread
* Re: Average-user-facing interface for tree-sitter
@ 2022-10-15  9:49 Payas Relekar
  2022-10-16 11:03 ` Katevan Lomidze
  0 siblings, 1 reply; 63+ messages in thread
From: Payas Relekar @ 2022-10-15  9:49 UTC (permalink / raw)
  To: emacs-devel

Ketevan Lomidze <catevan@skiff.com> writes:

> Are you guys aware that tree-sitter is developed by one person who is now in a
> company to develop their own commercial text editor? Is it wise to depend on
> such external projects and to neglect your own major modes?

Isn't that guaranteed to keep the person employed and tree-sitter
development ongoing since their new product depends on it?

Besides, tree-sitter the technology has been *very* widely adopted.
Besides NeoVim integration, it is already used by Github for code
highlight and quite a few LSP servers also wrap it for parsing the file
for font lock etc.

It has become very much de-facto standard in its own niche and with such
a level of adoption, I would not worry about it being abandoned.

--



^ permalink raw reply	[flat|nested] 63+ messages in thread
* Re: Average-user-facing interface for tree-sitter
@ 2022-10-15 13:03 Ketevan Lomidze
  0 siblings, 0 replies; 63+ messages in thread
From: Ketevan Lomidze @ 2022-10-15 13:03 UTC (permalink / raw)
  To: dick; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Hello,	I didn't mean to offend, it is only natural to expect recognition/compensation for your hard work.	I thought if Emacs major modes primarily depend on tree-sitter and it later gets abandoned in favor of a closed fork, this could cause you some unexpected maintenance burden.		On Sat, 15 Oct 2022 12:16:32 GMT, dickdick.r.chiang@gmail.com wrote:Most of us here accept remuneration from commercial enterprise.I know this comes as an unpleasant surprise. Not everyone has a trust fund.	

[-- Attachment #2: Type: text/html, Size: 666 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread

end of thread, other threads:[~2022-10-28  8:02 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-12  6:11 Average-user-facing interface for tree-sitter Yuan Fu
2022-10-13  0:54 ` [SPAM UNSURE] " Stephen Leake
2022-10-13  6:32   ` Stephen Leake
2022-10-13  6:22 ` Lars Ingebrigtsen
2022-10-13  9:18   ` Robert Pluim
2022-10-13  9:21     ` Lars Ingebrigtsen
2022-10-13  9:32     ` Po Lu
2022-10-13  9:42       ` Robert Pluim
2022-10-13 12:31         ` Stefan Kangas
2022-10-13  9:57     ` Daniel Martín
2022-10-13 10:01     ` [SPAM UNSURE] " Stephen Leake
2022-10-13 14:32   ` Jostein Kjønigsen
2022-10-13 16:14     ` Eli Zaretskii
2022-10-13 17:27     ` Lars Ingebrigtsen
2022-10-13 19:44   ` Yuan Fu
2022-10-14 11:02     ` Lars Ingebrigtsen
2022-10-14 11:22       ` Stephen Leake
2022-10-14 20:10         ` Yuan Fu
2022-10-14 20:19       ` Yuan Fu
2022-10-14 20:49     ` Stefan Monnier
2022-10-14 22:51       ` Yuan Fu
2022-10-15  3:26         ` Stefan Monnier
2022-10-15  5:05           ` Yuan Fu
2022-10-17  9:07             ` Yuan Fu
2022-10-17  9:15               ` Lars Ingebrigtsen
2022-10-18 20:54                 ` Yuan Fu
2022-10-18 21:48                   ` Stefan Monnier
2022-10-18 22:06                     ` Yuan Fu
2022-10-18 22:31                       ` Stefan Monnier
2022-10-18 23:06                         ` Yuan Fu
2022-10-19  2:52                           ` Stefan Monnier
2022-10-19  3:48                             ` [External] : " Drew Adams
2022-10-20  0:23                             ` Yuan Fu
2022-10-19  5:35                           ` Theodor Thornhill
2022-10-20  0:28                             ` Yuan Fu
2022-10-20  7:44                               ` Theodor Thornhill
2022-10-20 17:53                                 ` Stefan Monnier
2022-10-20 18:10                                   ` Theodor Thornhill
2022-10-20 18:11                                     ` Theodor Thornhill
2022-10-20 23:06                                     ` Yuan Fu
2022-10-21 22:10                                       ` Yuan Fu
2022-10-21 22:35                                         ` Stefan Monnier
2022-10-23  1:59                                           ` Fu Yuan
2022-10-23  4:59                                             ` Theodor Thornhill
2022-10-24 12:57                                             ` Stefan Monnier
2022-10-24 17:14                                               ` Stephen Leake
2022-10-24 21:07                                                 ` Stefan Monnier
2022-10-24 20:51                                               ` Yuan Fu
2022-10-24 23:55                                                 ` Stefan Monnier
2022-10-25 21:37                                                   ` Yuan Fu
2022-10-25 22:49                                                     ` Stefan Monnier
2022-10-27  1:56                                                       ` Yuan Fu
2022-10-27 15:21                                                         ` Stefan Monnier
2022-10-27 15:29                                                           ` Dmitry Gutov
2022-10-28  8:02                                                             ` Yuan Fu
2022-10-24 16:46                                             ` Stephen Leake
2022-10-18 20:49             ` Stefan Monnier
2022-10-18 20:58               ` Yuan Fu
2022-10-13 13:05 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2022-10-15  9:49 Payas Relekar
2022-10-16 11:03 ` Katevan Lomidze
2022-10-16 11:43   ` Eli Zaretskii
2022-10-15 13:03 Ketevan Lomidze

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).