Factor out Tree Sitter into a Org Roam file

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2021-12-22 23:49:00 +01:00
parent 4615711358
commit 5ab9980b9d
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
4 changed files with 39 additions and 11 deletions

View file

@ -48,7 +48,7 @@ Email is a complicated beast, I decided to use *mu4e* and *mbsync*.
(insert-file-contents file)
(buffer-string))))))
(setq mu4e-contexts (magic_rb/eval-file (getenv "MU4E_CONTEXTS"))
(setq mu4e-contexts (magic_rb/eval-file "~/.emacs.d/mu4e-contexts")
;; When Emacs is loading, mu4e will ask for which context to use. Set a default.
mu4e-context-policy 'pick-first)
(add-hook 'after-init-hook (lambda () (mu4e t))))

View file

@ -0,0 +1,32 @@
:PROPERTIES:
:ID: ba430294-f5ee-4bf7-b763-e7674f8e52ff
:END:
#+title: Tree Sitter
#+filetags: emacs-load
#+BEGIN_QUOTE
This is an Emacs Lisp binding for tree-sitter, an incremental parsing library. It requires Emacs 25.1 or above, built with dynamic module support.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package tree-sitter
:straight t
:after (tree-sitter-langs)
:config
(global-tree-sitter-mode)
(setq tree-sitter-load-path '("~/.emacs.d/treesitter-grammars")
tree-sitter-major-mode-language-alist
'((haskell-mode . haskell)
(sh-mode . bash)
(emacs-lisp-mode . elisp)
(c++-mode . cpp)
(c-mode . c)
(css-mode . css)
(hcl-mode . hcl)
(json-mode . json)
(nix-mode . nix)
(php-mode . php)
(python-mode . python)
(rustic-mode . rust)))
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
#+END_SRC

View file

@ -20,16 +20,6 @@ https://github.com/alphapapa/org-web-tools
:config
(elcord-mode)))
(when (not (string= (system-name) "localhost"))
(use-package tree-sitter
:straight t
:after (tree-sitter-langs)
:config
(global-tree-sitter-mode)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
(use-package tree-sitter-langs
:straight t))
(use-package pdf-tools
:straight t
:hook (('TeX-mode-hook . visual-line-mode))

View file

@ -79,6 +79,12 @@ in
source = ./.emacs.d/lisp;
recursive = true;
};
".emacs.d/mu4e-contexts" = {
source = secret.emacs.mu4eContexts;
};
".emacs.d/treesitter-grammars" = {
source = pkgs.tree-sitter.withPlugins (p: builtins.attrValues p);
};
};
};
}