2019-07-22 04:16:47 +02:00
;;; core/cli/install.el -*- lexical-binding: t; -*-
2018-09-07 21:49:49 -04:00
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( defcli! ( install i )
( ( noconfig-p [ " --no-config " ] " Don't create DOOMDIR or dummy files therein " )
( noenv-p [ " --no-env " ] " Don't generate an envvars file (see 'doom help env') " )
( noinstall-p [ " --no-install " ] " Don't auto-install packages " )
( nofonts-p [ " --no-fonts " ] " Don't install (or prompt to install) all-the-icons fonts " )
2019-11-23 00:52:36 -05:00
&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
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
DOOMDIR=~/.config/doom doom install "
:bare t
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'
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( if noconfig-p
2019-07-21 15:39:45 +02:00
( print! ( warn " Not copying private config template, as requested " ) )
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( print! ( start " Creating %s " ) ( relpath doom-private-dir ) )
2019-07-21 15:39:45 +02:00
( make-directory doom-private-dir 'parents )
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( print-group!
( 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-12-19 23:32:58 -05:00
( insert-file-contents
( doom-path doom-emacs-dir " init.example.el " ) ) ) )
2019-07-21 15:39:45 +02:00
( " config.el " .
( lambda ( )
2019-12-19 23:32:58 -05:00
( insert-file-contents
2019-12-20 05:01:44 -05:00
( doom-path doom-core-dir " templates/config.example.el " ) ) ) )
2019-07-21 15:39:45 +02:00
( " packages.el " .
( lambda ( )
2019-12-19 23:32:58 -05:00
( insert-file-contents
2019-12-20 05:01:44 -05:00
( doom-path doom-core-dir " templates/packages.example.el " ) ) ) ) ) ) )
2019-07-21 15:39:45 +02:00
;; In case no init.el was present the first time `doom-initialize-modules' was
;; called in core.el (e.g. on first install)
2019-12-06 13:23:54 -05:00
( doom-initialize 'force 'noerror )
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( doom-initialize-modules )
;; Ask if user would like an envvar file generated
( if noenv-p
( print! ( warn " Not generating envvars file, as requested " ) )
( if ( file-exists-p doom-env-file )
( print! ( info " Envvar file already exists, skipping " ) )
( when ( or doom-auto-accept
2019-12-21 14:58:40 -05:00
( y-or-n-p " Generate an envvar file? (see ` doom help env ` for details) " ) )
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( doom-cli-reload-env-file 'force-p ) ) ) )
2019-07-21 15:39:45 +02:00
;; Install Doom packages
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( if noinstall-p
( print! ( warn " Not installing plugins, as requested " ) )
2019-07-21 15:39:45 +02:00
( print! " Installing plugins " )
2019-11-08 16:39:48 -05:00
( doom-cli-packages-install ) )
2019-07-21 15:39:45 +02:00
( print! " Regenerating autoloads files " )
2019-12-30 06:44:16 -05:00
( doom-cli-reload-autoloads )
2020-02-02 23:39:42 +00:00
2020-02-02 23:23:05 +00:00
( if nofonts-p
( print! ( warn " Not installing fonts, as requested " ) )
2020-02-02 23:39:42 +00:00
( if IS-WINDOWS
( print! ( warn " Automated installation is not supported on Windows, see installation instructions: https://github.com/domtronn/all-the-icons.el#installing-fonts " ) )
2020-02-02 23:23:05 +00:00
( 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 ) ) ) ) )
2019-07-21 15:39:45 +02:00
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
( when ( file-exists-p " ~/.emacs " )
( print! ( warn " A ~/.emacs file was detected. This conflicts with Doom and should be deleted! " ) ) )
2019-07-21 15:39:45 +02:00
( print! ( success " \n Finished! Doom is ready to go! \n " ) )
( with-temp-buffer
( doom-template-insert " QUICKSTART_INTRO " )
( print! ( buffer-string ) ) ) ) )