Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f5cc59df authored by AGULLO Emmanuel's avatar AGULLO Emmanuel
Browse files

Add tree-sitter support for more languages (CMake, rust, ...)

parent bcea7304
No related branches found
No related tags found
No related merge requests found
;;; elementaryx-full.el --- Further packaging of emacs elementaryx starter kit for HPC development and literate programming -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Emmanuel Agullo
;; Copyright (C) 2023, 2024 Emmanuel Agullo
;; Author: Emmanuel Agullo <eagullo@tek11>
;; Keywords: emacs emacs-elementaryx emacs-starter-kit ide hpc
(use-package elementaryx-dev-minimal)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Built-in config for developers
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package emacs
:config
;; Treesitter config
;; Tell Emacs to prefer the treesitter mode
(setq major-mode-remap-alist
'(
;; (yaml-mode . yaml-ts-mode)
(bash-mode . bash-ts-mode)
;; (js2-mode . js-ts-mode)
;; (typescript-mode . typescript-ts-mode) ;; No need for json-mode, we got with ts
;; (json-mode . json-ts-mode) ;; No Need for json-mode, we go with ts
(css-mode . css-ts-mode)
(python-mode . python-ts-mode)))
:hook
;; Auto parenthesis matching
((prog-mode . electric-pair-mode)))
(use-package emacs
:config
;; Treesitter config: remap classical mode to ts-mode
(add-to-list 'major-mode-remap-alist '(bash-mode . bash-ts-mode))
(add-to-list 'major-mode-remap-alist '(bibtex-mode . bibtex-ts-mode))
(add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
(add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode))
(add-to-list 'major-mode-remap-alist
'(c-or-c++-mode . c-or-c++-ts-mode))
;; (add-to-list 'major-mode-remap-alist '(cmake-mode . cmake-ts-mode))
;; (add-to-list 'major-mode-remap-alist '(julia-mode . julia-ts-mode))
(add-to-list 'major-mode-remap-alist ' (python-mode . python-ts-mode)))
;; (add-to-list 'major-mode-remap-alist '(html-mode . html-ts-mode))
(add-to-list 'major-mode-remap-alist '(java-mode . java-ts-mode))
(add-to-list 'major-mode-remap-alist '(javascript-mode . js-ts-mode))
(add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode)) ;;
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
;; Treesitter config: directly map to ts-mode
(add-to-list 'auto-mode-alist '("CMakeLists\\.txt\\'" . cmake-ts-mode))
(add-to-list 'auto-mode-alist '("\\.cmake\\'" . cmake-ts-mode))
(add-to-list 'auto-mode-alist '("\\Dockerfile\\'" . dockerfile-ts-mode))
;; (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-ts-mode)) ;; TODO: inverstigate bug
;; (add-to-list 'auto-mode-alist '("\\.lhs\\'" . haskell-ts-mode)) ;; TODO: inverstigate bug
;; (add-to-list 'auto-mode-alist '("\\.jl\\'" . julia-ts-mode)) ;; TODO: inverstigate bug
(add-to-list 'auto-mode-alist '("\\.json\\'" . json-ts-mode))
;; (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode)) ;; TODO: inverstigate bug
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-ts-mode)) ;; TODO: inverstigate bug
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-ts-mode)) ;; TODO: inverstigate bug
;; (add-to-list 'auto-mode-alist '("\\.php\\'" . php-ts-mode)) ;; TODO: inverstigate bug
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-ts-mode))
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
;; (add-to-list 'auto-mode-alist '("\\.ml\\'" . ml-ts-mode)) ;; TODO: not sure how to set it up with tree-sitter-ocaml
;; (add-to-list 'auto-mode-alist '("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-ts-mode)) ;; https://issues.guix.gnu.org/66836
)
;; https://github.com/emacsmirror/rmsbolt
(use-package rmsbolt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment