Tidy `treesit' setup

This commit is contained in:
Gerard Vermeulen 2023-01-20 20:13:31 +01:00
parent d828941025
commit ddcce0abff
2 changed files with 24 additions and 9 deletions

1
.gitignore vendored
View File

@ -30,4 +30,5 @@ worg-backend-dependent-execution-update.org
/eln-cache /eln-cache
/elpa /elpa
/quelpa /quelpa
/tree-sitter
/var /var

View File

@ -369,15 +369,29 @@ the contents of packages and allows to update packages to the latest version.
#+name: lst:setup-emacs-tree-sitter #+name: lst:setup-emacs-tree-sitter
#+begin_src emacs-lisp #+begin_src emacs-lisp
(when (require 'treesit nil 'noerror) (when (require 'treesit nil 'noerror)
;; https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01372.html (setopt
(let ((tselp (expand-file-name "~/VCS/tree-sitter-module/dist/"))) treesit-language-source-alist
(when (file-exists-p tselp) '((bash "https://github.com/tree-sitter/tree-sitter-bash" "master" "src")
(add-to-list 'treesit-extra-load-path tselp) (c "https://github.com/tree-sitter/tree-sitter-c" "master" "src")
;; Does not play nicely with eglot: (cpp "https://github.com/tree-sitter/tree-sitter-cpp" "master" "src")
;; (setq major-mode-remap-alist '((python-mode . python-ts-mode))) (css "https://github.com/tree-sitter/tree-sitter-css" "master" "src")
;; Plays nicely with eglot: (go "https://github.com/tree-sitter/tree-sitter-go" "master" "src")
(add-to-list 'auto-mode-alist (java "https://github.com/tree-sitter/tree-sitter-java" "master" "src")
`(,(rx ".py" (opt (any "iw")) eos) . python-ts-mode))))) (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
(json "https://github.com/tree-sitter/tree-sitter-json" "master" "src")
(julia "https://github.com/tree-sitter/tree-sitter-julia" "master" "src")
(python "https://github.com/tree-sitter/tree-sitter-python" "master" "src")
(ruby "https://github.com/tree-sitter/tree-sitter-ruby" "master" "src")
(rust "https://github.com/tree-sitter/tree-sitter-rust" "master" "src")
(scala "https://github.com/tree-sitter/tree-sitter-scala" "master" "src")
(toml "https://github.com/tree-sitter/tree-sitter-toml" "master" "src")
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master"
"tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master"
"typescript/src")))
(add-to-list 'auto-mode-alist
`(,(rx ".py" (opt (any "iw")) eos) . python-ts-mode)))
#+end_src #+end_src
* [[info:emacs#Faces][Text faces or styles (info)]] * [[info:emacs#Faces][Text faces or styles (info)]]