Rewrite bin/doom quickstart

Now creates a packages.el file as well, with some commented examples,
and includes comment headers for config.el and packages.el.
This commit is contained in:
Henrik Lissner 2018-09-30 22:49:23 -04:00
parent aaa21698e9
commit e85aaabed9
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -28,20 +28,31 @@ packages and regenerates the autoloads file."
(make-directory doom-private-dir t) (make-directory doom-private-dir t)
(print! (green "Done!"))) (print! (green "Done!")))
;; Create init.el ;; Create init.el
(let ((init-file (expand-file-name "init.el" doom-private-dir))) (dolist
(if (file-exists-p init-file) (file (list (cons "init.el"
(print! (yellow "%sinit.el already exists. Skipping.") short-private-dir) (lambda ()
(print! "Copying init.example.el to %s" short-private-dir) (insert-file-contents (expand-file-name "init.example.el" doom-emacs-dir))))
(copy-file (expand-file-name "init.example.el" doom-emacs-dir) (cons "config.el"
init-file) (lambda ()
(print! (green "Done!")))) (insert (format ";;; %sconfig.el -*- lexical-binding: t; -*-\n\n"
;; Create config.el short-private-dir)
(let ((config-file (expand-file-name "config.el" doom-private-dir))) ";; Place your private configuration here\n")))
(if (file-exists-p config-file) (cons "packages.el"
(print! "%sconfig.el already exists. Skipping." short-private-dir) (lambda ()
(print! "Deploying empty config.el file in %s" short-private-dir) (insert (format ";; -*- no-byte-compile: t; -*-\n;;; %spackages.el\n\n"
(with-temp-file config-file (insert "")) short-private-dir)
(print! (green "Done!"))))) ";;; Examples:\n"
";; (package! some-package)\n"
";; (package! another-package :recipe (:fetcher github :repo \"username/repo\"))\n"
";; (package! builtin-package :disable t)\n")))))
(cl-destructuring-bind (path . fn) file
(let ((fullpath (expand-file-name path doom-private-dir)))
(if (file-exists-p fullpath)
(print! (yellow "%s%s already exists. Skipping.") short-private-dir path)
(print! "Creating %s%s" short-private-dir path)
(with-temp-file fullpath
(funcall fn))
(print! (green "Done!")))))))
;; Ask if Emacs.app should be patched ;; Ask if Emacs.app should be patched
(when IS-MAC (when IS-MAC
(message "MacOS detected") (message "MacOS detected")