From 60c2306e20f7e53afaefca3beaa4cc16dd0e2a13 Mon Sep 17 00:00:00 2001 From: Micheal Smith Date: Sat, 21 Mar 2026 08:06:01 -0500 Subject: [PATCH] Fixed some issues with C formatting. --- config/formatting.org | 4 +++- config/lsp.org | 4 ++++ config/major_modes.org | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/formatting.org b/config/formatting.org index b18c1e3..a32e122 100644 --- a/config/formatting.org +++ b/config/formatting.org @@ -74,7 +74,9 @@ Might as well highlight the parentheses to make them easier to spot. #+BEGIN_SRC emacs-lisp (use-package apheleia :config - (apheleia-global-mode +1)) + (apheleia-global-mode +1) + (setf (alist-get 'c-ts-mode apheleia-mode-alist) '(clang-format)) + (setf (alist-get 'c++-ts-mode apheleia-mode-alist) '(clang-format))) #+END_SRC ** Indentation Level diff --git a/config/lsp.org b/config/lsp.org index 0aead37..c04c0a0 100644 --- a/config/lsp.org +++ b/config/lsp.org @@ -30,6 +30,10 @@ the package. ;; if you want which-key integration (lsp-mode . lsp-enable-which-key-integration)) :commands lsp-deferred + :custom + ;; Let apheleia handle formatting; disable LSP's competing formatters + (lsp-enable-on-type-formatting nil) + (lsp-before-save-edits nil) :config (setq lsp-elixir-server-command '("elixir-ls"))) diff --git a/config/major_modes.org b/config/major_modes.org index be99e9d..93b19f5 100644 --- a/config/major_modes.org +++ b/config/major_modes.org @@ -23,6 +23,9 @@ bother with an explanation on each. ;; 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)))