refactor: introduce doom-module-context
Wheref9201eb
introduced a general context system, this one introduces one for modules, to simplify our let-bind game when interacting with modules, and to more efficiently expose module state to modulep! (which gets called at runtime a great deal, so its performance is important). * lisp/doom-lib.el (doom-log): simplify macro and introduce doom-inhibit-log variable. * lisp/doom-modules.el (modulep!): fix reported file path if modulep! fails to find the local module. * lisp/lib/debug.el (doom-debug-variables): disable doom-inhibit-log when debug mode is on. Ref:f9201eb218
This commit is contained in:
parent
5d2313155c
commit
4efaf6837b
8 changed files with 118 additions and 72 deletions
|
@ -411,13 +411,9 @@ installed."
|
|||
;;; Package getters
|
||||
(defun doom-packages--read (file &optional noeval noerror)
|
||||
(doom-context-with 'packages
|
||||
(condition-case-unless-debug e
|
||||
(with-temp-buffer ; prevent buffer-local state from propagating
|
||||
(let* ((doom--current-module (doom-module-from-path file))
|
||||
(doom--current-flags
|
||||
(doom-module-get (car doom--current-module)
|
||||
(cdr doom--current-module)
|
||||
:flags)))
|
||||
(doom-module-context-with (doom-module-from-path file)
|
||||
(condition-case-unless-debug e
|
||||
(with-temp-buffer ; prevent buffer-local state from propagating
|
||||
(if (not noeval)
|
||||
(load file noerror 'nomessage 'nosuffix)
|
||||
(when (file-exists-p file)
|
||||
|
@ -436,14 +432,14 @@ installed."
|
|||
(push (cons
|
||||
name (plist-put
|
||||
plist :modules
|
||||
(list doom--current-module)))
|
||||
doom-packages)))))))))
|
||||
(user-error
|
||||
(user-error (error-message-string e)))
|
||||
(error
|
||||
(signal 'doom-package-error
|
||||
(list (doom-module-from-path file)
|
||||
file e))))))
|
||||
(list (doom-module-context-key))))
|
||||
doom-packages))))))))
|
||||
(user-error
|
||||
(user-error (error-message-string e)))
|
||||
(error
|
||||
(signal 'doom-package-error
|
||||
(list (doom-module-context-key)
|
||||
file e)))))))
|
||||
|
||||
(defun doom-package-list (&optional module-list)
|
||||
"Retrieve a list of explicitly declared packages from MODULE-LIST.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue