diff --git a/ansible/roles/emacs/files/init.el b/ansible/roles/emacs/files/init.el index b483051..fd75d66 100644 --- a/ansible/roles/emacs/files/init.el +++ b/ansible/roles/emacs/files/init.el @@ -8,7 +8,7 @@ (require 'util-vertico) -;; (require 'lang-python) +(require 'lang-python) ;; (require 'lang-javascript) diff --git a/ansible/roles/emacs/files/lang-python.el b/ansible/roles/emacs/files/lang-python.el index 3162b62..35ca9b7 100644 --- a/ansible/roles/emacs/files/lang-python.el +++ b/ansible/roles/emacs/files/lang-python.el @@ -52,11 +52,11 @@ ) (use-package python - :mode ("\\.py\\'" . python-mode) - :commands python-mode + :mode ("\\.py\\'" . python-ts-mode) + :commands (python-mode python-ts-mode) :pin manual :hook ( - (python-mode . (lambda () + (python-ts-mode . (lambda () (when (executable-find "poetry") (add-poetry-venv-to-path) (let ((venv (locate-venv-poetry))) (when venv @@ -64,14 +64,19 @@ (list (cons ':python (list ':venvPath venv ':pythonPath (concat venv "/bin/python"))))) )) ) - (eglot-ensure) + (when-linux + (eglot-ensure) + ) (add-hook 'before-save-hook 'python-fmt nil 'local) - (tree-sitter-hl-mode +1) )) ) - :bind ((:map python-mode-map ([backspace] . python-backspace)) + :bind ((:map python-ts-mode-map ([backspace] . python-backspace)) ) + :init + (add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode)) + (add-to-list 'treesit-language-source-alist '(python "https://github.com/tree-sitter/tree-sitter-python")) + (unless (treesit-ready-p 'python) (treesit-install-language-grammar 'python)) ) (provide 'lang-python) diff --git a/ansible/roles/emacs/files/lang-rust.el b/ansible/roles/emacs/files/lang-rust.el index 8868fc1..2619383 100644 --- a/ansible/roles/emacs/files/lang-rust.el +++ b/ansible/roles/emacs/files/lang-rust.el @@ -35,9 +35,6 @@ (add-to-list 'eglot-server-programs (cons 'rust-ts-mode (list rust-analyzer-command))) ) ) - (when-linux - (tree-sitter-hl-mode +1) - ) (add-hook 'before-save-hook 'eglot-format-buffer nil 'local) )) ) diff --git a/ansible/roles/emacs/tasks/linux.yaml b/ansible/roles/emacs/tasks/linux.yaml index 7722383..c7a3877 100644 --- a/ansible/roles/emacs/tasks/linux.yaml +++ b/ansible/roles/emacs/tasks/linux.yaml @@ -3,4 +3,5 @@ name: - aspell-en - prettier # typescript+yaml formatting + - pyright state: present