Don't always create dummy files on doom quickstart

Only when DOOMDIR doesn't exist.
This commit is contained in:
Henrik Lissner 2018-10-06 00:21:57 -04:00
parent 5d3bada86e
commit 9a17c909c9
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -26,33 +26,29 @@ packages and regenerates the autoloads file."
(print! (yellow "%s directory already exists. Skipping.") short-private-dir) (print! (yellow "%s directory already exists. Skipping.") short-private-dir)
(print! "Creating %s" short-private-dir) (print! "Creating %s" short-private-dir)
(make-directory doom-private-dir t) (make-directory doom-private-dir t)
(print! (green "Done!"))) (print! (green "Done!"))
;; Create init.el ;; Create init.el, config.el & packages.el
(dolist (dolist (file (list (cons "init.el"
(file (list (cons "init.el" (lambda ()
(lambda () (insert-file-contents (expand-file-name "init.example.el" doom-emacs-dir))))
(insert-file-contents (expand-file-name "init.example.el" doom-emacs-dir)))) (cons "config.el"
(cons "config.el" (lambda ()
(lambda () (insert (format ";;; %sconfig.el -*- lexical-binding: t; -*-\n\n"
(insert (format ";;; %sconfig.el -*- lexical-binding: t; -*-\n\n" short-private-dir)
short-private-dir) ";; Place your private configuration here\n")))
";; Place your private configuration here\n"))) (cons "packages.el"
(cons "packages.el" (lambda ()
(lambda () (insert (format ";; -*- no-byte-compile: t; -*-\n;;; %spackages.el\n\n"
(insert (format ";; -*- no-byte-compile: t; -*-\n;;; %spackages.el\n\n" short-private-dir)
short-private-dir) ";;; Examples:\n"
";;; Examples:\n" ";; (package! some-package)\n"
";; (package! some-package)\n" ";; (package! another-package :recipe (:fetcher github :repo \"username/repo\"))\n"
";; (package! another-package :recipe (:fetcher github :repo \"username/repo\"))\n" ";; (package! builtin-package :disable t)\n")))))
";; (package! builtin-package :disable t)\n"))))) (cl-destructuring-bind (path . fn) file
(cl-destructuring-bind (path . fn) file (print! "Creating %s%s" short-private-dir path)
(let ((fullpath (expand-file-name path doom-private-dir))) (with-temp-file (expand-file-name path doom-private-dir)
(if (file-exists-p fullpath) (funcall fn))
(print! (yellow "%s%s already exists. Skipping.") short-private-dir path) (print! (green "Done!"))))))
(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")