aboutsummaryrefslogtreecommitdiff
path: root/Emacs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-06-25 12:56:12 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-06-25 12:56:12 +0100
commit14d3f589288b6ad80a159d43b2ae863c6e33c804 (patch)
tree332579e3446f88ec4d76f1fa07a82e2087f6d3f1 /Emacs
parent0beb166d473584fa4d3877267b58253e8f87ef6b (diff)
downloaddotfiles-14d3f589288b6ad80a159d43b2ae863c6e33c804.tar.gz
dotfiles-14d3f589288b6ad80a159d43b2ae863c6e33c804.tar.bz2
dotfiles-14d3f589288b6ad80a159d43b2ae863c6e33c804.zip
(Emacs/config)~Rework clang-format a bit
Use before-save-hook rather than after-save-hook, which solves the double save issue.
Diffstat (limited to 'Emacs')
-rw-r--r--Emacs/.config/emacs/config.org15
1 files changed, 9 insertions, 6 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index d550aac..848e9a1 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -3175,10 +3175,13 @@ Tons of stuff, namely:
(statement-cont . +)))))
#+end_src
*** Clang format
-Clang format comes inbuilt with clang, so download that before using
-this. Formats C/C++ files depending on a format (checkout the Clang
-format [[file:~/Dotfiles/ClangFormat/.clang-format][config file]] in
-my dotfiles).
+clang-format is a program that formats C/C++ files. It's highly
+configurable and quite fast. I have a root configuration in my
+Dotfiles (check it out
+[[file:~/Dotfiles/ClangFormat/).clang-format][here]].
+
+Clang format comes inbuilt with clang/LLVM, so it's quite likely to be
+on your machine.
#+begin_src emacs-lisp
(use-package clang-format
@@ -3198,8 +3201,8 @@ my dotfiles).
(let ((save-func (proc (interactive)
(clang-format-buffer))))
(if clang-format-mode
- (add-hook 'after-save-hook save-func nil t)
- (remove-hook 'after-save-hook save-func t))))
+ (add-hook 'before-save-hook save-func nil t)
+ (remove-hook 'before-save-hook save-func t))))
(defun +code/clang-format-region-or-buffer ()
(interactive)
(if (mark)