Prevent loading if dependencies are missing
While the :after keyword delays loading until the dependencies are loaded, the somewhat simpler :requires keyword never loads the package if the dependencies are not available when the use-package declaration is evaluated. In this context, “available” means that foo is available if (featurep 'foo) evaluates to a non-nil value. For example:
emacs-lisp
(use-package abbrev
:requires foo)This is the same as:
emacs-lisp
(use-package abbrev
:if (featurep 'foo))As a convenience, a list of such packages may be specified:
emacs-lisp
(use-package abbrev
:requires (foo bar baz))For more complex logic, such as that supported by :after, simply use :if and the appropriate Lisp expression.