Factor out Go setup into its own section

This commit is contained in:
Gerard Vermeulen 2023-05-15 14:05:56 +02:00
parent 428cc23449
commit c65b8834ba
1 changed files with 15 additions and 9 deletions

View File

@ -376,8 +376,6 @@ the contents of packages and allows to update packages to the latest version.
#+begin_src emacs-lisp -n :results silent
(when (require 'treesit nil 'noerror)
(setopt
;; Set `tab-width' in `after-change-major-mode-hook' function too.
go-ts-mode-indent-offset 2
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")
@ -407,13 +405,7 @@ the contents of packages and allows to update packages to the latest version.
"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")))
(add-hook 'after-change-major-mode-hook
(defun on-go-ts-mode-hook ()
(when (derived-mode-p 'go-ts-mode 'go-mod-ts-mode)
(setq-local tab-width 2))))
(add-to-list 'auto-mode-alist `(,(rx ".go" eos) . go-ts-mode)))
(yaml "https://github.com/ikatyang/tree-sitter-yaml" "master" "src"))))
#+end_src
* [[info:emacs#Faces][Text faces or styles (info)]]
@ -4667,6 +4659,20 @@ byte code:
1. [[https://gobyexample.com/][Go by example]]
#+caption[Setup Go programming]:
#+caption: Setup Go programming.
#+name: lst:setup-go
#+begin_src emacs-lisp -n
(when (featurep 'treesit)
;; Set `tab-width' in `after-change-major-mode-hook' function too.
(setopt go-ts-mode-indent-offset 2)
(add-hook 'after-change-major-mode-hook
(defun on-go-ts-mode-hook ()
(when (derived-mode-p 'go-ts-mode 'go-mod-ts-mode)
(setq-local tab-width 2))))
(add-to-list 'auto-mode-alist `(,(rx ".go" eos) . go-ts-mode)))
#+end_src
** [[info:maxima#Top][Maxima Programming (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:maxima-programming