Rewrite doctor; move warn! blocks out in doctor.el files

This commit is contained in:
Henrik Lissner 2018-03-12 13:16:16 -04:00
parent 5c36519dab
commit 74c8b1d113
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
16 changed files with 193 additions and 147 deletions

View file

@ -136,8 +136,6 @@ compilation database is present in the project.")
(irony-mode +1)))
(add-hook! (c-mode c++-mode objc-mode) #'+cc|init-irony-mode)
:config
(unless (file-directory-p irony-server-install-prefix)
(warn! "Irony server isn't installed. Run M-x irony-install-server"))
;; Initialize compilation database, if present. Otherwise, fall back on
;; `+cc-default-compiler-options'.
(add-hook 'irony-mode-hook #'+cc|irony-init-compile-options))
@ -205,8 +203,6 @@ compilation database is present in the project.")
:when (featurep! :completion company)
:after glsl-mode
:config
(unless (executable-find "glslangValidator")
(warn! "Couldn't find glslangValidator. Code completion is disabled"))
(set! :company-backend 'glsl-mode '(company-glsl)))
@ -228,10 +224,6 @@ compilation database is present in the project.")
;; ...and don't auto-jump to first match before making a selection.
rtags-jump-to-first-match nil)
(let ((bins (cl-remove-if #'executable-find '("rdm" "rc"))))
(when (/= (length bins) 0)
(warn! "Couldn't find the rtag client and/or server programs %s. Disabling rtags support" bins)))
(set! :lookup '(c-mode c++-mode)
:definition #'rtags-find-symbol-at-point
:references #'rtags-find-references-at-point)

16
modules/lang/cc/doctor.el Normal file
View file

@ -0,0 +1,16 @@
;;; lang/cc/doctor.el -*- lexical-binding: t; -*-
;; rtags
(let ((bins (cl-remove-if #'executable-find '("rdm" "rc"))))
(when (/= (length bins) 0)
(warn! "Couldn't find the rtag client and/or server programs %s. Disabling rtags support" bins)))
;; irony server
(require 'irony)
(unless (file-directory-p irony-server-install-prefix)
(warn! "Irony server isn't installed. Run M-x irony-install-server"))
(when (featurep! :completion company)
;; glslangValidator
(unless (executable-find "glslangValidator")
(warn! "Couldn't find glslangValidator. GLSL code completion is disabled")))

View file

@ -19,7 +19,4 @@
(def-package! inf-crystal
:commands (inf-crystal crystal-switch-to-inf)
:config
(unless (executable-find "icr")
(warn! "Couldn't find icr. REPL will not work")))
:commands (inf-crystal crystal-switch-to-inf))

View file

@ -0,0 +1,4 @@
;;; lang/crystal/doctor.el -*- lexical-binding: t; -*-
(unless (executable-find "icr")
(warn! "Couldn't find icr. REPL will not work"))

View file

@ -78,25 +78,17 @@
:commands (go-guru-describe go-guru-freevars go-guru-implements go-guru-peers
go-guru-referrers go-guru-definition go-guru-pointsto
go-guru-callstack go-guru-whicherrs go-guru-callers go-guru-callees
go-guru-expand-region)
:config
(unless (executable-find "guru")
(warn! "Couldn't find guru. Refactoring commands (go-guru-*) won't work")))
go-guru-expand-region))
(def-package! gorepl-mode
:commands (gorepl-run gorepl-run-load-current-file)
:config
(unless (executable-find "gore")
(warn! "Couldn't find gore. REPL will not work")))
:commands (gorepl-run gorepl-run-load-current-file))
(def-package! company-go
:init (setq command-go-gocode-command "gocode")
:when (featurep! :completion company)
:init (setq command-go-gocode-command "gocode")
:after go-mode
:config
(setq company-go-show-annotation t)
(set! :company-backend 'go-mode '(company-go))
(unless (executable-find command-go-gocode-command)
(warn! "Couldn't find gocode. Code completion won't work")))
(set! :company-backend 'go-mode '(company-go)))

12
modules/lang/go/doctor.el Normal file
View file

@ -0,0 +1,12 @@
;;; lang/go/doctor.el -*- lexical-binding: t; -*-
(unless (executable-find "guru")
(warn! "Couldn't find guru. Refactoring commands (go-guru-*) won't work"))
(unless (executable-find "gore")
(warn! "Couldn't find gore. REPL will not work"))
(when (and (featurep! :completion company)
(require 'company-go nil t))
(unless (executable-find command-go-gocode-command)
(warn! "Couldn't find gocode. Code completion won't work")))

View file

@ -5,9 +5,6 @@
:after haskell-mode
:hook (haskell-mode . dante-mode)
:config
(unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues"))
(add-hook 'haskell-mode-hook #'interactive-haskell-mode)
(add-hook 'dante-mode-hook #'flycheck-mode))
@ -18,8 +15,5 @@
:init
(add-hook 'haskell-mode-hook #'ghc-comp-init)
:config
(unless (executable-find "ghc-mod")
(warn! "Couldn't find ghc-mod on PATH. Code completion is disabled."))
(setq company-ghc-show-info 'oneline)
(set! :company-backend 'haskell-mode #'company-ghc))

View file

@ -5,12 +5,7 @@
:after haskell-mode
:config
(add-hook 'haskell-mode-hook #'+haskell|init-intero)
(unless (executable-find "stack")
(warn! "Couldn't find stack. Intero has been disabled."))
(add-hook! 'intero-mode-hook #'(flycheck-mode eldoc-mode))
(set! :lookup 'haskell-mode :definition #'intero-goto-definition))

View file

@ -0,0 +1,13 @@
;;; lang/haskell/doctor.el -*- lexical-binding: t; -*-
(when (featurep! +dante)
(unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues"))
(unless (executable-find "ghc-mod")
(warn! "Couldn't find ghc-mod on PATH. Code completion will not work")))
(when (featurep! +intero)
(unless (executable-find "stack")
(warn! "Couldn't find stack. Intero will not work")))

View file

@ -6,12 +6,7 @@
(setq plantuml-jar-path (concat doom-etc-dir "plantuml.jar")
org-plantuml-jar-path plantuml-jar-path)
:config
(set! :popup "^\\*PLANTUML" '((size . 0.4)) '((select) (transient . 0)))
(unless (executable-find "java")
(warn! "Couldn't find java. Disabling plantuml preview."))
(unless (file-exists-p plantuml-jar-path)
(warn! "Couldn't find plantuml.jar. Install it witInstall it with-x +plantuml/install.")))
(set! :popup "^\\*PLANTUML" '((size . 0.4)) '((select) (transient . 0))))
(def-package! flycheck-plantuml

View file

@ -0,0 +1,9 @@
;;; lang/plantuml/doctor.el -*- lexical-binding: t; -*-
(when (require 'plantuml-mode nil t)
;; java
(unless (executable-find "java")
(warn! "Couldn't find java. PlantUML preview or syntax checking won't work"))
;; plantuml.jar
(unless (file-exists-p plantuml-jar-path)
(warn! "Couldn't find plantuml.jar. Install it with-x +plantuml/install")))

View file

@ -19,11 +19,6 @@
(def-package! racer
:after rust-mode
:config
(unless (file-exists-p racer-cmd)
(warn! "Couldn't find racer binary. Code completion won't work"))
(unless (file-directory-p racer-rust-src-path)
(warn! "Couldn't find rust source. Code completion won't work"))
(add-hook! 'rust-mode-hook #'(eldoc-mode racer-mode))
(set! :lookup 'rust-mode
:definition #'racer-find-definition

View file

@ -0,0 +1,9 @@
;;; lang/rust/doctor.el -*- lexical-binding: t; -*-
(when (require 'racer nil t)
;; racer
(unless (file-exists-p racer-cmd)
(warn! "Couldn't find the racer binary at `racer-cmd'"))
;; rust source code (rustup component add rust-src)
(unless (file-directory-p racer-rust-src-path)
(warn! "Couldn't find Rust's source code at RUST_SRC_PATH or `racer-rust-src-path'.")))

View file

@ -0,0 +1,4 @@
;;; ui/posframe/doctor.el -*- lexical-binding: t; -*-
(when (version< emacs-version "26")
(error! "This module doesn't work in Emacs %s (minimum: Emacs 26)" emacs-version))