all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Emacs development discussions." <emacs-devel@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org, mardani29@yahoo.es, raman@google.com,
	casouri@gmail.com, tsdh@gnu.org
Subject: Re: Rename Tree-sitter major modes from "ts" to "treesit" (was Re: tree-sitter version?)
Date: Fri, 25 Nov 2022 21:13:43 +0100	[thread overview]
Message-ID: <877czin66g.fsf@thornhill.no> (raw)
In-Reply-To: <87tu2m6c20.fsf@thornhill.no>

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


Hi Eli,

>
>>> Date: Fri, 25 Nov 2022 17:38:27 +0100
>>> From: Theodor Thornhill <theo@thornhill.no>
>>> CC: casouri@gmail.com, tsdh@gnu.org
>>> 
>>> I'd rather change ts-mode to typescript-mode or typescript-ts-mode.
>>
>> If there was no ts-mode before, I'm okay with renaming it to
>> typescript-ts-mode.
>
> Ok, patch coming up

Feel free to commit this, Eli.  I've only done a rename.

Theo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Rename-ts-mode-to-typescript-ts-mode.patch --]
[-- Type: text/x-diff, Size: 9129 bytes --]

From 5a8d0347ad4e3373ef849d9b818459121061b593 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
Date: Fri, 25 Nov 2022 21:04:18 +0100
Subject: [PATCH] Rename ts-mode to typescript-ts-mode

* lisp/progmodes/ts-mode.el: File deleted.
* lisp/progmodes/typescript-ts-mode.el: New mode typescript-ts-mode.
* etc/NEWS: Mention the new mode.
---
 etc/NEWS                                      |  2 +-
 .../{ts-mode.el => typescript-ts-mode.el}     | 78 +++++++++----------
 2 files changed, 40 insertions(+), 40 deletions(-)
 rename lisp/progmodes/{ts-mode.el => typescript-ts-mode.el} (77%)

diff --git a/etc/NEWS b/etc/NEWS
index 0ffc849fec..3c9243784d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2969,7 +2969,7 @@ This is a lightweight variant of 'js-mode' that is used by default
 when visiting JSON files.
 
 \f
-** New mode 'ts-mode'.
+** New mode 'typescript-ts-mode'.
 A major mode based on the tree-sitter library for editing programs
 in the TypeScript language.  It includes support for font-locking,
 indentation, and navigation.
diff --git a/lisp/progmodes/ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
similarity index 77%
rename from lisp/progmodes/ts-mode.el
rename to lisp/progmodes/typescript-ts-mode.el
index bdef1c4576..763686bf66 100644
--- a/lisp/progmodes/ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -1,4 +1,4 @@
-;;; ts-mode.el --- tree sitter support for TypeScript  -*- lexical-binding: t; -*-
+;;; typescript-ts-mode.el --- tree sitter support for TypeScript  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
 
@@ -30,14 +30,14 @@
 
 (declare-function treesit-parser-create "treesit.c")
 
-(defcustom ts-mode-indent-offset 2
-  "Number of spaces for each indentation step in `ts-mode'."
+(defcustom typescript-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `typescript-ts-mode'."
   :version "29.1"
   :type 'integer
   :safe 'integerp
   :group 'typescript)
 
-(defvar ts-mode--syntax-table
+(defvar typescript-ts-mode--syntax-table
   (let ((table (make-syntax-table)))
     ;; Taken from the cc-langs version
     (modify-syntax-entry ?_  "_"     table)
@@ -54,9 +54,9 @@ ts-mode--syntax-table
     (modify-syntax-entry ?` "\""     table)
     (modify-syntax-entry ?\240 "."   table)
     table)
-  "Syntax table for `ts-mode'.")
+  "Syntax table for `typescript-ts-mode'.")
 
