From 2f11c176855b769b26758dfb5029e93e30b3a853 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 8 Jul 2021 02:27:18 -0700 Subject: [PATCH] [oni-c] Set up use of ccls for C coding --- oni-c.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/oni-c.el b/oni-c.el index db57f99..7ecf0a9 100644 --- a/oni-c.el +++ b/oni-c.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2021.0622.220854 -;; Package-Requires: (oni-flycheck oni-lsp reformatter) +;; Version: 2021.0708.011015 +;; Package-Requires: (oni-flycheck oni-lsp reformatter ccls) ;; 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 @@ -34,19 +34,24 @@ (setq-local comment-auto-fill-only-comments t) (auto-fill-mode)) +(defun oni-c-ccls-lsp () + "Enable ‘lsp’ ensuring ‘ccls’ is used." + (require 'ccls) + (lsp)) + (reformatter-define oni-c-clang-formatter :program "clang-format" :lighter "" :group 'oni-c) +(add-hook 'c-mode-hook #'oni-c--auto-fill-mode) +(add-hook 'c-mode-hook #'oni-c-ccls-lsp) +(add-hook 'c-mode-hook #'oni-c-clang-formatter-on-save-mode) (add-hook 'c-mode-hook 'abbrev-mode) (add-hook 'c-mode-hook 'display-fill-column-indicator-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) (define-abbrev c-mode-abbrev-table "and" "&&" nil :system t) (define-abbrev c-mode-abbrev-table "or" "||" nil :system t)