feat: allow doom-module-set to disable modules

This commit is contained in:
Henrik Lissner 2022-09-13 00:07:27 +02:00
parent c5188c4388
commit 10eb5db12d
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -176,14 +176,20 @@ following properties:
:flags [SYMBOL LIST] list of enabled category flags :flags [SYMBOL LIST] list of enabled category flags
:path [STRING] path to category root directory :path [STRING] path to category root directory
If PLIST consists of a single nil, unset and disable CATEGORY MODULE.
Example: Example:
(doom-module-set :lang 'haskell :flags '(+lsp))" (doom-module-set :lang 'haskell :flags '(+lsp))"
(if (car plist)
(progn
;; Doom caches flags and features using symbol plists for fast lookups in ;; Doom caches flags and features using symbol plists for fast lookups in
;; `modulep!'. plists lack the overhead, and are much faster for datasets this ;; `modulep!'. plists lack the overhead, and are much faster for datasets this
;; small. The format of this case is (cons FEATURES FLAGS) ;; small. The format of this case is (cons FEATURES FLAGS)
(put category module (cons t (plist-get plist :flags))) (put category module (cons t (plist-get plist :flags)))
;; But the hash table will always been Doom's formal storage for modules. ;; But the hash table will always been Doom's formal storage for modules.
(puthash (cons category module) plist doom-modules)) (puthash (cons category module) plist doom-modules))
(remhash (cons category module) doom-modules)
(cl-remf (symbol-plist category) module)))
(defun doom-module-expand-path (category module &optional file) (defun doom-module-expand-path (category module &optional file)
"Expands a path to FILE relative to CATEGORY and MODULE. "Expands a path to FILE relative to CATEGORY and MODULE.