refactor(profiles): bootstrap script

- Swap out the funcall+alist lookup for a pcase (which is expanded to a
  cond, which is is faster and easier to read).
- Wrap bootstrap file to $EMACSDIR/profiles/init.el, but byte-compile it
  to $EMACSDIR/profiles/init.X.el where X is emacs-major-version.
- Make doom-profiles-save's second argument optional (defaults to
  doom-profiles-bootstrap-file).
- Make doom-profiles-save throw a error if byte-compilation fails for
  some reason.
- Rename the tempvars to include 'doom' in their name, so debuggers know
  where they originate.
This commit is contained in:
Henrik Lissner 2022-09-17 20:21:43 +02:00
parent 09d24cd68a
commit 6dffa09c71
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 89 additions and 87 deletions

View file

@ -70,8 +70,8 @@
(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 doom-profiles-bootstrap-file)
(print! (success "Regenerated profile init file: %s")
(doom-profiles-save new-profiles)
(print! (success "Regenerated profile bootstrapper: %s")
(path doom-profiles-bootstrap-file)))))))))