doomemacs/lisp/cli
Henrik Lissner 15904349cf
refactor!: module API
BREAKING CHANGE: This backports some architectural choices from v3.0.
This changes Doom's module API, renaming some functions and removing
others, in order to facilitate some new features, prepare to move Doom's
modules into separate repos, and make way for two, much larger breaking
commits coming in the next few days.

This commit won't break anything for users unless they're tinkering with
Doom's internals/using its `doom-module-*` API directly. I am avoiding
broader backwards incompatibilities until the 3.0 release.

What's new:

- Negated flags. (modulep! :editor evil -everywhere) will return non-nil
  if :editor evil is active without its +everywhere flag.
- `modulep!` now takes multiple flags to simplify AND checks. E.g.

    (and (modulep! +foo)
         (modulep! +bar)
         (not (modulep! +baz)))

  Can now be expressed with:

    (modulep! +foo +bar -baz)
- Adds pcase matchers for `doom-module-context` and `doom-module`
  structs, making the following destructuring binds possible:

    (pcase-dolist ((doom-module group name flags features)
                   (hash-table-values doom-modules))
      ...)

  This will be used more in v3.0.
- Adds file cookie support to module init.el and config.el files.

Here's a summary of breaking changes made in this commit:

- `doom-module-context` was changed from a vector to a struct (record).
- `doom-modules` is now a table of `doom-module` structs, rather than
  free-form plists.
- The following macros have been renamed:
  - `doom-context-with` -> `with-doom-context`
  - `doom-module-context-with` -> `with-doom-module`
- The followings functions have been replaced/removed:
  - `doom-module-context`+`doom-module-context-get` -> `doom-module`
  - `doom-module-set` -> `doom-module--put`
  - `doom-module-p` -> `doom-module-active-p`
  - `doom-module-context-key` (is now a getter with the same name)
  - `doom-module-put` (removed)
  - `doom-module--context-field` (removed)
- The signatures for these functions have changed:
  - `doom-module-get CATEGORY &optional MODULE PROP` ->
    `doom-module-get (GROUP . MODULE) &optional PROP`
  - `doom-module-locate-path CATEGORY &optional MODULE FILE` ->
    `doom-module-locate-path (GROUP . MODULE) &optional FILE`
  - `doom-module-expand-path CATEGORY MODULE &optional FILE` ->
    `doom-module-expand-path (GROUP . MODULE) &optional FILE`
- Adds the following functions
  - `doom-module-exists-p`
  - `doom-module-key`
  - `doom-module->context`
  - `doom-module<-context`
- Removes the following variables
  - `doom-module--empty-context`

This commit results in a little redundancy, which I will address in
parts 2/3 and/or v3.0.
2024-10-20 02:41:42 -04:00
..
make refactor!: restructure Doom core 2022-07-30 22:41:13 +02:00
ci.el docs(cli): doom install: reformat output 2024-09-04 15:04:32 -04:00
doctor.el refactor!: module API 2024-10-20 02:41:42 -04:00
env.el fix(cli): doom env: blacklist $WAYLAND_DISPLAY 2024-08-23 02:50:19 -04:00
info.el refactor!: restructure Doom core 2022-07-30 22:41:13 +02:00
install.el fix(cli): doom install: load $DOOMDIR/cli.el too 2024-09-04 15:04:32 -04:00
make.el dev: format CODEOWNERS with more whitespace 2024-07-01 03:35:35 -04:00
packages.el docs(cli): doom gc: corrections 2024-09-03 04:04:29 -04:00
profiles.el feat(cli): introduce DOOMPROFILELOAD{FILE,PATH} envvars 2022-09-18 00:28:13 +02:00
run.el fix(cli): doom run: symlinks to XDG dirs beyond $HOME 2024-09-11 20:08:16 -04:00
sync.el fix(cli): wrong-number-of-args error from mapconcat 2024-08-30 04:57:29 -04:00
test.el refactor!(cli): rename cli definers for consistency 2022-09-12 11:45:59 +02:00
upgrade.el feat(cli): add --aot option 2024-08-08 17:26:54 -04:00