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)