* Major Modes

I use quite a few major modes.  Mostly those using tree-sitter;  Which should
be selected automatically.  As most of these are pretty straight forward I won't
bother with an explanation on each.

#+begin_src emacs-lisp
;; Markdown
(use-package markdown-mode
  :ensure t
  :mode ("\\.md\\'" . gfm-mode)
  :init (setq markdown-command "multimarkdown")
  :bind (:map markdown-mode-map
              ("C-c C-e" . markdown-do)))

(use-package slint-mode
  :defer t
  :config
  (add-to-list 'auto-mode-alist '("\\.slint\\'" . slint-mode)))

(use-package rainbow-mode
  :commands (rainbow-mode))

;; C
(use-feature c-ts-mode
  :custom
  (c-ts-mode-indent-offset 2)
  (c-ts-mode-indent-style 'k&r)
  :config
  (with-eval-after-load 'c-ts-mode
    (setq-local treesit-primary-parser 'c)))

;; Clojure
(use-package clojure-mode
  :ensure t
  :after (rainbow-mode)
  :hook
  (clojure-mode . cider-mode)
  (clojure-mode . (lambda () (setq-local lsp-semantic-tokens-enable nil))))

(use-package clojure-ts-mode
  :ensure t
  :mode (("\\.clj\\'" . clojure-ts-mode)
         ("\\.cljs\\'" . clojure-ts-mode)
         ("\\.cljc\\'" . clojure-ts-mode))
  :hook
  (clojure-ts-mode . cider-mode)
  (clojure-ts-mode . (lambda () (setq-local lsp-semantic-tokens-enable nil))))

;; Gleam
(use-package gleam-ts-mode
  :mode (rx ".gleam" eos))

(use-package cider
  :ensure t
  :defer t)

(use-package elixir-ts-mode
  :ensure t
  :defer t
  :custom
  (lsp-elixir-server-command '("expert_darwin_arm64" "--stdio")))

(use-package heex-ts-mode
  :mode ("\\.heex\\'" . heex-ts-mode))

;; Meson
(use-package meson-mode
  :demand t
  :mode "\\.build\\'")

;; rust-mode
(use-package rust-mode
  :ensure t
  :init
  (setq rust-mode-treesitter-derive t))

(use-package rustic
  :ensure (:host github :repo "emacs-rustic/rustic")
  :after (rust-ts-mode)
  :config
  (setq rustic-cargo-clippy-trigger-fix 'on-compile
        rustic-rustfmt-args "+nightly"))

;; Scheme
(use-package geiser-chez :ensure t)

#+end_src

