-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodes.el
More file actions
35 lines (31 loc) · 1.27 KB
/
modes.el
File metadata and controls
35 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;;;; Tree-sitter
(defun treesit-verify-and-remap-major-mode (reset alist)
"Verify a treesit grammar (TREESIT-GRAMMAR) exists, then add
MODE-FROM to MODE-TO in `major-mode-remap-alist’. ALIST of
form (TREESIT-GRAMMAR MODE-FROM MODE-TO). Set RESET to `t’ if
you want to `nil’ the alist before operation"
(if reset (setq major-mode-remap-alist nil))
(while (length> alist 0)
(let* ((next (pop alist))
(grammar (pop next))
(from (pop next))
(to (pop next)))
(if (treesit-language-available-p grammar)
(add-to-list 'major-mode-remap-alist (cons from to))))))
(treesit-verify-and-remap-major-mode t
'((python python-mode python-ts-mode)
(json js-json-mode json-ts-mode)
(c c-mode c-ts-mode)
(rust rust-mode rust-ts-mode)
(haskell haskell-mode haskell-ts-mode)))
;;;; modes
(dolist (z (list (cons "\\.service\\'" 'conf-mode) ;; systemd
(cons "\\.timer\\'" 'conf-mode)
(cons "\\.pde\\'" 'java-ts-mode)
(cons "\\.jsx\\'" 'js-jsx-mode)
(cons "\\.ex\\'" 'elixir-ts-mode)
(cons "\\.exs\\'" 'elixir-ts-mode)
(cons "\\.elixir\\'" 'elixir-ts-mode)))
(add-to-list 'auto-mode-alist z))
;;;; ffap
(setq ffap-machine-p-known 'reject)