unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill <theo@thornhill.no>
To: Yuan Fu <casouri@gmail.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Tree-sitter indentation for js-mode & cc-mode
Date: Thu, 27 Oct 2022 11:28:33 +0200	[thread overview]
Message-ID: <87h6zpsji6.fsf@thornhill.no> (raw)
In-Reply-To: <87k04lljh6.fsf@thornhill.no>

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

Theodor Thornhill <theo@thornhill.no> writes:

BTW, I fixed ts-mode.  See attached patch :-)

Thanks,
Theo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Ensure-we-have-a-treesit-parser-in-mode-init.patch --]
[-- Type: text/x-diff, Size: 863 bytes --]

From f1d9d6f004b16885efd127fa074537028a3805f8 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
Date: Thu, 27 Oct 2022 11:26:44 +0200
Subject: [PATCH] Ensure we have a treesit-parser in mode init

* lisp/progmodes/ts-mode.el (ts-mode): Create a parser.
---
 lisp/progmodes/ts-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/ts-mode.el b/lisp/progmodes/ts-mode.el
index 28800e378a..61235608c6 100644
--- a/lisp/progmodes/ts-mode.el
+++ b/lisp/progmodes/ts-mode.el
@@ -261,8 +261,8 @@ ts-mode
   :syntax-table ts-mode--syntax-table
 
   (cond
-   ((treesit-ready-p nil 'tsx)
-    ;; Tree-sitter.
+   ((treesit-ready-p 'ts-mode 'tsx)
+    (treesit-parser-create 'tsx)
     ;; Comments.
     (setq-local comment-start "// ")
     (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
-- 
2.34.1


  reply	other threads:[~2022-10-27  9:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27  1:43 Tree-sitter indentation for js-mode & cc-mode Yuan Fu
2022-10-27  9:11 ` Theodor Thornhill
2022-10-27  9:28   ` Theodor Thornhill [this message]
2022-10-27  9:58     ` Theodor Thornhill
2022-10-27 15:21   ` Yuan Fu
2022-10-27 18:36     ` Theodor Thornhill
2022-10-28  8:15       ` Yuan Fu
2022-10-28  8:59         ` Theodor Thornhill
2022-10-28  9:10         ` Theodor Thornhill
2022-10-28 19:43           ` Yuan Fu
2022-10-28 19:49             ` Theodor Thornhill
2022-10-29  1:05               ` Yuan Fu
2022-10-29  5:53             ` Eli Zaretskii
2022-10-29  6:54               ` 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

  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=87h6zpsji6.fsf@thornhill.no \
    --to=theo@thornhill.no \
    --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).