From 44037781b12772f388e827c99a6af5622e19da89 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 12 Dec 2020 21:36:53 -0800 Subject: Add reformatter and lsp to my C configuration --- oni-c.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'oni-c.el') 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 ;; 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) -- cgit v1.2.3-54-g00ecf