doom/install: refactor template insertion & module init
This commit is contained in:
parent
5909b183c6
commit
e60d8f9cb1
1 changed files with 6 additions and 22 deletions
|
@ -36,36 +36,20 @@ DOOMDIR environment variable. e.g.
|
|||
|
||||
;; Create init.el, config.el & packages.el
|
||||
(mapc (lambda (file)
|
||||
(cl-destructuring-bind (filename . fn) file
|
||||
(cl-destructuring-bind (filename . template) file
|
||||
(if (file-exists-p! filename doom-private-dir)
|
||||
(print! (warn "%s already exists, skipping") filename)
|
||||
(print! (info "Creating %s%s") (relpath doom-private-dir) filename)
|
||||
(with-temp-file (doom-path doom-private-dir filename)
|
||||
(funcall fn))
|
||||
(insert-file-contents template))
|
||||
(print! (success "Done!")))))
|
||||
'(("init.el" .
|
||||
(lambda ()
|
||||
(insert-file-contents
|
||||
(doom-path doom-emacs-dir "init.example.el"))))
|
||||
("config.el" .
|
||||
(lambda ()
|
||||
(insert-file-contents
|
||||
(doom-path doom-core-dir "templates/config.example.el"))))
|
||||
("packages.el" .
|
||||
(lambda ()
|
||||
(insert-file-contents
|
||||
(doom-path doom-core-dir "templates/packages.example.el")))))))
|
||||
`(("init.el" . ,(doom-path doom-emacs-dir "init.example.el"))
|
||||
("config.el" . ,(doom-path doom-core-dir "templates/config.example.el"))
|
||||
("packages.el" . ,(doom-path doom-core-dir "templates/packages.example.el")))))
|
||||
|
||||
;; In case no init.el was present the first time `doom-initialize-modules' was
|
||||
;; called in core.el (e.g. on first install)
|
||||
(ignore-errors
|
||||
(load! "init" doom-private-dir t))
|
||||
(when doom-modules
|
||||
(maphash (lambda (key plist)
|
||||
(let ((doom--current-module key)
|
||||
(doom--current-flags (plist-get plist :flags)))
|
||||
(ignore-errors (load! "init" (plist-get plist :path) t))))
|
||||
doom-modules))
|
||||
(doom-initialize-modules 'force 'no-config)
|
||||
|
||||
;; Ask if user would like an envvar file generated
|
||||
(if noenv-p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue