Commit graph

56 commits

Author SHA1 Message Date
Henrik Lissner
da1030985d
Minor refactors & reformatting 2020-07-23 01:26:03 -04:00
Henrik Lissner
aec94f5bb2
Fix #3228: 'Failed to fetch from upstream' on doom upgrade
Due to git name-rev returning fully qualified refs in some cases.
2020-05-29 19:36:13 -04:00
Henrik Lissner
b6cc110f4c
Fix 'wrong-type-arg' error on 'doom upgrade' 2020-05-26 03:12:35 -04:00
Henrik Lissner
894966b1e2
Fix #3221: incorrect usage of doom-cli-execute
The function is variadic in as-of-yet published versions of Doom's CLI;
this usage snuck into a commit.
2020-05-26 02:55:24 -04:00
Henrik Lissner
a814239ec7
Implement daisy-chaining for CLI sessions
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.
2020-05-26 02:30:54 -04:00
Henrik Lissner
e89b604f5f
Fix 'doom upgrade' when doom is a git submodule 2020-05-26 02:13:02 -04:00
Henrik Lissner
9f024e549f
Instruct user to rerun 'doom upgrade'
If it fails during reloading of Doom's core.

Relevant to #3131
2020-05-25 16:27:51 -04:00
Henrik Lissner
e6c88e4384
Refactor autoloads generator & reduce to one generated file
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.
2020-05-25 15:55:29 -04:00
Henrik Lissner
204783a96e
Change how doom core reloads itself after 'doom upgrade'
Hopefully to address weird void-function errors while upgrading.
2020-05-19 21:49:01 -04:00
Henrik Lissner
643377d8a4
Fix void-function doom--straight-respect-print-indent-a error
On first use of 'doom upgrade'
2020-05-18 03:27:30 -04:00
Henrik Lissner
375faedb1b
Emit backtrace if doom upgrade fails 2020-05-16 05:38:20 -04:00
Henrik Lissner
49790fb53f
Include the error when 'doom upgrade' fails 2020-05-16 05:31:33 -04:00
Henrik Lissner
0e851ace9b
Backport bits of CLI rewrite
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
2020-05-15 01:33:52 -04:00
Henrik Lissner
8a7763337d
doom refresh -> doom sync
refresh isn't going anywhere, but sync will be the canonical command
here on out, because it is more appropriate for kind of work it will be
doing in the future.
2020-02-19 23:34:16 -05:00
Henrik Lissner
99fc55f75c
General, minor refactors in doom core 2020-01-27 00:51:32 -05:00
Henrik Lissner
a2354a7ad7
Add -p/--packages to 'doom upgrade'
And document -f/--force
2020-01-26 05:00:57 -05:00
Henrik Lissner
4f676bd218
Refactor autoload generator bootstrappers 2020-01-01 13:31:40 -05:00
Henrik Lissner
a5fc782e76
cli/upgrade: fix wrong-type-arg string force file error #2277
Due to a vestigial call to the old doom-cli-reload-package-autoloads
2019-12-31 03:38:47 -05:00
Henrik Lissner
7e0c093bcf
cli/upgrade: fix dirty worktree detection 2019-12-13 14:53:52 -05:00
Henrik Lissner
153fbbc466
cli/upgrade: print git fetch log on successful upgrade 2019-12-02 20:22:01 -05:00
Henrik Lissner
a0d94e0db7
cli/upgrade: fix -y/--yes for 'doom upgrade'
Otherwise, 'doom upgrade' throws 'Unrecognized switch "-y"' error after
updating Doom.
2019-12-02 20:22:00 -05:00
Henrik Lissner
570894e1c8
cli/upgrade: 'doom refresh' after upgrading, before updating
Fixes an issue where uninitialized packages aren't installed when 'doom
update' tries to update them.
2019-11-24 19:38:49 -05:00
Henrik Lissner
d474223a99
cli/upgrade: don't use removed -f switch 2019-11-16 21:04:08 -05:00
Henrik Lissner
c297d091bd
Fix void-function doom-initialize-packages on 'doom upgrade' 2019-11-10 23:43:05 -05:00
Henrik Lissner
8d112fdca8
Prevent void-variable errors on 'doom upgrade'
If Doom is up-to-date, certain Doom package state doesn't get
initialized for the 'doom update' that occurs directly after, causing
these errors.
2019-11-10 20:15:25 -05:00
Henrik Lissner
4ceb09c219
cli/upgrade: don't double-update packages
And don't initialize too much of Doom before updating it.
2019-11-10 16:44:53 -05:00
Henrik Lissner
a55b5a4514
Fix void-function doom-sh error in 'doom upgrade' #2034 2019-11-09 11:06:06 -05:00
Henrik Lissner
873fc5c0db
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-08 16:02:06 -05:00
Sean Farley
686e020287 cli: add documentation string about new flags 2019-09-22 14:34:40 -07:00
Sean Farley
85ea924595 cli: fix wrong argument being sent to doom-upgrade
In 84837fa0d, a new argument was added before the timeout arg which
broken this flag.
2019-09-22 14:34:22 -07:00
Henrik Lissner
5caa6add5c
Make 'doom upgrade' respect -y/--yes switches 2019-09-12 17:25:54 -04:00
Henrik Lissner
9f08d11908
Also delete autoloads.pkgs.el on 'doom upgrade' 2019-09-05 14:06:52 -04:00
Sean Farley
c55676d221 cli/upgrade: add timeout flag
Since there is a lot of logic in `bin/doom upgrade` than just running
two commands, I thought we should also add a timeout flag just like
`update` has.
2019-08-29 17:03:42 -07:00
Henrik Lissner
9d0966e94a
Forcibly refresh doom after 'doom upgrade'
Ensures autoloads files are regenerated.
2019-08-23 01:56:43 -04:00
Henrik Lissner
f42bfde8ae
Fix #1648: doom upgrade not updating packages
...when Doom itself is up-to-date.
2019-08-07 20:55:56 -04:00
Henrik Lissner
c32244ad4e
Generalize doom-sh
And slightly reformat 'doom upgrade' "you have updates" message.
2019-07-29 20:57:20 +02:00
Henrik Lissner
2b81233353
Clean up _upgrade rmeote after 'doom upgrade' 2019-07-29 03:47:56 +02:00
Henrik Lissner
8a16513107
Fix various errors in 'doom upgrade' 2019-07-29 03:34:35 +02:00
Henrik Lissner
2304d69898
Fix wrong-type-arg number during 'doom upgrade' 2019-07-29 03:21:55 +02:00
Henrik Lissner
c28fff4fbf
Fix void-variable branch error on 'doom upgrade' 2019-07-29 03:18:39 +02:00
Henrik Lissner
a9c1986a68
Fix and refactor 'doom upgrade' #1607
Now accepts the -f/--force switches to discard local changes to
the .emacs.d directory.
2019-07-28 13:47:57 +02:00
Henrik Lissner
4dc42de9e3
def-command! -> defcli!
And def-command-group! -> defcligroup!, to match our new convention for
naming definer macros.
2019-07-28 02:32:25 +02:00
Henrik Lissner
44c694da47
Make bin/doom options consistent & improve errors/docs 2019-07-26 03:12:07 +02:00
Henrik Lissner
b90dede1ab
💥 Replace package.el/quelpa with straight #374
There are a few kinks to iron out, but for the most part it's done. Doom
Emacs, powered by straight. Goodbye gnutls and elpa/quelpa issues.

