24b9802fbb0d680c7285cf1046d3a2a8f5bf7d95 — Evan Straw 6 months ago df1e0c2
Fix C/C++ config and clang-format config
1 files changed, 20 insertions(+), 8 deletions(-)

M modules/module-lang-c-c++.el
M modules/module-lang-c-c++.el => modules/module-lang-c-c++.el +20 -8
@@ 12,8 12,19 @@
(require 'google-c-style)

(use-package clang-format
  (defun clang-format-auto ()
	"Calls the appropriate clang-format function depending on
  whether or not a region is selected. If a region is selected,
  will apply clang-format-region to that region only; otherwise,
  will format the whole buffer."
	(if (region-active-p)
		(clang-format-region (region-beginning) (region-end))
  :commands (clang-format-buffer

;; ---------------
;; CCLS configuration (C/C++)

@@ 32,15 43,16 @@
  (setq ccls-args '("--log-file=/tmp/ccls.log"
  ;;		    "--init={\"compilationDatabaseDirectory\": \"build\"}"))
  ;;(setq ccls-initialization-options '(:clang (:extraArgs '("--gcc-toolchain" "/usr"))))
  :bind (:map c-mode-map
	 ("C-c C-f" . clang-format-buffer)
	 :map c++-mode-map
	 ("C-c C-f" . clang-format-buffer))
;(setq ccls-initialization-options '(:clang (:extraArgs '("--gcc-toolchain" "/usr"))))
  :hook ((c-mode c++-mode objc-mode) .
         (lambda ()
	   (require 'ccls)
		   (require 'ccls)
  :bind (:map c-mode-map
		 ("C-c C-f" . clang-format-auto)
		 :map c++-mode-map
		 ("C-c C-f" . clang-format-auto)))

(add-hook 'c-mode-common-hook '(lambda ()
				 (setq-default tab-width 4)))