1
0
Fork 0

fix(emacs): configure python-ts-mode

This commit is contained in:
Lucas Sta Maria 2025-09-18 23:29:08 -05:00
parent 8031caaae4
commit 2f13104b81
Signed by: lucas
GPG key ID: F07FB16A826E3B47

View file

@ -132,12 +132,15 @@
("\\.jsx\\'" . tsx-ts-mode)
("\\.json\\'" . json-ts-mode)
("\\.typ\\'" . typst-ts-mode)
("\\.gleam\\'" . gleam-ts-mode))
("\\.gleam\\'" . gleam-ts-mode)
("\\.py\\'" . python-ts-mode))
:hook
((tsx-ts-mode . electric-pair-local-mode)
(tsx-ts-mode . electric-indent-local-mode)
(typescript-ts-mode . electric-pair-local-mode)
(typescript-ts-mode . electric-indent-local-mode))
(typescript-ts-mode . electric-indent-local-mode)
(python-ts-mode . electric-pair-local-mode)
(python-ts-mode . electric-indent-local-mode))
:preface
(defun os/setup-install-grammars ()
"Install Tree-sitter grammars if they are absent."
@ -149,7 +152,8 @@
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "tsx/src"))
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "typescript/src"))
(typst "https://github.com/uben0/tree-sitter-typst")
(gleam "https://github.com/gleam-lang/tree-sitter-gleam")))
(gleam "https://github.com/gleam-lang/tree-sitter-gleam")
(python "https://github.com/tree-sitter/tree-sitter-python")))
(add-to-list 'treesit-language-source-alist grammar)
(unless (treesit-language-available-p (car grammar))
(treesit-install-language-grammar (car grammar)))))
@ -160,7 +164,8 @@
(js2-mode . typescript-ts-mode)
(css-mode . css-ts-mode)
(json-mode . json-ts-mode)
(js-json-mode . json-ts-mode)))
(js-json-mode . json-ts-mode)
(python-mode . python-ts-mode)))
(add-to-list 'major-mode-remap-alist mapping))
:config
(os/setup-install-grammars))