Add FLAG argument to doom-module-p

This commit is contained in:
Henrik Lissner 2019-07-07 14:07:11 +02:00
parent ebd53e5664
commit faeefc1775
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -104,12 +104,15 @@ non-nil."
;; ;;
;;; Module API ;;; Module API
(defun doom-module-p (category module) (defun doom-module-p (category module &optional flag)
"Returns t if CATEGORY MODULE is enabled (ie. present in `doom-modules')." "Returns t if CATEGORY MODULE is enabled (ie. present in `doom-modules')."
(declare (pure t) (side-effect-free t)) (declare (pure t) (side-effect-free t))
(and (hash-table-p doom-modules) (when (hash-table-p doom-modules)
(gethash (cons category module) doom-modules) (let ((plist (gethash (cons category module) doom-modules)))
t)) (and plist
(or (null flag)
(memq flag (plist-get plist :flags)))
t))))
(defun doom-module-get (category module &optional property) (defun doom-module-get (category module &optional property)
"Returns the plist for CATEGORY MODULE. Gets PROPERTY, specifically, if set." "Returns the plist for CATEGORY MODULE. Gets PROPERTY, specifically, if set."