2022-07-30 21:49:00 +02:00
|
|
|
;;; doom-modules.el --- module & package management system -*- lexical-binding: t; -*-
|
2022-09-12 18:05:14 +02:00
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Variables
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2020-05-25 21:51:35 -04:00
|
|
|
(defvar doom-modules (make-hash-table :test 'equal)
|
2018-06-11 23:18:15 +02:00
|
|
|
"A hash table of enabled modules. Set by `doom-initialize-modules'.")
|
|
|
|
|
2024-02-04 17:55:07 -05:00
|
|
|
(define-obsolete-variable-alias 'doom-modules-dirs 'doom-module-load-path "3.0.0")
|
2024-02-02 18:54:14 -05:00
|
|
|
(defvar doom-module-load-path
|
|
|
|
(list (file-name-concat doom-user-dir "modules")
|
|
|
|
(file-name-concat doom-emacs-dir "modules"))
|
|
|
|
"A list of paths where Doom should search for modules.
|
|
|
|
|
|
|
|
Order determines priority (from highest to lowest).
|
|
|
|
|
|
|
|
Each entry is a string; an absolute path to the root directory of a module tree.
|
|
|
|
In other words, they should contain a two-level nested directory structure,
|
|
|
|
where the module's group and name was deduced from the first and second level of
|
|
|
|
directories. For example: if $DOOMDIR/modules/ is an entry, a
|
|
|
|
$DOOMDIR/modules/lang/ruby/ directory represents a ':lang ruby' module.")
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-24 10:45:50 +02:00
|
|
|
;;; Module file variables
|
|
|
|
(defvar doom-module-init-file "init.el"
|
|
|
|
"The filename for module early initialization config files.
|
2020-05-25 03:09:46 -04:00
|
|
|
|
|
|
|
Init files are loaded early, just after Doom core, and before modules' config
|
|
|
|
files. They are always loaded, even in non-interactive sessions, and before
|
2022-09-14 14:48:21 +02:00
|
|
|
`doom-before-modules-init-hook'. Related to `doom-module-config-file'.")
|
2020-05-25 03:09:46 -04:00
|
|
|
|
2022-09-24 10:45:50 +02:00
|
|
|
(defvar doom-module-config-file "config.el"
|
|
|
|
"The filename for module configuration files.
|
2020-05-25 03:09:46 -04:00
|
|
|
|
|
|
|
Config files are loaded later, and almost always in interactive sessions. These
|
2022-09-24 10:45:50 +02:00
|
|
|
run before `doom-after-modules-config-hook' and after `doom-module-init-file'.")
|
|
|
|
|
|
|
|
(defvar doom-module-packages-file "packages.el"
|
|
|
|
"The filename for the package configuration file.
|
|
|
|
|
|
|
|
Package files are read whenever Doom's package manager wants a manifest of all
|
|
|
|
desired packages. They are rarely read in interactive sessions (unless the user
|
|
|
|
uses a straight or package.el command directly).")
|
|
|
|
|
|
|
|
(defvar doom-module-metadata-file ".doommodule"
|
|
|
|
"The filename for a module's metadata file.
|
|
|
|
|
|
|
|
NOT IMPLEMENTED YET. This file contains a module's metadata: their version,
|
|
|
|
maintainers, checks, features, submodules, debug information, etc. And are used
|
|
|
|
to locate modules in the user's file tree.")
|
2020-05-25 03:09:46 -04:00
|
|
|
|
2024-02-04 17:55:07 -05:00
|
|
|
;; DEPRECATED: Module warnings will be rewritten in v3, and this variable will no longer be needed.
|
|
|
|
(make-obsolete-variable 'doom-obsolete-modules nil "3.0.0")
|
2018-06-15 13:10:00 +02:00
|
|
|
(defconst doom-obsolete-modules
|
2020-05-25 21:51:35 -04:00
|
|
|
'((:feature (version-control (:emacs vc) (:ui vc-gutter))
|
|
|
|
(spellcheck (:checkers spell))
|
|
|
|
(syntax-checker (:checkers syntax))
|
|
|
|
(evil (:editor evil))
|
|
|
|
(snippets (:editor snippets))
|
|
|
|
(file-templates (:editor file-templates))
|
|
|
|
(workspaces (:ui workspaces))
|
|
|
|
(eval (:tools eval))
|
|
|
|
(lookup (:tools lookup))
|
|
|
|
(debugger (:tools debugger)))
|
|
|
|
(:tools (rotate-text (:editor rotate-text))
|
|
|
|
(vterm (:term vterm))
|
|
|
|
(password-store (:tools pass))
|
|
|
|
(flycheck (:checkers syntax))
|
2020-08-20 02:10:25 -04:00
|
|
|
(flyspell (:checkers spell))
|
|
|
|
(macos (:os macos)))
|
2020-05-25 21:51:35 -04:00
|
|
|
(:emacs (electric-indent (:emacs electric))
|
|
|
|
(hideshow (:editor fold))
|
|
|
|
(eshell (:term eshell))
|
|
|
|
(term (:term term)))
|
|
|
|
(:ui (doom-modeline (:ui modeline))
|
|
|
|
(fci (:ui fill-column))
|
|
|
|
(evil-goggles (:ui ophints))
|
2020-08-12 18:52:14 -04:00
|
|
|
(tabbar (:ui tabs))
|
|
|
|
(pretty-code (:ui ligatures)))
|
2020-05-25 21:51:35 -04:00
|
|
|
(:app (email (:email mu4e))
|
2020-06-05 21:01:23 +02:00
|
|
|
(notmuch (:email notmuch)))
|
2020-06-05 15:22:32 -04:00
|
|
|
(:lang (perl (:lang raku))))
|
2019-04-21 19:59:44 -04:00
|
|
|
"A tree alist that maps deprecated modules to their replacement(s).
|
2018-06-15 13:05:40 +02:00
|
|
|
|
2019-04-21 19:59:44 -04:00
|
|
|
Each entry is a three-level tree. For example:
|
2018-06-15 13:05:40 +02:00
|
|
|
|
2019-04-21 19:59:44 -04:00
|
|
|
(:feature (version-control (:emacs vc) (:ui vc-gutter))
|
2020-01-14 03:04:26 -05:00
|
|
|
(spellcheck (:checkers spell))
|
2019-04-21 19:59:44 -04:00
|
|
|
(syntax-checker (:tools flycheck)))
|
|
|
|
|
|
|
|
This marks :feature version-control, :feature spellcheck and :feature
|
|
|
|
syntax-checker modules obsolete. e.g. If :feature version-control is found in
|
|
|
|
your `doom!' block, a warning is emitted before replacing it with :emacs vc and
|
|
|
|
:ui vc-gutter.")
|
2018-06-15 13:05:40 +02:00
|
|
|
|
2024-02-04 17:55:07 -05:00
|
|
|
(make-obsolete-variable 'doom-inhibit-module-warnings nil "3.0.0")
|
2022-06-24 21:15:31 +02:00
|
|
|
(defvar doom-inhibit-module-warnings (not noninteractive)
|
2019-07-21 15:39:45 +02:00
|
|
|
"If non-nil, don't emit deprecated or missing module warnings at startup.")
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-03-07 19:39:45 -05:00
|
|
|
;;; Custom hooks
|
2022-09-14 14:48:21 +02:00
|
|
|
(defcustom doom-before-modules-init-hook nil
|
|
|
|
"Hooks run before module init.el files are loaded."
|
|
|
|
:group 'doom
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom doom-after-modules-init-hook nil
|
|
|
|
"Hooks run after module init.el files are loaded."
|
|
|
|
:group 'doom
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom doom-before-modules-config-hook nil
|
|
|
|
"Hooks run before module config.el files are loaded."
|
|
|
|
:group 'doom
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom doom-after-modules-config-hook nil
|
|
|
|
"Hooks run after module config.el files are loaded (but before the user's)."
|
|
|
|
:group 'doom
|
|
|
|
:type 'hook)
|
2019-03-07 19:39:45 -05:00
|
|
|
|
2022-09-24 20:34:13 +02:00
|
|
|
|
|
|
|
;;
|
|
|
|
;;; `doom-module-context'
|
|
|
|
|
2024-02-02 18:58:34 -05:00
|
|
|
(defvar doom-module--empty-context [nil nil nil nil nil nil nil])
|
2022-09-29 15:49:58 +02:00
|
|
|
|
|
|
|
(eval-and-compile
|
2024-02-02 18:58:34 -05:00
|
|
|
(put 'doom-module-context 'keys '(:index 0 :initdepth 1 :configdepth 2
|
|
|
|
:group 3 :name 4 :flags 5 :features 6)))
|
|
|
|
(defvar doom-module-context doom-module--empty-context
|
2022-09-24 20:34:13 +02:00
|
|
|
"A vector describing the module associated it with the active context.
|
|
|
|
|
2022-09-29 15:49:58 +02:00
|
|
|
Contains the following: [INDEX INITDEPTH CONFIGDEPTH :GROUP MODULE FLAGS FEATURES]
|
2022-09-24 20:34:13 +02:00
|
|
|
|
|
|
|
Do not directly set this variable, only let-bind it.")
|
|
|
|
|
|
|
|
;; DEPRECATED: Remove this when byte-compilation is introduced to Doom core.
|
2024-02-02 18:58:34 -05:00
|
|
|
(defmacro doom-module--context-field (field)
|
|
|
|
(plist-get (get 'doom-module-context 'keys) field))
|
2022-09-24 20:34:13 +02:00
|
|
|
|
|
|
|
(defun doom-module-context-get (field &optional context)
|
|
|
|
"Return the FIELD of CONTEXT.
|
|
|
|
|
2022-09-29 15:49:58 +02:00
|
|
|
FIELD should be one of `index', `initdepth', `configdepth', `group', `name',
|
|
|
|
`flags', or `features'. CONTEXT should be a `doom-module-context' vector. If
|
|
|
|
omitted, defaults to `doom-module-context'."
|
2024-02-02 18:58:34 -05:00
|
|
|
(aref (or context doom-module-context)
|
|
|
|
(plist-get (get 'doom-module-context 'keys)
|
|
|
|
field)))
|
2022-09-24 20:34:13 +02:00
|
|
|
|
|
|
|
(defun doom-module-context (group &optional name)
|
|
|
|
"Create a `doom-module-context' from a module by GROUP and NAME.
|
|
|
|
|
|
|
|
If NAME is omitted, GROUP is treated as a module key cons cell: (GROUP . NAME)."
|
|
|
|
(declare (side-effect-free t))
|
2022-09-29 15:49:58 +02:00
|
|
|
(let ((key (if name (cons group name) group)))
|
|
|
|
(or (get (or (car-safe key) key)
|
|
|
|
(cdr-safe key))
|
2024-02-02 18:58:34 -05:00
|
|
|
doom-module--empty-context)))
|
2022-09-24 20:34:13 +02:00
|
|
|
|
|
|
|
(defun doom-module-context-key (&optional context)
|
|
|
|
"Return the module of the active `doom-module-context' as a module key."
|
|
|
|
(declare (side-effect-free t))
|
|
|
|
(let ((context (or context doom-module-context)))
|
2024-02-02 18:58:34 -05:00
|
|
|
(cons (aref context (doom-module--context-field :group))
|
|
|
|
(aref context (doom-module--context-field :name)))))
|
2022-09-24 20:34:13 +02:00
|
|
|
|
|
|
|
(defmacro doom-module-context-with (module-key &rest body)
|
|
|
|
"Evaluate BODY with `doom-module-context' informed by MODULE-KEY."
|
|
|
|
(declare (indent 1))
|
|
|
|
`(let ((doom-module-context (doom-module-context ,module-key)))
|
|
|
|
(doom-log ":context:module: =%s" doom-module-context)
|
|
|
|
,@body))
|
2019-03-07 19:39:45 -05:00
|
|
|
|
|
|
|
|
2018-06-11 23:18:15 +02:00
|
|
|
;;
|
2019-03-07 23:21:58 -05:00
|
|
|
;;; Module API
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-07-07 14:07:11 +02:00
|
|
|
(defun doom-module-p (category module &optional flag)
|
2018-06-11 23:18:15 +02:00
|
|
|
"Returns t if CATEGORY MODULE is enabled (ie. present in `doom-modules')."
|
2018-06-24 19:54:50 +02:00
|
|
|
(declare (pure t) (side-effect-free t))
|
2020-01-05 19:58:59 -05:00
|
|
|
(when-let (plist (gethash (cons category module) doom-modules))
|
|
|
|
(or (null flag)
|
|
|
|
(and (memq flag (plist-get plist :flags))
|
|
|
|
t))))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
(defun doom-module-depth (category module &optional initdepth?)
|
|
|
|
"Return the depth of CATEGORY MODULE.
|
|
|
|
|
|
|
|
If INITDEPTH? is non-nil, use the CAR if a module was given two depths (see
|
|
|
|
`doom-module-set')."
|
|
|
|
(if-let (depth (doom-module-get category module :depth))
|
|
|
|
(or (if initdepth?
|
|
|
|
(car-safe depth)
|
|
|
|
(cdr-safe depth))
|
|
|
|
depth)
|
|
|
|
0))
|
|
|
|
|
2018-06-11 23:18:15 +02:00
|
|
|
(defun doom-module-get (category module &optional property)
|
|
|
|
"Returns the plist for CATEGORY MODULE. Gets PROPERTY, specifically, if set."
|
2018-06-24 19:54:50 +02:00
|
|
|
(declare (pure t) (side-effect-free t))
|
2019-06-25 21:38:16 +02:00
|
|
|
(when-let (plist (gethash (cons category module) doom-modules))
|
2018-06-11 23:18:15 +02:00
|
|
|
(if property
|
|
|
|
(plist-get plist property)
|
|
|
|
plist)))
|
|
|
|
|
2018-09-25 23:52:20 -04:00
|
|
|
(defun doom-module-put (category module &rest plist)
|
2018-06-11 23:18:15 +02:00
|
|
|
"Set a PROPERTY for CATEGORY MODULE to VALUE. PLIST should be additional pairs
|
2018-09-25 23:52:20 -04:00
|
|
|
of PROPERTY and VALUEs.
|
|
|
|
|
|
|
|
\(fn CATEGORY MODULE PROPERTY VALUE &rest [PROPERTY VALUE [...]])"
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(puthash (cons category module)
|
|
|
|
(if-let (old-plist (doom-module-get category module))
|
|
|
|
(if (null plist)
|
|
|
|
old-plist
|
|
|
|
(when (cl-oddp (length plist))
|
|
|
|
(signal 'wrong-number-of-arguments (list (length plist))))
|
|
|
|
(while plist
|
|
|
|
(plist-put old-plist (pop plist) (pop plist)))
|
|
|
|
old-plist)
|
|
|
|
plist)
|
|
|
|
doom-modules))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
|
|
|
(defun doom-module-set (category module &rest plist)
|
|
|
|
"Enables a module by adding it to `doom-modules'.
|
|
|
|
|
|
|
|
CATEGORY is a keyword, module is a symbol, PLIST is a plist that accepts the
|
|
|
|
following properties:
|
|
|
|
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
:path STRING
|
|
|
|
Path to the directory where this module lives.
|
|
|
|
:depth INT|(INITDEPTH . CONFIGDEPTH)
|
|
|
|
Determines module load order. If a cons cell, INITDEPTH determines the load
|
|
|
|
order of the module's init.el, while CONFIGDEPTH determines the same for all
|
|
|
|
other config files (config.el, packages.el, doctor.el, etc).
|
|
|
|
:flags (SYMBOL...)
|
|
|
|
A list of activated flags for this module.
|
|
|
|
:features (SYMBOL...)
|
|
|
|
A list of active features, determined from module's metadata. NOT
|
|
|
|
IMPLEMENTED YET.
|
|
|
|
|
|
|
|
If PLIST consists of a single nil, the module is purged from memory instead."
|
2022-09-13 00:07:27 +02:00
|
|
|
(if (car plist)
|
2022-09-29 15:49:58 +02:00
|
|
|
(let* ((depth (ensure-list (or (plist-get plist :depth) 0)))
|
|
|
|
(idepth (or (cdr depth) (car depth)))
|
|
|
|
(cdepth (car depth))
|
|
|
|
(idx (hash-table-count doom-modules)))
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
;; PERF: Doom caches module index, flags, and features in symbol plists
|
|
|
|
;; for fast lookups in `modulep!' and elsewhere. plists are lighter
|
|
|
|
;; and faster than hash tables for datasets this size, and this
|
2022-09-29 15:49:58 +02:00
|
|
|
;; information is looked up *very* often. The structure of this cache
|
|
|
|
;; should match `doom-module-context's.
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
(put category module
|
2022-09-29 15:49:58 +02:00
|
|
|
(vector idx idepth cdepth
|
|
|
|
category module
|
|
|
|
(plist-get plist :flags)
|
|
|
|
(plist-get plist :features)))
|
|
|
|
;; The hash table will always been Doom's formal storage for
|
|
|
|
;; modules.
|
2022-09-13 00:07:27 +02:00
|
|
|
(puthash (cons category module) plist doom-modules))
|
|
|
|
(remhash (cons category module) doom-modules)
|
|
|
|
(cl-remf (symbol-plist category) module)))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
(defun doom-module-list (&optional paths-or-all initorder?)
|
|
|
|
"Return a list of (:group . name) module keys in order of their :depth.
|
|
|
|
|
|
|
|
PATHS-OR-ALL can either be a non-nil value or a list of directories. If given a
|
|
|
|
list of directories, return a list of module keys for all modules present
|
2024-02-05 03:33:22 -05:00
|
|
|
underneath it. If non-nil, return the same, but search `doom-module-load-path'
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
(includes :core and :user). Modules that are enabled are sorted first by their
|
|
|
|
:depth, followed by disabled modules in lexicographical order (unless a :depth
|
|
|
|
is specified in their .doommodule).
|
|
|
|
|
|
|
|
If INITORDER? is non-nil, sort modules by their initdepth, rather than their
|
|
|
|
configdepth. See `doom-module-set' for details."
|
|
|
|
(sort (if paths-or-all
|
|
|
|
(delete-dups
|
|
|
|
(append (seq-remove #'cdr (doom-module-list nil initorder?))
|
|
|
|
(doom-files-in (if (listp paths-or-all)
|
|
|
|
paths-or-all
|
2024-02-05 03:33:22 -05:00
|
|
|
doom-modules-load-path)
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
:map #'doom-module-from-path
|
|
|
|
:type 'dirs
|
|
|
|
:mindepth 1
|
|
|
|
:depth 1)))
|
|
|
|
(hash-table-keys doom-modules))
|
2022-09-29 15:49:58 +02:00
|
|
|
(let ((idx (if initorder? 1 2)))
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
(lambda! ((groupa . namea) (groupb . nameb))
|
|
|
|
(let ((a (get groupa namea))
|
|
|
|
(b (get groupb nameb)))
|
|
|
|
(or (null b)
|
2022-09-29 15:49:58 +02:00
|
|
|
(and
|
|
|
|
a (let ((adepth (aref a idx))
|
|
|
|
(bdepth (aref b idx)))
|
|
|
|
(if (= adepth bdepth)
|
|
|
|
(< (aref a 0) (aref b 0))
|
|
|
|
(< adepth bdepth))))))))))
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
|
2022-09-12 22:41:09 +02:00
|
|
|
(defun doom-module-expand-path (category module &optional file)
|
|
|
|
"Expands a path to FILE relative to CATEGORY and MODULE.
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-12 22:41:09 +02:00
|
|
|
CATEGORY is a keyword. MODULE is a symbol. FILE is an optional string path.
|
|
|
|
If the category isn't enabled this returns nil. For finding disabled modules use
|
|
|
|
`doom-module-locate-path'."
|
|
|
|
(when-let (path (doom-module-get category module :path))
|
2019-07-21 15:39:45 +02:00
|
|
|
(if file
|
2022-09-12 22:41:09 +02:00
|
|
|
(file-name-concat path file)
|
2018-06-11 23:18:15 +02:00
|
|
|
path)))
|
|
|
|
|
|
|
|
(defun doom-module-locate-path (category &optional module file)
|
2024-02-05 03:33:22 -05:00
|
|
|
"Searches `doom-module-load-path' to find the path to a module.
|
2018-06-11 23:18:15 +02:00
|
|
|
|
|
|
|
CATEGORY is a keyword (e.g. :lang) and MODULE is a symbol (e.g. 'python). FILE
|
|
|
|
is a string that will be appended to the resulting path. If no path exists, this
|
2022-09-12 22:41:09 +02:00
|
|
|
returns nil, otherwise an absolute path."
|
|
|
|
(let (file-name-handler-alist)
|
|
|
|
(if-let (path (doom-module-expand-path category module file))
|
|
|
|
(if (or (null file)
|
|
|
|
(file-exists-p path))
|
|
|
|
path)
|
|
|
|
(let* ((category (doom-keyword-name category))
|
|
|
|
(module (if module (symbol-name module)))
|
|
|
|
(path (file-name-concat category module file)))
|
|
|
|
(if file
|
|
|
|
;; PERF: locate-file-internal is a little faster for finding files,
|
|
|
|
;; but its interface for finding directories is clumsy.
|
2024-02-05 03:33:22 -05:00
|
|
|
(locate-file-internal path doom-module-load-path '("" ".elc" ".el"))
|
|
|
|
(cl-loop for default-directory in doom-module-load-path
|
2022-09-12 22:41:09 +02:00
|
|
|
if (file-exists-p path)
|
|
|
|
return (expand-file-name path)))))))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-23 17:59:57 +02:00
|
|
|
(defun doom-module-locate-paths (module-list file)
|
|
|
|
"Return all existing paths to FILE under each module in MODULE-LIST.
|
|
|
|
|
|
|
|
MODULE-LIST is a list of cons cells (GROUP . NAME). See `doom-module-list' for
|
|
|
|
an example."
|
2024-02-05 15:22:31 -05:00
|
|
|
(cl-loop for (group . name) in (or module-list (doom-module-list))
|
2022-09-23 17:59:57 +02:00
|
|
|
if (doom-module-locate-path group name file)
|
|
|
|
collect it))
|
|
|
|
|
2022-09-12 20:26:43 +02:00
|
|
|
(defun doom-module-from-path (path &optional enabled-only)
|
2019-07-21 15:39:45 +02:00
|
|
|
"Returns a cons cell (CATEGORY . MODULE) derived from PATH (a file path).
|
|
|
|
If ENABLED-ONLY, return nil if the containing module isn't enabled."
|
2022-09-12 20:26:43 +02:00
|
|
|
(let* ((file-name-handler-alist nil)
|
|
|
|
(path (expand-file-name path)))
|
|
|
|
(save-match-data
|
|
|
|
(cond ((string-match "/modules/\\([^/]+\\)/\\([^/]+\\)\\(?:/.*\\)?$" path)
|
|
|
|
(when-let* ((category (doom-keyword-intern (match-string 1 path)))
|
|
|
|
(module (intern (match-string 2 path))))
|
|
|
|
(and (or (null enabled-only)
|
|
|
|
(doom-module-p category module))
|
|
|
|
(cons category module))))
|
|
|
|
((file-in-directory-p path doom-core-dir)
|
|
|
|
(cons :core nil))
|
|
|
|
((file-in-directory-p path doom-user-dir)
|
|
|
|
(cons :user nil))))))
|
2019-07-21 15:39:45 +02:00
|
|
|
|
2024-02-02 18:54:14 -05:00
|
|
|
(defun doom-module-load-path (&optional module-load-path)
|
2019-07-21 15:39:45 +02:00
|
|
|
"Return a list of file paths to activated modules.
|
|
|
|
|
|
|
|
The list is in no particular order and its file paths are absolute. If
|
|
|
|
MODULE-DIRS is non-nil, include all modules (even disabled ones) available in
|
2022-09-13 00:28:28 +02:00
|
|
|
those directories."
|
2018-06-24 19:54:50 +02:00
|
|
|
(declare (pure t) (side-effect-free t))
|
2024-02-02 18:54:14 -05:00
|
|
|
(cl-loop with module-load-path = (or module-load-path doom-module-load-path)
|
|
|
|
for (cat . mod) in (doom-module-list module-load-path)
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
collect (doom-module-locate-path cat mod)))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2020-05-25 21:51:35 -04:00
|
|
|
(defun doom-module-mplist-map (fn mplist)
|
|
|
|
"Apply FN to each module in MPLIST."
|
|
|
|
(let ((mplist (copy-sequence mplist))
|
|
|
|
(inhibit-message doom-inhibit-module-warnings)
|
|
|
|
obsolete
|
|
|
|
results
|
|
|
|
category m)
|
|
|
|
(while mplist
|
|
|
|
(setq m (pop mplist))
|
|
|
|
(cond ((keywordp m)
|
|
|
|
(setq category m
|
|
|
|
obsolete (assq m doom-obsolete-modules)))
|
|
|
|
((null category)
|
|
|
|
(error "No module category specified for %s" m))
|
|
|
|
((and (listp m) (keywordp (car m)))
|
|
|
|
(pcase (car m)
|
|
|
|
(:cond
|
|
|
|
(cl-loop for (cond . mods) in (cdr m)
|
|
|
|
if (eval cond t)
|
|
|
|
return (prependq! mplist mods)))
|
|
|
|
(:if (if (eval (cadr m) t)
|
|
|
|
(push (caddr m) mplist)
|
|
|
|
(prependq! mplist (cdddr m))))
|
2021-01-29 23:07:03 +01:00
|
|
|
(test (if (xor (eval (cadr m) t)
|
|
|
|
(eq test :unless))
|
2020-05-25 21:51:35 -04:00
|
|
|
(prependq! mplist (cddr m))))))
|
|
|
|
((catch 'doom-modules
|
|
|
|
(let* ((module (if (listp m) (car m) m))
|
|
|
|
(flags (if (listp m) (cdr m))))
|
|
|
|
(when-let (new (assq module obsolete))
|
|
|
|
(let ((newkeys (cdr new)))
|
|
|
|
(if (null newkeys)
|
2022-09-16 00:03:36 +02:00
|
|
|
(print! (warn "%s module was removed"))
|
2020-05-25 21:51:35 -04:00
|
|
|
(if (cdr newkeys)
|
2022-09-16 00:03:36 +02:00
|
|
|
(print! (warn "%s module was removed and split into the %s modules")
|
|
|
|
(list category module)
|
|
|
|
(mapconcat #'prin1-to-string newkeys ", "))
|
|
|
|
(print! (warn "%s module was moved to %s")
|
|
|
|
(list category module)
|
|
|
|
(car newkeys)))
|
2020-05-25 21:51:35 -04:00
|
|
|
(push category mplist)
|
|
|
|
(dolist (key newkeys)
|
|
|
|
(push (if flags
|
|
|
|
(nconc (cdr key) flags)
|
|
|
|
(cdr key))
|
|
|
|
mplist)
|
|
|
|
(push (car key) mplist))
|
|
|
|
(throw 'doom-modules t))))
|
2022-09-15 23:37:04 +02:00
|
|
|
(push (funcall fn category module :flags (if (listp m) (cdr m)))
|
|
|
|
results))))))
|
2022-06-24 21:15:31 +02:00
|
|
|
(when noninteractive
|
2020-05-25 21:51:35 -04:00
|
|
|
(setq doom-inhibit-module-warnings t))
|
|
|
|
(nreverse results)))
|
|
|
|
|
2018-06-11 23:18:15 +02:00
|
|
|
|
|
|
|
;;
|
2019-03-07 23:21:58 -05:00
|
|
|
;;; Module config macros
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-07-26 12:05:13 +02:00
|
|
|
(put :if 'lisp-indent-function 2)
|
|
|
|
(put :when 'lisp-indent-function 'defun)
|
|
|
|
(put :unless 'lisp-indent-function 'defun)
|
|
|
|
|
2018-06-11 23:18:15 +02:00
|
|
|
(defmacro doom! (&rest modules)
|
|
|
|
"Bootstraps DOOM Emacs and its modules.
|
|
|
|
|
2019-12-02 16:07:25 -05:00
|
|
|
If the first item in MODULES doesn't satisfy `keywordp', MODULES is evaluated,
|
|
|
|
otherwise, MODULES is a multiple-property list (a plist where each key can have
|
|
|
|
multiple, linear values).
|
|
|
|
|
2018-06-11 23:18:15 +02:00
|
|
|
The bootstrap process involves making sure the essential directories exist, core
|
2020-08-24 00:36:52 -04:00
|
|
|
packages are installed, `doom-autoloads-file' is loaded, `doom-packages-file'
|
2018-06-11 23:18:15 +02:00
|
|
|
cache exists (and is loaded) and, finally, loads your private init.el (which
|
|
|
|
should contain your `doom!' block).
|
|
|
|
|
|
|
|
Module load order is determined by your `doom!' block. See `doom-modules-dirs'
|
|
|
|
for a list of all recognized module trees. Order defines precedence (from most
|
|
|
|
to least)."
|
2022-06-24 21:15:31 +02:00
|
|
|
`(when noninteractive
|
2020-05-25 21:51:35 -04:00
|
|
|
(doom-module-mplist-map
|
|
|
|
(lambda (category module &rest plist)
|
2022-09-15 23:37:04 +02:00
|
|
|
(let ((path (doom-module-locate-path category module)))
|
|
|
|
(unless path
|
|
|
|
(print! (warn "Failed to locate a '%s %s' module") category module))
|
|
|
|
(apply #'doom-module-set category module
|
|
|
|
:path path
|
|
|
|
plist)))
|
2020-05-25 21:51:35 -04:00
|
|
|
,@(if (keywordp (car modules))
|
|
|
|
(list (list 'quote modules))
|
|
|
|
modules))
|
|
|
|
doom-modules))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-08-12 20:29:19 +02:00
|
|
|
;; DEPRECATED Remove in 3.0
|
|
|
|
(define-obsolete-function-alias 'featurep! 'modulep! "3.0.0")
|
|
|
|
|
|
|
|
(defmacro modulep! (category &optional module flag)
|
2022-09-15 23:29:37 +02:00
|
|
|
"Return t if :CATEGORY MODULE (and +FLAGS) are enabled.
|
2019-04-20 02:17:51 -04:00
|
|
|
|
|
|
|
If FLAG is provided, returns t if CATEGORY MODULE has FLAG enabled.
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-15 23:29:37 +02:00
|
|
|
(modulep! :config default +flag)
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-15 23:29:37 +02:00
|
|
|
CATEGORY and MODULE may be omitted when this macro is used from a Doom module's
|
|
|
|
source (except your DOOMDIR, which is a special module). Like so:
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-15 23:29:37 +02:00
|
|
|
(modulep! +flag)
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-15 23:29:37 +02:00
|
|
|
For more about modules and flags, see `doom!'."
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
;; PERF: This macro bypasses the module API to spare startup their runtime
|
|
|
|
;; cost, as `modulep!' gets called *a lot* during startup. In the future,
|
|
|
|
;; Doom will byte-compile its core files. At that time, we can use it again.
|
2024-02-02 18:58:34 -05:00
|
|
|
(and (cond (flag (memq flag (aref (or (get category module) doom-module--empty-context)
|
|
|
|
(doom-module--context-field :flags))))
|
2022-09-12 23:44:04 +02:00
|
|
|
(module (get category module))
|
2022-09-29 15:49:58 +02:00
|
|
|
((aref doom-module-context 0)
|
|
|
|
(memq category (aref doom-module-context
|
2024-02-02 18:58:34 -05:00
|
|
|
(doom-module--context-field :flags))))
|
2022-09-24 20:34:13 +02:00
|
|
|
((let ((file
|
|
|
|
;; This must be expanded at the call site, not in
|
|
|
|
;; `modulep!'s definition, to get the file we want.
|
|
|
|
(macroexpand '(file!))))
|
|
|
|
(if-let (module (doom-module-from-path file))
|
|
|
|
(memq category (aref (or (get (car module) (cdr module))
|
2024-02-02 18:58:34 -05:00
|
|
|
doom-module--empty-context)
|
|
|
|
(doom-module--context-field :flags)))
|
2022-09-24 20:34:13 +02:00
|
|
|
(error "(modulep! %s %s %s) couldn't figure out what module it was called from (in %s)"
|
|
|
|
category module flag file)))))
|
2018-07-29 02:46:18 +02:00
|
|
|
t))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2022-09-13 00:28:28 +02:00
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Defaults
|
|
|
|
|
|
|
|
;; Register Doom's two virtual module categories, representing Doom's core and
|
|
|
|
;; the user's config; which are always enabled.
|
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.
This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd73c, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.
Other notable changes:
- Changes the data structure for module data caches from a list to a
vector. Uses less memory and permits faster lookups. Also adds two
depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
loading doom-*.el.
Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd73c
2022-09-23 18:55:20 +02:00
|
|
|
(doom-module-set :core nil :path doom-core-dir :depth -110)
|
|
|
|
(doom-module-set :user nil :path doom-user-dir :depth '(-105 . 105))
|
2022-09-13 00:28:28 +02:00
|
|
|
|
2022-09-23 20:17:10 +02:00
|
|
|
;; DEPRECATED: I intend to phase out our internal usage of `use-package' and
|
|
|
|
;; move it to a :config use-package module. The macro is far too complex and
|
|
|
|
;; magical for our needs, but until this move is done, ':config use-package'
|
|
|
|
;; will remain a hardcoded module for backwards compatibility.
|
|
|
|
(doom-module-set :config 'use-package
|
|
|
|
:path (doom-module-locate-path :config 'use-package)
|
|
|
|
:depth -111)
|
|
|
|
|
2022-07-30 21:49:00 +02:00
|
|
|
(provide 'doom-modules)
|
|
|
|
;;; doom-modules.el ends here
|