From: Yuan Fu Date: Sat, 26 Nov 2022 23:32:57 +0000 (-0800) Subject: Make typescript-ts-mode not fallback to js-mode X-Git-Tag: emacs-29.0.90~1467 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a3d8da24762bc7ecc5bad9275ecc0a6d5f3ac7c3;p=emacs.git Make typescript-ts-mode not fallback to js-mode 1. js-mode might not be able to handle typescript file 2. Now that we use separate modes for tree-sitter modes, not falling back makes tree-sitter modes more consistent * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Remove the fallback code. --- diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index c7b332c6149..8a9d540bd3c 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -289,11 +289,7 @@ :group 'typescript :syntax-table typescript-ts-mode--syntax-table - (cond - ;; `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. + (when (treesit-ready-p 'tsx) (treesit-parser-create 'tsx) ;; Comments. @@ -330,12 +326,8 @@ ;; Which-func (use imenu). (setq-local which-func-functions nil) - (treesit-major-mode-setup)) + (treesit-major-mode-setup))) - ;; Elisp. - (t - (js-mode) - (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'")))) (provide 'typescript-ts-mode)