The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes#2802, #2737, #2386
The big highlights are:
- Fix#2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix#2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix#2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
This allows batch scripts to load $EMACSDIR/init.el to use Doom's API.
Howevever, it puts the onus on the user to run `doom refresh` before
trying to use it.
This also indirectly addresses #2010
The lazy-loaded version library and file-name-directory calls end up
consulting file-name-handler-alist, and can trigger the GC, so we ensure
these things happen after the other optimizations.
The two doom-gc-* variables in init.el couples the rest of the config to
these two files. The bulk of GC/file-handler optimization was moved into
core.el and simplified (all that idle-timer voodoo was overkill).
Also adds (setq frame-inhibit-implied-reize t) to early-init, which
speeds up startup a fair bit in some edge cases with larger fonts.
squash! Simplify and decouple init files
This is second of three big naming convention changes. In this commit,
we change the naming conventions for hook functions and variable
functions:
1. Replace the bar | to indicate a hook function with a -h suffix, e.g.
doom|init-ui -> doom-init-ui-h
doom|run-local-var-hooks -> doom-run-local-var-hooks-h
2. And add a -fn suffix for functions meant to be set on variables,
e.g.
(setq magit-display-buffer-function #'+magit-display-buffer-fn)
See ccf327f8 for the reasoning behind these changes.
Old versions of Emacs complain about after-init-time being undefined.
This happens before Doom's version guard is triggered (which emits a
more helpful message).
+ Add doom-gc-cons-upper-limit variable
+ Don't use most-positive-fixnum, in case Emacs somehow wants to
allocate that much!
+ Don't use startup optimizations in noninteractive sessions
+ Restore gc-cons-threshold on idle timer, instead of hook (to defer the
possible GC pause and so deferred packages can take advantage of these
optimizations).
Calling tool-bar-mode, menu-bar-mode or scroll-bar-mode from
early-init.el seems to cause a 15-30% slowdown in startup time, possibly
for loading the UI libraries early.
Also, loading early-init.el eagerly from init.el causes a GC hit for
Emacs 25/26 users. It's too early to use this optimization.
The autoloads file has been split into doom-autoload-file and
doom-package-autoload-file. The former is for Doom's modules and
standard library; the latter is for compiling all package autoloads like
load-path and auto-mode-alist (among other things).
This reduced my startup speed from ~1s to ~0.5s
This commit adds bin/doom, which acts as the middle man that make once
was (and will stay for a while, though the documentation will shift away
from using it). It does everything the previous make interface did, but
is faster and more flexible. bin/doom should eventually replace the
makefile.
bin/doom also makes it easier to run Doom outside of ~/.emacs.d and
~/.doom.d with, for example:
bin/doom run -p ~/.other.doom.d/ -e ~/.other.emacs.d
bin/doom.cmd is included for Windows users, but I don't recommend using
it yet. It hasn't been tested nor have I ever written a batch script
before.
Also update init.example.el with new defaults.
Doom is moving away from supporting direct modification of its source
files, or private modules within Doom's source tree. Instead,
customizations should be relegated to ~/.doom.d/ (or ~/.config/doom/,
doom will respect XDG conventions if it sees this directory).
As suchm a default init.el is now supplied, which will break your custom
~/.emacs.d/init.el!
The quick fix:
mkdir ~/.doom.d
mv ~/.emacs.d/init.el ~/.doom.d/init.el
~/.doom.d/early-init.el is also available if you need to change crucial
settings before Doom loads anything. init.el will still be loaded before
any other module is.