diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-09-15 12:18:30 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-09-15 12:18:30 +0100 |
commit | b1908e7fe36f168cd707ae3b41aa235f27684e5f (patch) | |
tree | c9bf6841dab1330f57367480b2705ebc1db5534b /Emacs/.config | |
parent | 7121da840d33dc29b2833b8e9fcf474d180e814b (diff) | |
download | dotfiles-b1908e7fe36f168cd707ae3b41aa235f27684e5f.tar.gz dotfiles-b1908e7fe36f168cd707ae3b41aa235f27684e5f.tar.bz2 dotfiles-b1908e7fe36f168cd707ae3b41aa235f27684e5f.zip |
(Emacs/CC mode)+hook to clang format buffer on save
Just a nicer format, good for git commits.
Diffstat (limited to 'Emacs/.config')
-rw-r--r-- | Emacs/.config/emacs/config.org | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 7784803..5f2993f 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -2351,6 +2351,10 @@ format [[file:~/Dotfiles/ClangFormat/.clang-format][config file]] in my dotfiles :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)))) (defun +code/clang-format-region-or-buffer () (interactive) (if (mark) |