* Tree-sitter doc question [not found] <20221208141247.36l2j3bxggslsykl.ref@Ergus> @ 2022-12-08 14:12 ` Ergus 2022-12-08 14:38 ` Eli Zaretskii 0 siblings, 1 reply; 12+ messages in thread From: Ergus @ 2022-12-08 14:12 UTC (permalink / raw) To: emacs-devel Hi list: Just a quick question. I see that the tree-sitter changes are already on master, but I don't find any documentation. Please could you point me where is it or how to use it? I don't know how to do very basic things like: 1) How to check if it is enabled. 2) One enabled (which I think I managed) are the colors in the text from cc-mode or tree-sitter? 3) What are the features available? May I disable cc-mode and rely on a pure tree-sitter experience only? +) Any other recommendation/comment??? Best and thanks in advance, Ergus ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 14:12 ` Tree-sitter doc question Ergus @ 2022-12-08 14:38 ` Eli Zaretskii [not found] ` <20221208145246.3iq7ehnxdii5xgqq@Ergus> 0 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2022-12-08 14:38 UTC (permalink / raw) To: Ergus; +Cc: emacs-devel > Date: Thu, 8 Dec 2022 15:12:47 +0100 > From: Ergus <spacibba@aol.com> > > Just a quick question. I see that the tree-sitter changes are already on > master, but I don't find any documentation. Please could you point me > where is it or how to use it? "No documentation" is not accurate: there's a lot in the ELisp manual. User-level documentation was not yet written, we will do that a bit later. > 1) How to check if it is enabled. The modes that rely on it know how to check that. > 2) One enabled (which I think I managed) are the colors in the text from > cc-mode or tree-sitter? The colors are our faces, so the answer is "neither". > 3) What are the features available? May I disable cc-mode and rely on a > pure tree-sitter experience only? Yes. But be prepared to see some unusual things, because those modes are still WIP. ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20221208145246.3iq7ehnxdii5xgqq@Ergus>]
* Re: Tree-sitter doc question [not found] ` <20221208145246.3iq7ehnxdii5xgqq@Ergus> @ 2022-12-08 14:57 ` Eli Zaretskii 2022-12-08 15:08 ` Felix 0 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2022-12-08 14:57 UTC (permalink / raw) To: Ergus; +Cc: emacs-devel > Date: Thu, 8 Dec 2022 15:52:46 +0100 > From: Ergus <spacibba@aol.com> > > >The modes that rely on it know how to check that. > > > Yes, but as I was trying to use it in C I didn't know if it was actually > working or not as I don't see any change. You need to turn on c-ts-mode manually, it is an opt-in feature (and will probably remain like that in Emacs 29). > >The colors are our faces, so the answer is "neither". > > > I know; maybe I needed to be more specific. As I don't know if it is > working I don't know who was setting the syntax info. The faces are set based on the results of parsing by the tree-sitter library. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 14:57 ` Eli Zaretskii @ 2022-12-08 15:08 ` Felix 2022-12-08 15:44 ` Eli Zaretskii 2022-12-08 17:43 ` Stefan Monnier 0 siblings, 2 replies; 12+ messages in thread From: Felix @ 2022-12-08 15:08 UTC (permalink / raw) To: emacs-devel Eli Zaretskii <eliz@gnu.org> writes: >> Date: Thu, 8 Dec 2022 15:52:46 +0100 >> From: Ergus <spacibba@aol.com> >> >> >The modes that rely on it know how to check that. >> > >> Yes, but as I was trying to use it in C I didn't know if it was actually >> working or not as I don't see any change. > > You need to turn on c-ts-mode manually, it is an opt-in feature (and > will probably remain like that in Emacs 29). > >> >The colors are our faces, so the answer is "neither". >> > >> I know; maybe I needed to be more specific. As I don't know if it is >> working I don't know who was setting the syntax info. > > The faces are set based on the results of parsing by the tree-sitter > library. What would be the recommended way to enable the *-ts-mode for a certain language? Adding a hook to a major-mode to enable another major-mode seems a bit backward. This is what i did first, now i added entries to auto-mode-alist. It would be nice to have an customization variable that controls which major-modes are replaced. For more user feedback, it would be beneficial to have an easy way to enable and try tree-sitter. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 15:08 ` Felix @ 2022-12-08 15:44 ` Eli Zaretskii 2022-12-08 16:05 ` Stefan Kangas 2022-12-08 17:43 ` Stefan Monnier 1 sibling, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2022-12-08 15:44 UTC (permalink / raw) To: Felix; +Cc: emacs-devel > From: Felix <felix.dick@web.de> > Date: Thu, 08 Dec 2022 16:08:39 +0100 > > What would be the recommended way to enable the *-ts-mode for a certain > language? Change auto-mode-alist in your init file. For example: (setq auto-mode-alist (append '(("\\.[ch]\\'" . c-ts-mode)) auto-mode-alist)) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 15:44 ` Eli Zaretskii @ 2022-12-08 16:05 ` Stefan Kangas 2022-12-08 16:24 ` Juanma Barranquero 0 siblings, 1 reply; 12+ messages in thread From: Stefan Kangas @ 2022-12-08 16:05 UTC (permalink / raw) To: Eli Zaretskii, Felix; +Cc: emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > Change auto-mode-alist in your init file. For example: > > (setq auto-mode-alist > (append > '(("\\.[ch]\\'" . c-ts-mode)) > auto-mode-alist)) a.k.a. (add-to-list 'auto-mode-alist ("\\.[ch]\\'" . c-ts-mode)) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 16:05 ` Stefan Kangas @ 2022-12-08 16:24 ` Juanma Barranquero 2022-12-08 16:29 ` Felix 2022-12-08 17:35 ` Eli Zaretskii 0 siblings, 2 replies; 12+ messages in thread From: Juanma Barranquero @ 2022-12-08 16:24 UTC (permalink / raw) To: Stefan Kangas; +Cc: Eli Zaretskii, Felix, emacs-devel [-- Attachment #1: Type: text/plain, Size: 213 bytes --] On Thu, Dec 8, 2022 at 5:06 PM Stefan Kangas <stefankangas@gmail.com> wrote: a.k.a. > > (add-to-list 'auto-mode-alist ("\\.[ch]\\'" . c-ts-mode)) > a.k.a. (push '("\\.[ch]\\'" . c-ts-mode) auto-mode-alist) [-- Attachment #2: Type: text/html, Size: 942 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 16:24 ` Juanma Barranquero @ 2022-12-08 16:29 ` Felix 2022-12-08 17:01 ` [External] : " Drew Adams 2022-12-08 17:39 ` Eli Zaretskii 2022-12-08 17:35 ` Eli Zaretskii 1 sibling, 2 replies; 12+ messages in thread From: Felix @ 2022-12-08 16:29 UTC (permalink / raw) To: Juanma Barranquero; +Cc: Stefan Kangas, Eli Zaretskii, emacs-devel Juanma Barranquero <lekktu@gmail.com> writes: > On Thu, Dec 8, 2022 at 5:06 PM Stefan Kangas <stefankangas@gmail.com> wrote: > > a.k.a. > > (add-to-list 'auto-mode-alist ("\\.[ch]\\'" . c-ts-mode)) > > > a.k.a. > > (push '("\\.[ch]\\'" . c-ts-mode) auto-mode-alist) spoiled for choice, again! ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [External] : Re: Tree-sitter doc question 2022-12-08 16:29 ` Felix @ 2022-12-08 17:01 ` Drew Adams 2022-12-08 17:39 ` Eli Zaretskii 1 sibling, 0 replies; 12+ messages in thread From: Drew Adams @ 2022-12-08 17:01 UTC (permalink / raw) To: Felix, Juanma Barranquero; +Cc: Stefan Kangas, emacs-devel@gnu.org >>> a.k.a. >>> (add-to-list 'auto-mode-alist ("\\.[ch]\\'" . c-ts-mode)) >> a.k.a. >> (push '("\\.[ch]\\'" . c-ts-mode) auto-mode-alist) > > spoiled for choice, again! Yes, but not if the first arg to `add-to-list' is computed instead of just a quoted symbol. (defun foo () (intern (concat "auto-" "mode-alist"))) (add-to-list (foo) ("\\.[ch]\\'" . c-ts-mode)) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 16:29 ` Felix 2022-12-08 17:01 ` [External] : " Drew Adams @ 2022-12-08 17:39 ` Eli Zaretskii 1 sibling, 0 replies; 12+ messages in thread From: Eli Zaretskii @ 2022-12-08 17:39 UTC (permalink / raw) To: Felix; +Cc: lekktu, stefankangas, emacs-devel > From: Felix <felix.dick@web.de> > Cc: Stefan Kangas <stefankangas@gmail.com>, Eli Zaretskii <eliz@gnu.org>, > emacs-devel@gnu.org > Date: Thu, 08 Dec 2022 17:29:52 +0100 > > > Juanma Barranquero <lekktu@gmail.com> writes: > > > On Thu, Dec 8, 2022 at 5:06 PM Stefan Kangas <stefankangas@gmail.com> wrote: > > > > a.k.a. > > > > (add-to-list 'auto-mode-alist ("\\.[ch]\\'" . c-ts-mode)) > > > > > > a.k.a. > > > > (push '("\\.[ch]\\'" . c-ts-mode) auto-mode-alist) > > > spoiled for choice, again! Now you get to decide whom do you listen to. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 16:24 ` Juanma Barranquero 2022-12-08 16:29 ` Felix @ 2022-12-08 17:35 ` Eli Zaretskii 1 sibling, 0 replies; 12+ messages in thread From: Eli Zaretskii @ 2022-12-08 17:35 UTC (permalink / raw) To: Juanma Barranquero; +Cc: stefankangas, felix.dick, emacs-devel > From: Juanma Barranquero <lekktu@gmail.com> > Date: Thu, 8 Dec 2022 17:24:08 +0100 > Cc: Eli Zaretskii <eliz@gnu.org>, Felix <felix.dick@web.de>, emacs-devel@gnu.org > > On Thu, Dec 8, 2022 at 5:06 PM Stefan Kangas <stefankangas@gmail.com> wrote: > > a.k.a. > > (add-to-list 'auto-mode-alist ("\\.[ch]\\'" . c-ts-mode)) > > > a.k.a. > > (push '("\\.[ch]\\'" . c-ts-mode) auto-mode-alist) And then we wonder why newbies on help-gnu-emacs cannot find their way around... ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Tree-sitter doc question 2022-12-08 15:08 ` Felix 2022-12-08 15:44 ` Eli Zaretskii @ 2022-12-08 17:43 ` Stefan Monnier 1 sibling, 0 replies; 12+ messages in thread From: Stefan Monnier @ 2022-12-08 17:43 UTC (permalink / raw) To: Felix; +Cc: emacs-devel > Adding a hook to a major-mode to enable another major-mode seems a bit > backward. This is what i did first, now i added entries to auto-mode-alist. > It would be nice to have an customization variable that controls which > major-modes are replaced. `major-mode-remap-alist`? Stefan ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-12-08 17:43 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20221208141247.36l2j3bxggslsykl.ref@Ergus> 2022-12-08 14:12 ` Tree-sitter doc question Ergus 2022-12-08 14:38 ` Eli Zaretskii [not found] ` <20221208145246.3iq7ehnxdii5xgqq@Ergus> 2022-12-08 14:57 ` Eli Zaretskii 2022-12-08 15:08 ` Felix 2022-12-08 15:44 ` Eli Zaretskii 2022-12-08 16:05 ` Stefan Kangas 2022-12-08 16:24 ` Juanma Barranquero 2022-12-08 16:29 ` Felix 2022-12-08 17:01 ` [External] : " Drew Adams 2022-12-08 17:39 ` Eli Zaretskii 2022-12-08 17:35 ` Eli Zaretskii 2022-12-08 17:43 ` Stefan Monnier
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).