diff options
Diffstat (limited to 'Emacs/.config/emacs')
-rw-r--r-- | Emacs/.config/emacs/config.org | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index c1ed907..a35f9cb 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -2576,16 +2576,23 @@ format [[file:~/Dotfiles/ClangFormat/.clang-format][config file]] in my dotfiles :straight nil :load-path "/usr/share/clang/" :after cc-mode - :commands +code/clang-format-region-or-buffer + :commands (+code/clang-format-region-or-buffer) :general (leader :keymaps '(c-mode-map c++-mode-map) "cf" #'+code/clang-format-region-or-buffer) :config - (add-hook 'after-save-hook (proc (interactive) - (if (or (eq major-mode 'c-mode) - (eq major-mode 'c++-mode)) - (clang-format-buffer)))) + (defvar +code/clang-format-automatically t + "Automatically call clang-format every time save occurs in C/C++ +buffer") + + (+dx/create-auto-save + +code/clang-format-on-save + (and +code/clang-format-automatically + (or (eq major-mode 'c-mode) + (eq major-mode 'c++-mode))) + (clang-format-buffer)) + (defun +code/clang-format-region-or-buffer () (interactive) (if (mark) |