-(defvar ts-mode--indent-rules
+(defvar typescript-ts-mode--indent-rules
   `((tsx
      ((parent-is "program") parent-bol 0)
      ((node-is "}") parent-bol 0)
@@ -65,33 +65,33 @@ ts-mode--indent-rules
      ((node-is ">") parent-bol 0)
      ((and (parent-is "comment") comment-end) comment-start -1)
      ((parent-is "comment") comment-start-skip 0)
-     ((parent-is "ternary_expression") parent-bol ts-mode-indent-offset)
-     ((parent-is "member_expression") parent-bol ts-mode-indent-offset)
-     ((parent-is "named_imports") parent-bol ts-mode-indent-offset)
-     ((parent-is "statement_block") parent-bol ts-mode-indent-offset)
-     ((parent-is "type_arguments") parent-bol ts-mode-indent-offset)
-     ((parent-is "variable_declarator") parent-bol ts-mode-indent-offset)
-     ((parent-is "arguments") parent-bol ts-mode-indent-offset)
-     ((parent-is "array") parent-bol ts-mode-indent-offset)
-     ((parent-is "formal_parameters") parent-bol ts-mode-indent-offset)
-     ((parent-is "template_substitution") parent-bol ts-mode-indent-offset)
-     ((parent-is "object_pattern") parent-bol ts-mode-indent-offset)
-     ((parent-is "object") parent-bol ts-mode-indent-offset)
-     ((parent-is "object_type") parent-bol ts-mode-indent-offset)
-     ((parent-is "enum_body") parent-bol ts-mode-indent-offset)
-     ((parent-is "arrow_function") parent-bol ts-mode-indent-offset)
-     ((parent-is "parenthesized_expression") parent-bol ts-mode-indent-offset)
+     ((parent-is "ternary_expression") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "variable_declarator") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "array") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "formal_parameters") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "template_substitution") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "object_pattern") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "object") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "object_type") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "enum_body") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset)
 
      ;; TSX
-     ((parent-is "jsx_opening_element") parent ts-mode-indent-offset)
+     ((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset)
      ((node-is "jsx_closing_element") parent 0)
-     ((parent-is "jsx_element") parent ts-mode-indent-offset)
+     ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)
      ((node-is "/") parent 0)
-     ((parent-is "jsx_self_closing_element") parent ts-mode-indent-offset)
+     ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset)
      (no-node parent-bol 0)))
   "Tree-sitter indent rules.")
 
-(defvar ts-mode--keywords
+(defvar typescript-ts-mode--keywords
   '("!" "abstract" "as" "async" "await" "break"
     "case" "catch" "class" "const" "continue" "debugger"
     "declare" "default" "delete" "do" "else" "enum"
@@ -103,14 +103,14 @@ ts-mode--keywords
     "while" "with" "yield")
   "TypeScript keywords for tree-sitter font-locking.")
 
-(defvar ts-mode--operators
+(defvar typescript-ts-mode--operators
   '("=" "+=" "-=" "*=" "/=" "%=" "**=" "<<=" ">>=" ">>>=" "&=" "^="
     "|=" "&&=" "||=" "??=" "==" "!=" "===" "!==" ">" ">=" "<" "<=" "+"
     "-" "*" "/" "%" "++" "--" "**" "&" "|" "^" "~" "<<" ">>" ">>>"
     "&&" "||" "!" "?.")
   "TypeScript operators for tree-sitter font-locking.")
 
-(defvar ts-mode--font-lock-settings
+(defvar typescript-ts-mode--font-lock-settings
   (treesit-font-lock-rules
    :language 'tsx
    :override t
@@ -128,7 +128,7 @@ ts-mode--font-lock-settings
    :language 'tsx
    :override t
    :feature 'keyword
-   `([,@ts-mode--keywords] @font-lock-keyword-face
+   `([,@typescript-ts-mode--keywords] @font-lock-keyword-face
      [(this) (super)] @font-lock-keyword-face)
 
    :language 'tsx
@@ -248,7 +248,7 @@ ts-mode--font-lock-settings
 
    :language 'tsx
    :feature 'operator
-   `([,@ts-mode--operators] @font-lock-operator-face
+   `([,@typescript-ts-mode--operators] @font-lock-operator-face
      (ternary_expression ["?" ":"] @font-lock-operator-face))
 
    :language 'tsx
@@ -278,19 +278,19 @@ ts-mode--font-lock-settings
   "Tree-sitter font-lock settings.")
 
 ;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.ts\\'" . ts-mode))
+(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
 
 ;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.tsx\\'" . ts-mode))
+(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode))
 
 ;;;###autoload
-(define-derived-mode ts-mode prog-mode "TypeScript"
+(define-derived-mode typescript-ts-mode prog-mode "TypeScript"
   "Major mode for editing TypeScript."
   :group 'typescript
-  :syntax-table ts-mode--syntax-table
+  :syntax-table typescript-ts-mode--syntax-table
 
   (cond
-   ;; `ts-mode' requires tree-sitter to work, so we don't check if
+   ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if
    ;; user enables tree-sitter for it.
    ((treesit-ready-p 'tsx)
     ;; Tree-sitter.
@@ -308,7 +308,7 @@ ts-mode
                 (append "{}():;," electric-indent-chars))
 
     ;; Indent.
-    (setq-local treesit-simple-indent-rules ts-mode--indent-rules)
+    (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules)
 
     ;; Navigation.
     (setq-local treesit-defun-type-regexp
@@ -318,7 +318,7 @@ ts-mode
                         "lexical_declaration")))
 
     ;; Font-lock.
-    (setq-local treesit-font-lock-settings ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings)
     (setq-local treesit-font-lock-feature-list
                 '((comment declaration)
                   (constant expression identifier keyword number string)
@@ -336,6 +336,6 @@ ts-mode
     (js-mode)
     (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'"))))
 
-(provide 'ts-mode)
+(provide 'typescript-ts-mode)
 
-;;; ts-mode.el ends here
+;;; typescript-ts-mode.el ends here
-- 
2.34.1


  reply	other threads:[~2022-11-25 20:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  1:54 tree-sitter version? T.V Raman
2022-11-24  3:27 ` Yuan Fu
2022-11-24  4:57   ` T.V Raman
2022-11-24  5:02     ` Yuan Fu
2022-11-24  5:54       ` Tassilo Horn
2022-11-25  9:43         ` Yuan Fu
2022-11-25 11:52           ` Eli Zaretskii
2022-11-25 15:08           ` T.V Raman
2022-11-25 16:25             ` Rename Tree-sitter major modes from "ts" to "treesit" (was Re: tree-sitter version?) Daniel Martín
2022-11-25 16:33               ` Eli Zaretskii
2022-11-25 16:38               ` Theodor Thornhill
2022-11-25 17:50                 ` Elliott Shugerman
2022-11-25 23:41                   ` Rudolf Adamkovič
2022-11-25 19:40                 ` Eli Zaretskii
2022-11-25 19:58                   ` Theodor Thornhill
2022-11-25 20:13                     ` Theodor Thornhill via Emacs development discussions. [this message]
2022-11-26  1:04                       ` Stefan Kangas
2022-11-26  6:45                         ` Theodor Thornhill
2022-11-26  8:20               ` Yuan Fu
2022-11-26  8:22                 ` Theodor Thornhill
2022-11-26  8:31                 ` Eli Zaretskii
2022-11-26  9:06                   ` Theodor Thornhill
2022-11-28 21:36             ` tree-sitter version? Richard Stallman
2022-11-29  3:28               ` Eli Zaretskii
2022-12-04 23:13                 ` Richard Stallman
2022-12-05  3:27                   ` Eli Zaretskii
2022-12-06 22:35                     ` Richard Stallman
2022-12-07  3:31                       ` Eli Zaretskii
2022-11-25 15:06         ` T.V Raman
  -- strict thread matches above, loose matches on Subject: below --
2022-11-26  3:22 Rename Tree-sitter major modes from "ts" to "treesit" (was Re: tree-sitter version?) daanturo
2022-11-26  7:43 ` Yuri Khan

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=877czin66g.fsf@thornhill.no \
    --to=emacs-devel@gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=mardani29@yahoo.es \
    --cc=raman@google.com \
    --cc=theo@thornhill.no \
    --cc=tsdh@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 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.