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 (cl-loop for pkg in packages
collect (macroexpand `(package! ,pkg :disable t))))) 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) (provide 'core-packages)
;;; core-packages.el ends here ;;; core-packages.el ends here

View file

@ -1,6 +1,10 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*- ;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/cc/doctor.el ;;; lang/cc/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(when (require 'rtags nil t) (when (require 'rtags nil t)
;; rtags ;; rtags
(let ((bins (cl-remove-if #'executable-find `(,rtags-rdm-binary-name ,rtags-rc-binary-name)))) (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; -*- ;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/go/doctor.el ;;; lang/go/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "guru") (unless (executable-find "guru")
(warn! "Couldn't find guru. Refactoring commands (go-guru-*) won't work")) (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; -*- ;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/haskell/doctor.el ;;; lang/haskell/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(when (featurep! +dante) (when (featurep! +dante)
(unless (executable-find "cabal") (unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues"))) (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; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/javascript/packages.el ;;; lang/javascript/packages.el
;; major modes ;; Major modes
(package! coffee-mode) (package! coffee-mode)
(package! js2-mode) (package! js2-mode)
(package! rjsx-mode) (package! rjsx-mode)
(package! typescript-mode) (package! typescript-mode)
;; tools ;; Tools
(package! eslintd-fix) (package! eslintd-fix)
(package! js2-refactor) (package! js2-refactor)
(package! nodejs-repl)
(package! npm-mode) (package! npm-mode)
;; Eval
(package! nodejs-repl)
(package! skewer-mode) (package! skewer-mode)
(when (featurep! :tools lookup) ;; Programming environment
(package! xref-js2))
(unless (featurep! +lsp) (unless (featurep! +lsp)
(package! tide)) (package! tide))
(when (featurep! :tools lookup)
(package! xref-js2))

View file

@ -1,6 +1,10 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*- ;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/ocaml/doctor.el ;;; lang/ocaml/doctor.el
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "ocamlmerlin") (unless (executable-find "ocamlmerlin")
(warn! "Couldn't find ocamlmerlin. Lookup, completion and syntax checking won't work")) (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; -*- ;;; lang/python/doctor.el -*- lexical-binding: t; -*-
(unless (executable-find "python") (assert! (or (not (featurep! +lsp))
(warn! "Python isn't installed.")) (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) (when (featurep! +pyenv)
(if (not (executable-find "pyenv")) (if (not (executable-find "pyenv"))

View file

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

View file

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

View file

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

View file

@ -1,6 +1,16 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*- ;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/rust/doctor.el ;;; 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) (when (require 'racer nil t)
;; racer ;; racer
(unless (file-exists-p racer-cmd) (unless (file-exists-p racer-cmd)

View file

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

View file

@ -1,5 +1,9 @@
;;; lang/web/doctor.el -*- lexical-binding: t; -*- ;;; 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") (unless (executable-find "js-beautify")
(warn! "Couldn't find js-beautify. Code formatting in JS/CSS/HTML modes will not work.")) (warn! "Couldn't find js-beautify. Code formatting in JS/CSS/HTML modes will not work."))