Reduces the amount of "noise" included in bin/doom's output.
Also fixes an issue where warnings during autoloads generation would
sneak into Doom's autoloads file, producing weird void-variable errors,
like
(void-variable . rainbow-delimiters:)
(void-variable . diredfl:)
(void-variable . company:)
We only need this magic in CLI sessions. It's better to only use half
the CPUs in interactive sessions (if the user has enabled
comp-deferred-compilation for some reason).
Fixes#5042
Still a long way to go, but this introduces a few niceties for
debugging CLI failures:
+ The (extended) output of the last bin/doom command is now logged to
~/.emacs.d/.local/doom.log
+ If an error occurs, short backtraces are displayed whether or not you
have debug mode on. The full backtrace is written to
~/.emacs.d/.local/doom.error.log.
+ bin/doom now aborts with a warning if:
- The script itself or its parent directory is a symlink. It's fine if
~/.emacs.d is symlinked though.
- Running bin/doom as root when your DOOMDIR isn't in /root/.
- If you're sporting Emacs 26.1 (now handled in the elisp side rather
than the /bin/sh shebang preamble).
+ If a 'doom sync' was aborted prematurely, you'll be warned that Doom
was left in an inconsistent state and that you must run `doom sync`
again.
May address #3746
Some doom commands will generate a temporary script at
~/.emacs.d/.local/.doom.sh so that it can run an arbitrary shell command
after the current invocation of bin/doom ends. Very useful for, say,
restarting the currently running doom command after a destructive
operation, like updating Doom's source code, tangling your literate
config, or for launching arbitrary programs, like a new instance of
Emacs. This is necessary because elisp lacks an execv implementation.
However, for some folks, .doom.sh wasn't executing at all. This meant:
1. Some `doom upgrade`s would upgrade Doom itself but never move on to
the second step of the process: updating its packages.
2. Literate config users could tangle their configs on `doom sync`, but
the actual syncing process would never happen (#3746).
3. `doom run` would do nothing.
I hadn't realized /bin/sh runs bash in POSIX mode (at least, on systems
where /bin/sh = bash, like nixOS or macOS). In POSIX mode the script
will abort the if a builtin command (like export) returns a non-zero
exit code. Since .doom.sh is basically a bunch of exports followed by an
arbitrary command, and there are some environment variables
that can trigger validation errors (like UID triggering a "read-only
variable" error), we have a problem.
Hopefully addresses #3746
Tangling would load org libraries. If org hasn't been installed yet,
this means the older version is loaded, later interfering with the
installation and byte-compilation of the new package, causing down the
road.
- Tangling no longer adds temp files to recentf (#3685)
- If :tangle yes is used, the result is no longer tangled to
/tmp/config.org.*.el
- In interactive sessions the org buffer is no longer interfered with
when tangling (by scrolling up to the top of the page, or undoing
overlays/markers).
- Tangling no longer triggers formatters (or any save/write hooks).
- Appease byte-compiler sama, complaining about free variables.
elisp lacks an execv implementation (or mature subprocess library), so
we exploit some splenderiffic hackery to get Emacs to execute arbitrary
shell commands after a 'doom ...' command completes. This allows us to
daisy chain doom commands in distinct sessions (wonderful for reloading
doom after a 'doom upgrade', which we do). This minimizes errors when a
'doom upgrade' pulls in breaking changes to Doom's CLI.
We also bring 'doom run' into elisp, since this new functionality
enables us to.
That 'doom refresh' and 'doom sync' do the same thing has been a point
of confusion for a while. By phasing out 'doom refresh' we can finally
put that to rest.
We no longer need two separate autoloads files, so I merged them and
optimized its generation logic.
Other changes
- Doom will refuse to start up (with a helpful error) if it's in an
incomplete state. This should hopefully reduce the number of bug
reports from folks that have done something weird, e.g.
1. You've changed Emacs versions without running 'doom sync -b'.
2. You've updated Doom outside of `doom upgrade` and didn't run `doom
sync -u`.
3. You've forgotten to run 'doom sync' in the first place!
4. If a previous 'doom ...' command was aborted midway without running
'doom sync' afterwards.
- 'doom sync' will emit reminders that you need to reload/restart Emacs
- Autoloads API now uses the `doom-autoloads-` prefix, intead of
'doom-cli-autoloads-', as will be the new convention in the coming
rewrite.
- Errors from within the package autoloads should be easier to invoke
the debugger on.
- `doom-modules` is now stored in your autoloads file. Your module list
will soon be frozen between calls to 'doom sync' to allow for our new,
atomic CLI I'm working on. This will also means the `doom!` block
won't cost anything in interactive sessions.
`format` isn't an appropriate for this library, considering it (and
future additions to it) will be mainly concerned with printing or
capturing output.
Doom now looks for cli.el files in your private directory or modules,
giving them an opportunity to customize the CLI (add commands or
reconfigure existing ones) to suit their purposes.
For prompts like these
> In repository "org-roam", remote "origin" has URL
"https://github.com/jethrokuan/org-roam.git"
but recipe specifies a URL of
"https://github.com/org-roam/org-roam.git"
1) Abort
2) Rename remote "origin" to "origin-1", re-create "origin" with correct URL, and fetch
3) Rename remote "origin" manually, re-create it with correct URL, and fetch (Recommended)
4) Delete remote "origin", re-create it with correct URL, and fetch
5) Delete remote "origin", re-create it with manually set URL, and fetch
How to proceed? (1, 2, 3, 4, 5)
4 should be recommended, not 3.
When you're being prompted, these regexps control what option is
highlighted as the recommended option, and two of them were definitely
wrong, and another two *might've* been wrong.