dot-emacs

My emacs dotfiles/config
git clone git://git.ethandl.dev/dot-emacs
Log | Files | Refs

commit f133860f09ed2f0b84f467eab27b9bd98da77321
parent fbd1429e1a00d03602bf1d15d551214fac97cd8c
Author: Ethan Long <ethandavidlong@gmail.com>
Date:   Fri,  8 Dec 2023 04:49:35 +1100

Duende

Diffstat:
Mconfig.org | 21+++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/config.org b/config.org @@ -77,8 +77,8 @@ We also set the ligatures for code #+end_src #+begin_src emacs-lisp (defun ethandl/format-buffer () - (cond (lsp-mode (lsp-format-buffer)) - (eglot--managed-mode (eglot-format-buffer)))) + (when eglot--managed-mode + (eglot-format-buffer))) #+end_src #+begin_src emacs-lisp (defun ethandl/line-nums-cfg () @@ -100,6 +100,12 @@ We also set the ligatures for code (interactive) (load user-init-file)) #+end_src +#+begin_src emacs-lisp + (defun ethandl/install-treesit-grammars (lang-alist) + (require 'cl-lib) + (when (treesit-available-p) + (mapc #'treesit-install-language-grammar (cl-remove-if #'treesit-language-available-p (mapcar #'car lang-alist))))) +#+end_src ** Org Mode Configuration The following function is the base config for org-mode, it sets org to indent on section depth, sets the font to be variable pitch, turns on visual lines for wrapped lines. #+begin_src emacs-lisp @@ -306,9 +312,7 @@ Based completion. This is an overhaul of the autocomplete. Company mode sucks be (corfu-scroll-margin 5) (completion-cycle-threshold 3) :config - (global-corfu-mode) - ;; Shouldn't have to do this, but lsp is a little bugged: - (advice-add #'lsp-completion-at-point :around #'cape-wrap-noninterruptible)) + (global-corfu-mode)) #+end_src ** Scrolling Patches Scrolling via cursor movement is too slow in default emacs, this fixes that. @@ -390,6 +394,7 @@ LSP, the Language Server Protocol. Very nice for debugging code live as you writ We use the built-in package eglot for this, though we still tell ~use-package~ to downlaod it. #+begin_src emacs-lisp (use-package eglot) + (use-package markdown-mode) ; needed for formatting the stuff in the eldoc buffers #+end_src ** Tree Sitter Setup Since Emacs 29, we don't need to install tree sitter separately anymore, it comes with Emacs! @@ -413,17 +418,13 @@ Since Emacs 29, we don't need to install tree sitter separately anymore, it come (c "https://github.com/tree-sitter/tree-sitter-c") (cpp "https://github.com/tree-sitter/tree-sitter-cpp"))) - (require 'cl-lib) - (when (treesit-available-p) - (elpaca nil (mapc #'treesit-install-language-grammar (cl-remove-if #'treesit-language-available-p (mapcar #'car treesit-language-source-alist))))) + (elpaca nil (ethandl/install-treesit-grammars treesit-language-source-alist)) #+end_src ** Eldoc Setup I like to have eldoc appear as a box below where I'm typing, rather than having it appear in the minibuffer. This is done with =eldoc-box=: #+begin_src emacs-lisp (use-package eldoc-box :hook - (eldoc-managed-mode . eldoc-box-hover-mode) - (lsp-after-open . eldoc-box-hover-mode) (eglot-managed-mode . eldoc-box-hover-mode)) #+end_src ** C