lang/cc: refactor (nest configs and chain packages)
Allows users to disable irony and/or rtags only, then their dependent packages won't be loaded.
This commit is contained in:
parent
e7a1e0b4a2
commit
63fdc3530c
2 changed files with 41 additions and 42 deletions
|
@ -136,22 +136,28 @@ compilation database is present in the project.")
|
||||||
(defun +cc|init-irony-mode ()
|
(defun +cc|init-irony-mode ()
|
||||||
(when (memq major-mode '(c-mode c++-mode objc-mode))
|
(when (memq major-mode '(c-mode c++-mode objc-mode))
|
||||||
(irony-mode +1)))
|
(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
|
:config
|
||||||
(setq irony-cdb-search-directory-list '("." "build" "build-conda"))
|
(setq irony-cdb-search-directory-list '("." "build" "build-conda"))
|
||||||
;; Initialize compilation database, if present. Otherwise, fall back on
|
;; Initialize compilation database, if present. Otherwise, fall back on
|
||||||
;; `+cc-default-compiler-options'.
|
;; `+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
|
(def-package! irony-eldoc :hook (irony-mode . irony-eldoc))
|
||||||
:hook (irony-mode . irony-eldoc))
|
|
||||||
|
|
||||||
(def-package! flycheck-irony
|
(def-package! flycheck-irony
|
||||||
:when (featurep! :feature syntax-checker)
|
:when (featurep! :feature syntax-checker)
|
||||||
:after irony
|
:config
|
||||||
:config
|
(add-hook 'irony-mode-hook #'flycheck-mode)
|
||||||
(add-hook 'irony-mode-hook #'flycheck-mode)
|
(flycheck-irony-setup))
|
||||||
(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)
|
:when (featurep! :completion company)
|
||||||
:after cmake-mode)
|
: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
|
(def-package! company-glsl
|
||||||
:when (featurep! :completion company)
|
:when (featurep! :completion company)
|
||||||
:after glsl-mode
|
:after glsl-mode
|
||||||
|
@ -213,7 +211,7 @@ compilation database is present in the project.")
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(def-package! rtags
|
(def-package! rtags
|
||||||
:commands (rtags-restart-process rtags-start-process-unless-running rtags-executable-find)
|
:commands rtags-executable-find
|
||||||
:init
|
:init
|
||||||
(add-hook! (c-mode c++-mode) #'+cc|init-rtags)
|
(add-hook! (c-mode c++-mode) #'+cc|init-rtags)
|
||||||
:config
|
:config
|
||||||
|
@ -237,14 +235,14 @@ compilation database is present in the project.")
|
||||||
(map! :map (c-mode-map c++-mode-map) [remap imenu] #'rtags-imenu)
|
(map! :map (c-mode-map c++-mode-map) [remap imenu] #'rtags-imenu)
|
||||||
|
|
||||||
(when (featurep 'evil) (add-hook 'rtags-jump-hook #'evil-set-jump))
|
(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
|
(def-package! ivy-rtags
|
||||||
:when (featurep! :completion ivy)
|
:when (featurep! :completion ivy)
|
||||||
:after rtags
|
:after rtags
|
||||||
:config (setq rtags-display-result-backend 'ivy))
|
:config (setq rtags-display-result-backend 'ivy))
|
||||||
|
|
||||||
(def-package! helm-rtags
|
(def-package! helm-rtags
|
||||||
:when (featurep! :completion helm)
|
:when (featurep! :completion helm)
|
||||||
:after rtags
|
:after rtags
|
||||||
:config (setq rtags-display-result-backend 'helm))
|
:config (setq rtags-display-result-backend 'helm)))
|
||||||
|
|
|
@ -5,22 +5,23 @@
|
||||||
(package! cuda-mode)
|
(package! cuda-mode)
|
||||||
(package! demangle-mode)
|
(package! demangle-mode)
|
||||||
(package! disaster)
|
(package! disaster)
|
||||||
(package! glsl-mode)
|
|
||||||
(package! irony)
|
|
||||||
(package! irony-eldoc)
|
|
||||||
(package! modern-cpp-font-lock)
|
(package! modern-cpp-font-lock)
|
||||||
(package! opencl-mode)
|
(package! opencl-mode)
|
||||||
|
|
||||||
(when (featurep! :feature syntax-checker)
|
(when (package! glsl-mode)
|
||||||
(package! flycheck-irony))
|
(when (featurep! :completion company)
|
||||||
|
(package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl"))))
|
||||||
|
|
||||||
(when (featurep! :completion company)
|
(when (package! irony)
|
||||||
(package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl"))
|
(package! irony-eldoc)
|
||||||
(package! company-irony)
|
(when (featurep! :feature syntax-checker)
|
||||||
(package! company-irony-c-headers))
|
(package! flycheck-irony))
|
||||||
|
(when (featurep! :completion company)
|
||||||
|
(package! company-irony)
|
||||||
|
(package! company-irony-c-headers)))
|
||||||
|
|
||||||
(package! rtags)
|
(when (package! rtags)
|
||||||
(when (featurep! :completion ivy)
|
(when (featurep! :completion ivy)
|
||||||
(package! ivy-rtags))
|
(package! ivy-rtags))
|
||||||
(when (featurep! :completion helm)
|
(when (featurep! :completion helm)
|
||||||
(package! helm-rtags))
|
(package! helm-rtags)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue