2019-07-22 04:16:47 +02:00
|
|
|
;;; core/cli/install.el -*- lexical-binding: t; -*-
|
2018-09-07 21:49:49 -04:00
|
|
|
|
2019-07-28 01:32:16 +02:00
|
|
|
(defcli! quickstart (&rest args) ; DEPRECATED
|
2019-07-25 19:42:01 +02:00
|
|
|
"This is a deprecated alias for 'doom install'.
|
|
|
|
|
|
|
|
See 'doom help install' instead."
|
2019-07-21 15:39:45 +02:00
|
|
|
:hidden t
|
|
|
|
(apply #'doom-cli-install args))
|
|
|
|
|
2019-07-28 01:32:16 +02:00
|
|
|
(defcli! (install i) (&rest args)
|
2019-09-08 20:41:09 -04:00
|
|
|
"Installs and sets up Doom Emacs for the first time.
|
2018-09-07 21:49:49 -04:00
|
|
|
|
2019-05-01 19:12:52 -04:00
|
|
|
This command does the following:
|
|
|
|
|
2019-05-30 14:00:41 -04:00
|
|
|
1. Creates DOOMDIR at ~/.doom.d,
|
2019-09-08 20:41:09 -04:00
|
|
|
2. Copies ~/.emacs.d/init.example.el to $DOOMDIR/init.el (if it doesn't exist),
|
|
|
|
3. Creates dummy files for $DOOMDIR/{config,packages}.el,
|
|
|
|
4. Prompts you to generate an envvar file (same as 'doom env'),
|
|
|
|
5. Installs any dependencies of enabled modules (specified by $DOOMDIR/init.el),
|
2019-05-30 14:00:41 -04:00
|
|
|
6. And prompts to install all-the-icons' fonts
|
2019-05-01 19:12:52 -04:00
|
|
|
|
|
|
|
This command is idempotent and safe to reuse.
|
|
|
|
|
|
|
|
The location of DOOMDIR can be changed with the -p option, or by setting the
|
|
|
|
DOOMDIR environment variable. e.g.
|
2018-09-07 21:49:49 -04:00
|
|
|
|
2019-07-21 15:39:45 +02:00
|
|
|
doom -p ~/.config/doom install
|
|
|
|
DOOMDIR=~/.config/doom doom install
|
2018-09-07 21:49:49 -04:00
|
|
|
|
2019-09-08 20:41:09 -04:00
|
|
|
The following switches are recognized:
|
:boom: Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.
Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)
The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.
+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
running `doom env enable` (`doom env clear` will reverse this and
delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
file. You won't need it if you're confident Emacs will always be
started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
doom/reload-env`. Note: this won't work if the Emacs session you're
running it in doesn't have a correct SHELL set. i.e. don't use this to
create your first env file!
The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.
This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 00:06:10 -04:00
|
|
|
|
2019-05-01 19:12:52 -04:00
|
|
|
--no-config Don't create DOOMDIR or dummy files therein
|
:boom: Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.
Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)
The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.
+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
running `doom env enable` (`doom env clear` will reverse this and
delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
file. You won't need it if you're confident Emacs will always be
started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
doom/reload-env`. Note: this won't work if the Emacs session you're
running it in doesn't have a correct SHELL set. i.e. don't use this to
create your first env file!
The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.
This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 00:06:10 -04:00
|
|
|
--no-install Don't auto-install packages
|
|
|
|
--no-env Don't generate an envvars file (see `doom help env`)
|
2019-07-25 19:42:01 +02:00
|
|
|
--no-fonts Don't install (or prompt to install) all-the-icons fonts
|
|
|
|
-y / --yes Auto-accept any confirmation prompts"
|
2019-07-21 15:39:45 +02:00
|
|
|
(print! (green "Installing Doom Emacs!\n"))
|
2019-07-22 04:20:52 +02:00
|
|
|
(let ((default-directory (doom-path "~")))
|
2019-07-21 15:39:45 +02:00
|
|
|
;; Create `doom-private-dir'
|
:boom: Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.
Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)
The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.
+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
running `doom env enable` (`doom env clear` will reverse this and
delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
file. You won't need it if you're confident Emacs will always be
started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
doom/reload-env`. Note: this won't work if the Emacs session you're
running it in doesn't have a correct SHELL set. i.e. don't use this to
create your first env file!
The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.
This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 00:06:10 -04:00
|
|
|
(if (member "--no-config" args)
|
2019-07-21 15:39:45 +02:00
|
|
|
(print! (warn "Not copying private config template, as requested"))
|
|
|
|
(print! "> Creating %s" (relpath doom-private-dir))
|
|
|
|
(make-directory doom-private-dir 'parents)
|
|
|
|
(print! (success "Created %s") (relpath doom-private-dir))
|
:boom: Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.
Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)
The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.
+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
running `doom env enable` (`doom env clear` will reverse this and
delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
file. You won't need it if you're confident Emacs will always be
started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
doom/reload-env`. Note: this won't work if the Emacs session you're
running it in doesn't have a correct SHELL set. i.e. don't use this to
create your first env file!
The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.
This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 00:06:10 -04:00
|
|
|
|
2019-05-01 19:19:20 -04:00
|
|
|
;; Create init.el, config.el & packages.el
|
2019-07-21 15:39:45 +02:00
|
|
|
(mapc (lambda (file)
|
|
|
|
(cl-destructuring-bind (filename . fn) 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))
|
|
|
|
(print! (success "Done!")))))
|
|
|
|
'(("init.el" .
|
|
|
|
(lambda ()
|
2019-07-22 04:48:44 +02:00
|
|
|
(insert-file-contents (doom-path doom-emacs-dir "init.example.el"))))
|
2019-07-21 15:39:45 +02:00
|
|
|
("config.el" .
|
|
|
|
(lambda ()
|
|
|
|
(insert! ";;; %sconfig.el -*- lexical-binding: t; -*-\n\n"
|
|
|
|
";; Place your private configuration here\n"
|
|
|
|
((relpath doom-private-dir)))))
|
|
|
|
("packages.el" .
|
|
|
|
(lambda ()
|
|
|
|
(insert! ";; -*- no-byte-compile: t; -*-\n;;; %spackages.el\n\n"
|
|
|
|
";;; Examples:\n"
|
|
|
|
";; (package! some-package)\n"
|
2019-08-17 11:59:05 -04:00
|
|
|
";; (package! another-package :recipe (:host github :repo \"username/repo\"))\n"
|
2019-07-21 15:39:45 +02:00
|
|
|
";; (package! builtin-package :disable t)\n"
|
|
|
|
((relpath doom-private-dir))))))))
|
|
|
|
|
|
|
|
;; In case no init.el was present the first time `doom-initialize-modules' was
|
|
|
|
;; called in core.el (e.g. on first install)
|
|
|
|
(doom-initialize-packages 'force-p)
|
|
|
|
|
|
|
|
;; Ask if Emacs.app should be patched
|
|
|
|
(if (member "--no-env" args)
|
|
|
|
(print! (warn "- Not generating envvars file, as requested"))
|
|
|
|
(when (or doom-auto-accept
|
|
|
|
(y-or-n-p "Generate an env file? (see `doom help env` for details)"))
|
|
|
|
(doom-reload-env-file 'force-p)))
|
|
|
|
|
|
|
|
;; Install Doom packages
|
|
|
|
(if (member "--no-install" args)
|
|
|
|
(print! (warn "- Not installing plugins, as requested"))
|
|
|
|
(print! "Installing plugins")
|
|
|
|
(doom-packages-install doom-auto-accept))
|
|
|
|
|
|
|
|
(print! "Regenerating autoloads files")
|
|
|
|
(doom-reload-autoloads nil 'force-p)
|
|
|
|
|
|
|
|
(if (member "--no-fonts" args)
|
|
|
|
(print! (warn "- Not installing fonts, as requested"))
|
|
|
|
(when (or doom-auto-accept
|
|
|
|
(y-or-n-p "Download and install all-the-icon's fonts?"))
|
|
|
|
(require 'all-the-icons)
|
|
|
|
(let ((window-system (cond (IS-MAC 'ns)
|
|
|
|
(IS-LINUX 'x))))
|
|
|
|
(all-the-icons-install-fonts 'yes))))
|
|
|
|
|
|
|
|
(print! (success "\nFinished! Doom is ready to go!\n"))
|
|
|
|
(with-temp-buffer
|
|
|
|
(doom-template-insert "QUICKSTART_INTRO")
|
|
|
|
(print! (buffer-string)))))
|