diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 565dc5f49..0077083c1 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -136,22 +136,28 @@ compilation database is present in the project.") (defun +cc|init-irony-mode () (when (memq major-mode '(c-mode c++-mode objc-mode)) (irony-mode +1))) - (add-hook! (c-mode c++-mode objc-mode) #'+cc|init-irony-mode) + (add-hook 'c-mode-common-hook #'+cc|init-irony-mode) :config (setq irony-cdb-search-directory-list '("." "build" "build-conda")) ;; Initialize compilation database, if present. Otherwise, fall back on ;; `+cc-default-compiler-options'. - (add-hook 'irony-mode-hook #'+cc|irony-init-compile-options)) + (add-hook 'irony-mode-hook #'+cc|irony-init-compile-options) -(def-package! irony-eldoc - :hook (irony-mode . irony-eldoc)) + (def-package! irony-eldoc :hook (irony-mode . irony-eldoc)) -(def-package! flycheck-irony - :when (featurep! :feature syntax-checker) - :after irony - :config - (add-hook 'irony-mode-hook #'flycheck-mode) - (flycheck-irony-setup)) + (def-package! flycheck-irony + :when (featurep! :feature syntax-checker) + :config + (add-hook 'irony-mode-hook #'flycheck-mode) + (flycheck-irony-setup)) + + (def-package! company-irony + :when (featurep! :completion company) + :after irony) + + (def-package! company-irony-c-headers + :when (featurep! :completion company) + :after company-irony)) ;; @@ -193,14 +199,6 @@ compilation database is present in the project.") :when (featurep! :completion company) :after cmake-mode) -(def-package! company-irony - :when (featurep! :completion company) - :after irony) - -(def-package! company-irony-c-headers - :when (featurep! :completion company) - :after company-irony) - (def-package! company-glsl :when (featurep! :completion company) :after glsl-mode @@ -213,7 +211,7 @@ compilation database is present in the project.") ;; (def-package! rtags - :commands (rtags-restart-process rtags-start-process-unless-running rtags-executable-find) + :commands rtags-executable-find :init (add-hook! (c-mode c++-mode) #'+cc|init-rtags) :config @@ -237,14 +235,14 @@ compilation database is present in the project.") (map! :map (c-mode-map c++-mode-map) [remap imenu] #'rtags-imenu) (when (featurep 'evil) (add-hook 'rtags-jump-hook #'evil-set-jump)) - (add-hook 'rtags-after-find-file-hook #'recenter)) + (add-hook 'rtags-after-find-file-hook #'recenter) -(def-package! ivy-rtags - :when (featurep! :completion ivy) - :after rtags - :config (setq rtags-display-result-backend 'ivy)) + (def-package! ivy-rtags + :when (featurep! :completion ivy) + :after rtags + :config (setq rtags-display-result-backend 'ivy)) -(def-package! helm-rtags - :when (featurep! :completion helm) - :after rtags - :config (setq rtags-display-result-backend 'helm)) + (def-package! helm-rtags + :when (featurep! :completion helm) + :after rtags + :config (setq rtags-display-result-backend 'helm))) diff --git a/modules/lang/cc/packages.el b/modules/lang/cc/packages.el index 8151bc4fd..661fda6b3 100644 --- a/modules/lang/cc/packages.el +++ b/modules/lang/cc/packages.el @@ -5,22 +5,23 @@ (package! cuda-mode) (package! demangle-mode) (package! disaster) -(package! glsl-mode) -(package! irony) -(package! irony-eldoc) (package! modern-cpp-font-lock) (package! opencl-mode) -(when (featurep! :feature syntax-checker) - (package! flycheck-irony)) +(when (package! glsl-mode) + (when (featurep! :completion company) + (package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl")))) -(when (featurep! :completion company) - (package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl")) - (package! company-irony) - (package! company-irony-c-headers)) +(when (package! irony) + (package! irony-eldoc) + (when (featurep! :feature syntax-checker) + (package! flycheck-irony)) + (when (featurep! :completion company) + (package! company-irony) + (package! company-irony-c-headers))) -(package! rtags) -(when (featurep! :completion ivy) - (package! ivy-rtags)) -(when (featurep! :completion helm) - (package! helm-rtags)) +(when (package! rtags) + (when (featurep! :completion ivy) + (package! ivy-rtags)) + (when (featurep! :completion helm) + (package! helm-rtags)))