From faeefc17757e3063f180e84afe75bf3ea1d44ba4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 7 Jul 2019 14:07:11 +0200 Subject: [PATCH] Add FLAG argument to doom-module-p --- core/core-modules.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/core-modules.el b/core/core-modules.el index 73d02521f..77415af9e 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -104,12 +104,15 @@ non-nil." ;; ;;; 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')." (declare (pure t) (side-effect-free t)) - (and (hash-table-p doom-modules) - (gethash (cons category module) doom-modules) - t)) + (when (hash-table-p doom-modules) + (let ((plist (gethash (cons category module) doom-modules))) + (and plist + (or (null flag) + (memq flag (plist-get plist :flags))) + t)))) (defun doom-module-get (category module &optional property) "Returns the plist for CATEGORY MODULE. Gets PROPERTY, specifically, if set."