Update python for emacs29.

This commit is contained in:
Tom Alexander 2023-05-27 13:41:08 -04:00
parent 1bed94b1b1
commit cd02a14792
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 13 additions and 10 deletions

View File

@ -8,7 +8,7 @@
(require 'util-vertico) (require 'util-vertico)
;; (require 'lang-python) (require 'lang-python)
;; (require 'lang-javascript) ;; (require 'lang-javascript)

View File

@ -52,11 +52,11 @@
) )
(use-package python (use-package python
:mode ("\\.py\\'" . python-mode) :mode ("\\.py\\'" . python-ts-mode)
:commands python-mode :commands (python-mode python-ts-mode)
:pin manual :pin manual
:hook ( :hook (
(python-mode . (lambda () (python-ts-mode . (lambda ()
(when (executable-find "poetry") (when (executable-find "poetry")
(add-poetry-venv-to-path) (add-poetry-venv-to-path)
(let ((venv (locate-venv-poetry))) (when venv (let ((venv (locate-venv-poetry))) (when venv
@ -64,14 +64,19 @@
(list (cons ':python (list ':venvPath venv ':pythonPath (concat venv "/bin/python"))))) (list (cons ':python (list ':venvPath venv ':pythonPath (concat venv "/bin/python")))))
)) ))
) )
(when-linux
(eglot-ensure) (eglot-ensure)
)
(add-hook 'before-save-hook 'python-fmt nil 'local) (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) (provide 'lang-python)

View File

@ -35,9 +35,6 @@
(add-to-list 'eglot-server-programs (cons 'rust-ts-mode (list rust-analyzer-command))) (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) (add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
)) ))
) )

View File

@ -3,4 +3,5 @@
name: name:
- aspell-en - aspell-en
- prettier # typescript+yaml formatting - prettier # typescript+yaml formatting
- pyright
state: present state: present