aboutsummaryrefslogtreecommitdiffstats
path: root/oni-c.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2020-12-12 21:36:53 -0800
committerGravatar Tom Willemse2020-12-12 22:01:15 -0800
commit44037781b12772f388e827c99a6af5622e19da89 (patch)
tree8393c19c00572b306387cf0d9f19a13619fbbaf8 /oni-c.el
parent0b7c98baf1572458088c431e20d201a421ee042f (diff)
downloademacs-config-44037781b12772f388e827c99a6af5622e19da89.tar.gz
emacs-config-44037781b12772f388e827c99a6af5622e19da89.zip
Add reformatter and lsp to my C configuration
Diffstat (limited to 'oni-c.el')
-rw-r--r--oni-c.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/oni-c.el b/oni-c.el
index bbe37c2..24be34e 100644
--- a/oni-c.el
+++ b/oni-c.el
@@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2020.1210.205244
-;; Package-Requires: (oni-flycheck oni-fci)
+;; Version: 2020.1212.220101
+;; Package-Requires: (oni-flycheck oni-fci oni-lsp reformatter)
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -27,17 +27,25 @@
;;; Code:
(require 'cc-mode)
+(require 'reformatter)
(defun oni-c--auto-fill-mode ()
"Enable ‘auto-fill-mode’ only for comments."
(setq-local comment-auto-fill-only-comments t)
(auto-fill-mode))
+(reformatter-define oni-c-clang-formatter
+ :program "clang-format"
+ :lighter ""
+ :group 'oni-c)
+
(add-hook 'c-mode-hook 'abbrev-mode)
(add-hook 'c-mode-hook 'electric-indent-local-mode)
(add-hook 'c-mode-hook 'electric-pair-local-mode)
(add-hook 'c-mode-hook 'flycheck-mode)
+(add-hook 'c-mode-hook 'lsp)
(add-hook 'c-mode-hook 'oni-c--auto-fill-mode)
+(add-hook 'c-mode-hook 'oni-c-clang-formatter-on-save-mode)
(add-hook 'c-mode-hook
(if (fboundp 'display-fill-column-indicator-mode)