This update doesn't come with rollback or lockfile support yet, but I
will eventually include one with Doom, and packages will be (by default,
anyway) updated in sync with Doom.

Relevant threads: #1577 #1566 #1473
2019-07-22 02:30:40 +02:00
Henrik Lissner
29293aa17f
Fix #1453: ensure package autoloads are reloaded
`doom-package-update` does not trigger regeneration of the package
autoloads file.
2019-06-10 09:38:56 +02:00
Henrik Lissner
0733a6dfac
Replace SPC h p with doom/help-packages
Now that it supersedes describe-packages in functionality.
2019-05-30 14:01:48 -04:00
Henrik Lissner
93876028b4
cli/upgrade: always update packages
Even when Doom is up-to-date.
2019-05-22 17:10:44 -04:00
Henrik Lissner
2cb5d895d7
cli/upgrade: fix void-function error
Derpity derp derp.

Derp McDerpington.

Derpsville, population me.
2019-05-15 17:29:43 -04:00
Henrik Lissner
4b66b7c29b
cli/upgrade: emit full error, if one occurs 2019-05-15 17:17:56 -04:00
Henrik Lissner
f7a6b2b33e
cli/upgrade: refresh before updating packages
So missing packages are installed and orphaned ones are removed (and env
file updated, if necessary).
2019-05-14 23:41:02 -04:00