Add :tools lsp checks for +lsp flag

Also:
- Reorganizes some :lang modules' packages.el file.
- Adds setuptools check in lang/python
- Adds javac check in lang/java
- Removes the depends-on! macro
This commit is contained in:
Henrik Lissner 2019-04-22 03:10:25 -04:00
parent 9bea168cc1
commit c399c07694
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
16 changed files with 91 additions and 49 deletions

View file

@ -233,27 +233,5 @@ Only use this macro in a module's packages.el file."
(cl-loop for pkg in packages
collect (macroexpand `(package! ,pkg :disable t)))))
(defmacro depends-on! (category module &rest flags)
"Declares that this CATEGORY depends on another.
Emits a warning if CATEGORY MODULE isn't enabled, or is enabled without FLAGS.
Only use this macro in a CATEGORY's packages.el file."
(doom--assert-stage-p 'packages #'depends-on!)
`(let ((desired-flags ',flags))
(unless (doom-module-locate-path ,category ',module)
(error "The '%s %s' module is required, but doesn't exist"
,category ',module))
(unless (doom-module-p ,category ',module)
(error "The '%s %s' module is required, but disabled"
,category ',module))
(let ((flags (doom-module-get ,category ',module :flags)))
(when (and desired-flags
(/= (length (cl-intersection flags desired-flags))
(length desired-flags)))
(error "The '%s %s' module is missing the required %S flag(s)"
,category ',module
(cl-set-difference desired-flags flags))))))
(provide 'core-packages)
;;; core-packages.el ends here

View file

@ -1,6 +1,10 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/cc/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(when (require 'rtags nil t)
;; rtags
(let ((bins (cl-remove-if #'executable-find `(,rtags-rdm-binary-name ,rtags-rc-binary-name))))

View file

@ -1,6 +1,10 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/go/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "guru")
(warn! "Couldn't find guru. Refactoring commands (go-guru-*) won't work"))

View file

@ -1,6 +1,10 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/haskell/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(when (featurep! +dante)
(unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues")))

View file

@ -0,0 +1,9 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/java/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "javac")
(warn! "Couldn't find the javac executable, are you sure the JDK is installed?"))

View file

@ -0,0 +1,6 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/javascript/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")

View file

@ -1,21 +1,23 @@
;; -*- no-byte-compile: t; -*-
;;; lang/javascript/packages.el
;; major modes
;; Major modes
(package! coffee-mode)
(package! js2-mode)
(package! rjsx-mode)
(package! typescript-mode)
;; tools
;; Tools
(package! eslintd-fix)
(package! js2-refactor)
(package! nodejs-repl)
(package! npm-mode)
;; Eval
(package! nodejs-repl)
(package! skewer-mode)
(when (featurep! :tools lookup)
(package! xref-js2))
;; Programming environment
(unless (featurep! +lsp)
(package! tide))
(when (featurep! :tools lookup)
(package! xref-js2))

View file

@ -1,6 +1,10 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/ocaml/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "ocamlmerlin")
(warn! "Couldn't find ocamlmerlin. Lookup, completion and syntax checking won't work"))

View file

@ -0,0 +1,6 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/php/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")

View file

@ -1,7 +1,14 @@
;;; lang/python/doctor.el -*- lexical-binding: t; -*-
(unless (executable-find "python")
(warn! "Python isn't installed."))
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(if (not (executable-find "python"))
(warn! "Python isn't installed.")
(unless (featurep! +lsp)
(unless (zerop (shell-command "python -c 'import setuptools'"))
(warn! "setuptools wasn't detected, which anaconda-mode requires"))))
(when (featurep! +pyenv)
(if (not (executable-find "pyenv"))

View file

@ -1,13 +1,15 @@
;; -*- no-byte-compile: t; -*-
;;; lang/python/packages.el
;; requires: python setuptools
(package! nose)
(package! python-pytest)
;; Major modes
(package! pip-requirements)
;; Environmet management
;; Programming environment
(package! anaconda-mode)
(when (featurep! :completion company)
(package! company-anaconda))
;; Environment management
(package! pipenv)
(package! pyvenv)
(when (featurep! +pyenv)
@ -15,8 +17,6 @@
(when (featurep! +conda)
(package! conda))
;; Programming environment
(unless (featurep! +lsp)
(package! anaconda-mode)
(when (featurep! :completion company)
(package! company-anaconda)))
;; Testing frameworks
(package! nose)
(package! python-pytest)

View file

@ -1,5 +1,9 @@
;;; lang/ruby/doctor.el -*- lexical-binding: t; -*-
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "ruby")
(warn! "Ruby isn't installed."))

View file

@ -1,23 +1,25 @@
;; -*- no-byte-compile: t; -*-
;;; lang/ruby/packages.el
;; requires ruby ruby-lint
;; Major modes
(package! enh-ruby-mode)
(package! yard-mode)
(package! inf-ruby)
(unless (featurep! +lsp)
(package! robe))
;; REPL
(package! inf-ruby)
(when (featurep! :completion company)
(package! company-inf-ruby))
;; Programming environment
(package! rubocop)
(unless (featurep! +lsp)
(package! robe))
;; Project tools
(package! bundler)
(package! rake)
(package! rubocop)
;; Version management
;; Environment management
(when (featurep! +rbenv)
(package! rbenv))
(when (featurep! +rvm)

View file

@ -1,6 +1,16 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/rust/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "rust")
(warn! "Couldn't find rust binary"))
(unless (executable-find "cargo")
(warn! "Couldn't find cargo binary"))
(when (require 'racer nil t)
;; racer
(unless (file-exists-p racer-cmd)

View file

@ -1,8 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; lang/rust/packages.el
;; requires rust cargo racer
(package! rust-mode)
(when (featurep! :tools flycheck)

View file

@ -1,5 +1,9 @@
;;; lang/web/doctor.el -*- lexical-binding: t; -*-
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "js-beautify")
(warn! "Couldn't find js-beautify. Code formatting in JS/CSS/HTML modes will not work."))