feat(cli): introduce DOOMPROFILELOAD{FILE,PATH} envvars

- Adds $DOOMPROFILELOADFILE: Controls where to read and write the
  profile loader. Changing this may be helpful for users on nix/guix,
  who have deployed Doom to a read-only location. This sets
  `doom-profile-load-file`.
- Changed profile load file's default location (used to be
  $EMACSDIR/profiles/init.el, is now $EMACSDIR/profiles/load.el). The
  gitignore was updated to reflect this.
- Adds $DOOMPROFILELOADPATH: A colon-delimited list of profile config
  files and directories (semi-colon on Windows) which dictate what Doom
  reads in order to discover your profiles. Config files are required to
  have an *.el extension. This sets `doom-profile-load-path`.
- Changes the nomenclature around this loader script. I used to refer to
  it as the profile bootstrapper. I'll now refer to it as the profile
  load file, and I've renamed `doom-profiles-bootstrap-file` to
  `doom-profile-load-file` to reflect this.
- The variables `doom-profile-dirs` and `doom-profile-config-files` were
  merged into doom-profile-load-path.
- Both envvars have also been documented in `doom help` (and
  $DOOMPROFILE's has been updated).

Ref: #6794
This commit is contained in:
Henrik Lissner 2022-09-17 22:02:50 +02:00
parent 7fc0cbff5e
commit f99cf0ccc8
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
5 changed files with 76 additions and 51 deletions

View file

@ -38,17 +38,16 @@
:benchmark t
(let* ((old-profiles (doom-profiles-read doom-cli-known-profiles-file))
(new-profiles (doom-profiles-autodetect))
(init-file doom-profiles-bootstrap-file)
(version (doom-file-read init-file :by 'read :noerror t))
(load-file doom-profile-load-file)
(version (doom-file-read load-file :by 'read :noerror t))
(recreate? (or (not reload?) (doom-profiles-outdated-p))))
(unless (file-exists-p init-file)
(print! (warn "No profile manifest found. Generating one..."))
(unless (file-exists-p load-file)
(print! (warn "No profile loader found. Generating one..."))
(print-group! (print! (start "Regenerating it...")))
(setq recreate? t))
(unless (equal (or version doom-version) doom-version)
(print! (warn "Detected version mismatch in profile manifest (%s != %s)"
version
doom-version))
(print! (warn "Detected version mismatch in profile loader (%s != %s)"
version doom-version))
(print! (start "Generating profile manifest..."))
(setq recreate? t))
(print-group!
@ -70,9 +69,9 @@
(dolist (p removed) (print! (item "Removed %S") (car p)))
(dolist (p changed) (print! (item "Changed %S") (car p)))
(doom-file-write doom-cli-known-profiles-file (list new-profiles) :mode #o600)
(doom-profiles-save new-profiles)
(print! (success "Regenerated profile bootstrapper: %s")
(path doom-profiles-bootstrap-file)))))))))
(doom-profiles-save new-profiles load-file)
(print! (success "Regenerated profile loader: %s")
(path load-file)))))))))
;;