Map python-mode' to python-ts-mode' and minor editing

This commit is contained in:
Gerard Vermeulen 2024-06-28 14:12:54 +02:00
parent 8bcb202f1c
commit 4a3c5d45d8

View File

@ -372,16 +372,16 @@ version.
Mickey Peterson's post [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter?utm_source=newsletter&utm_medium=rss][How To Get Started with Tree-Sitter]] explains how to use
=tree-sitter= in Emacs-29.1. Listing [[lst:setup-treesit-sources][Setup =treesit= grammar sources]] configures
where to find the different =tree-sitter= grammar sources for different
languages. Listing [[lst:setup-go][Setup Go programming]] shows how to configure ~tab-width~ for
~go-ts-mod~ and ~go-mode-ts-mode~.
for different =tree-sitter= grammar sources and maps =python-mode= to
=python-ts-mode=. Listing [[lst:setup-go][Setup Go programming]] shows how to configure
~tab-width~ for ~go-ts-mod~ and ~go-mode-ts-mode~.
#+caption[Setup =treesit= grammar sources]:
#+caption: Setup =treesit= grammar sources.
#+name: lst:setup-treesit-sources
#+begin_src emacs-lisp -n :results silent
(when (require 'treesit nil 'noerror)
(setopt
(when (treesit-available-p)
(defvar
treesit-language-source-alist
'((bash "https://github.com/tree-sitter/tree-sitter-bash" "master" "src")
(c "https://github.com/tree-sitter/tree-sitter-c" "master" "src")
@ -389,7 +389,7 @@ languages. Listing [[lst:setup-go][Setup Go programming]] shows how to configur
(cpp "https://github.com/tree-sitter/tree-sitter-cpp" "master" "src")
(css "https://github.com/tree-sitter/tree-sitter-css" "master" "src")
(glsl "https://github.com/theHamsta/tree-sitter-glsl" "master" "src")
;; go-ts-mode requires libtree-sitter-go and libtree-sitter-gomode.
;; go-ts-mode requires libtree-sitter-go and libtree-sitter-gomod.
(go "https://github.com/tree-sitter/tree-sitter-go" "master" "src")
(gomod "https://github.com/camdencheek/tree-sitter-go-mod" "main" "src")
(html "https://github.com/tree-sitter/tree-sitter-html" "master" "src")
@ -412,7 +412,10 @@ languages. Listing [[lst:setup-go][Setup Go programming]] shows how to configur
"master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript"
"master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml" "master" "src"))))
(yaml "https://github.com/ikatyang/tree-sitter-yaml" "master" "src")))
;; GAV: Building a grammar may fix no or poor `treesit' fontification.
(setopt major-mode-remap-alist '((python-mode . python-ts-mode))))
#+end_src
* [[info:emacs#Faces][Text faces or styles (info)]]