refactor: use doom-module-*-file variables; add two
- Adds doom-module-packages-file and doom-module-metadata-file. - Uses them and the other doom-module-*-file variables where they were previously hardcoded. - Add .el extension to doom-module-{init,config}-file; it is now the consumer's responsibility to strip/change/keep the extension as they see fit.
This commit is contained in:
parent
d33478dc79
commit
6c76b98dbb
12 changed files with 57 additions and 34 deletions
|
@ -180,7 +180,7 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
|||
(defun doom-compile--ignore-file-p (path)
|
||||
(let ((filename (file-name-nondirectory path)))
|
||||
(or (not (equal (file-name-extension path) "el"))
|
||||
(member filename (list "packages.el" "doctor.el"))
|
||||
(member filename (list doom-module-packages-file "doctor.el"))
|
||||
(string-prefix-p "." filename)
|
||||
(string-prefix-p "test-" filename)
|
||||
(string-prefix-p "flycheck_" filename)
|
||||
|
|
|
@ -245,7 +245,7 @@ in."
|
|||
(let ((doom--current-module key)
|
||||
(doom--current-flags (plist-get plist :flags))
|
||||
(doctor-file (doom-module-expand-path (car key) (cdr key) "doctor.el"))
|
||||
(packages-file (doom-module-expand-path (car key) (cdr key) "packages.el")))
|
||||
(packages-file (doom-module-expand-path (car key) (cdr key) doom-module-packages-file)))
|
||||
(cl-loop with doom-output-indent = 6
|
||||
for name in (let* (doom-packages
|
||||
doom-disabled-packages)
|
||||
|
|
|
@ -61,18 +61,26 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
|
|||
|
||||
;; Create init.el, config.el & packages.el
|
||||
(print-group!
|
||||
(mapc (lambda (file)
|
||||
(cl-destructuring-bind (filename . template) file
|
||||
(if (file-exists-p! filename doom-user-dir)
|
||||
(print! (item "Skipping %s (already exists)")
|
||||
(path filename))
|
||||
(print! (item "Creating %s%s") (relpath doom-user-dir) filename)
|
||||
(with-temp-file (doom-path doom-user-dir filename)
|
||||
(insert-file-contents template))
|
||||
(print! (success "Done!")))))
|
||||
`(("init.el" . ,(doom-path doom-emacs-dir "templates/init.example.el"))
|
||||
("config.el" . ,(doom-path doom-emacs-dir "templates/config.example.el"))
|
||||
("packages.el" . ,(doom-path doom-emacs-dir "templates/packages.example.el"))))))
|
||||
(mapc (lambda (file)
|
||||
(cl-destructuring-bind (filename . template) file
|
||||
(setq filenam)
|
||||
(if (file-exists-p! filename doom-user-dir)
|
||||
(print! (item "Skipping %s (already exists)")
|
||||
(path filename))
|
||||
(print! (item "Creating %s%s") (relpath doom-user-dir) filename)
|
||||
(with-temp-file (doom-path doom-user-dir filename)
|
||||
(insert-file-contents template))
|
||||
(print! (success "Done!")))))
|
||||
(let ((template-dir (doom-path doom-emacs-dir "templates")))
|
||||
`((,doom-module-init-file
|
||||
. ,(file-name-with-extension (doom-path template-dir doom-module-init-file)
|
||||
".example.el"))
|
||||
(,doom-module-config-file
|
||||
. ,(file-name-with-extension (doom-path template-dir doom-module-config-file)
|
||||
".example.el"))
|
||||
(,doom-module-packages-file
|
||||
. ,(file-name-with-extension (doom-path template-dir doom-module-packages-file)
|
||||
".example.el")))))))
|
||||
|
||||
;; In case no init.el was present the first time it was loaded.
|
||||
(doom-load (doom-path doom-user-dir doom-module-init-file) t)
|
||||
|
|
|
@ -154,7 +154,7 @@ following shell commands:
|
|||
|
||||
(defun doom-upgrade--get-straight-recipe ()
|
||||
(with-temp-buffer
|
||||
(insert-file-contents (doom-path doom-core-dir "packages.el"))
|
||||
(insert-file-contents (doom-path doom-core-dir doom-module-packages-file))
|
||||
(when (re-search-forward "(package! straight" nil t)
|
||||
(goto-char (match-beginning 0))
|
||||
(let ((sexp (sexp-at-point)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue