Commit graph

141 commits

Author SHA1 Message Date
Henrik Lissner
3a38fc633c
Change doom-{interactive,debug}-mode suffix to -p
Because these are not really modes.

Also makes `doom-debug-mode` an actual (global) minor mode.
2020-05-25 03:43:40 -04:00
Henrik Lissner
e00bfc7612
Minor refactors & reformatting 2020-05-25 03:43:40 -04:00
Henrik Lissner
ebdb3399b5
Recommend the correct option for changes in package origin
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.
2020-05-18 03:37:42 -04:00
Henrik Lissner
10d9ca87e9
Correct regexps for recommended straight options
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.
2020-05-15 22:58:00 -04:00
Henrik Lissner
2884dd9ea7
Fix 'recreate repo' option not being recommended
When updating a package with a changed recipe (e.g. it's branch).
2020-05-15 02:29:22 -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
1fb5981ba6
Highlight recommended straight prompt option in green 2020-05-02 14:41:18 -04:00
Henrik Lissner
9cbbf81c3f
Don't recompile in 'doom sync'
This may be reinstated later, but for now is a common source of issues
because Doom must be fully loaded before byte-compiling; and doing this
is prone to errors when Doom is in an incomplete state (which may be the
case if there were an error earlier in 'doom sync').

This won't be an issue once the doom script becomes transactional.
2020-02-11 03:20:14 -05:00
Henrik Lissner
a9402cfb55
Fix #2373: bring back package pinning
This needs some serious refactoring...
2020-01-25 19:02:00 -05:00
Henrik Lissner
f6852a2c9f
Add --discard switch to 'doom upgrade' #2224
Also rewrites straight prompt-in-batch-Emacs hack, and move it to
core-cli.el.
2020-01-09 03:36:00 -05:00
Henrik Lissner
29773baa55
Add 'doom sync' as an alias for 'doom refresh'
'sync' more accurately describes the purpose of the command. 'refresh'
is now soft-deprecated; but I will phase it out of the documentation
and promote 'sync' instead, but it won't be removed.
2020-01-01 21:19:21 -05:00
Henrik Lissner
7a348f8784
Refactor how we indent straight's progress output
More work up front, less work in the trenches.
2020-01-01 19:34:30 -05:00
Henrik Lissner
4f676bd218
Refactor autoload generator bootstrappers 2020-01-01 13:31:40 -05:00
Henrik Lissner
908bd4b945
Remove FORCE-P argument for doom-cli-reload-autoloads
We weren't using them anyway.
2019-12-30 06:44:16 -05:00
Henrik Lissner
f8ff50565e
Refactor autoload generator
- Halves LOC
- Adopts functional paradigm where possible.
- Reduces the filesize of autoloads files by ~10-20%
- Speeds up autoloads generation by ~20%
2019-12-29 22:20:48 -05:00
Henrik Lissner
760dcbb8ea
Warn about reloading env from within Emacs on Windows 2019-12-15 21:53:26 -05:00
Henrik Lissner
6cb13a0e86
Make 'doom refresh -p' purge then regraft 2019-12-14 20:42:55 -05:00
Henrik Lissner
dc8b3dd57d
Slight reformatting of 'doom refresh' & 'doom compile' output 2019-12-08 00:57:10 -05:00
Henrik Lissner
cd3190b594
Comment autoloads file deletion in 'doom refresh' 2019-12-05 19:51:53 -05:00
Henrik Lissner
e3f8674297
Group 'doom refresh' with maintenance commands 2019-12-05 15:01:04 -05:00
Henrik Lissner
96e0ccab21
Add sync alias for 'doom refresh' 2019-12-05 14:55:13 -05:00
Henrik Lissner
4b05a64263
Ensure no autoloads files are preloaded on 'doom refresh' 2019-12-05 14:55:01 -05:00
Henrik Lissner
4300957aea
Add NOERROR arg to doom-initialize 2019-12-05 14:52:30 -05:00
Henrik Lissner
172260118e
core/core-cli: only load the libraries we need 2019-12-05 14:50:05 -05:00
Henrik Lissner
26c8f5c6ef
Bytecompiler bytecompiler, won't you shut up 2019-11-23 01:21:25 -05:00
Henrik Lissner
36ba16b295
Add -p/--purge switches to 'doom refresh' 2019-11-21 02:00:24 -05:00
Henrik Lissner
c363791da0
Made -f the default for 'doom refresh' #2065
-f is necessary when there are changes to your system that Doom needs to
pick up when running 'doom refresh'. It won't do anything if your doom
dotfiles haven't visibly changed, which won't be the case if you are
installing, say, mu4e or vterm, through your system package manager.

What was initially a time-saving mechanic has become a trap for
beginners, so I've made -f its default behavior and its previous
behavior opt-in with the -n / --if-necessary switches.
2019-11-16 20:55:08 -05:00
Henrik Lissner
b3b0af8a35
Complain if autoload libs fail to load 2019-11-09 17:00:33 -05:00
Henrik Lissner
cc1bbe0b7e
core-cli: add doom-cli constructor 2019-11-09 02:23:58 -05:00
Henrik Lissner
135e7ffc89
Load seq in core-cli 2019-11-08 17:48:16 -05:00
Henrik Lissner
5c459e75f8
Fix 'doom refresh' not seeing -f/--force 2019-11-08 16:57:25 -05:00
Henrik Lissner
4ce153519c
Refactor out map.el dependency
Since map-put appears to be deprecated on Emacs 27
2019-11-08 16:57:19 -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
Henrik Lissner
297728bf74
Generalize doom-file-cookie-p
And move it to doom-file-cookie-p for anyone to use.
2019-10-04 22:42:53 -04:00
Henrik Lissner
497fd08af7
Remove 'doom patch-macos' command
'doom env' has long since replaced it. Nobody should be using
patch-macos anymore.
2019-09-22 12:00:22 -04:00
Henrik Lissner
4fda7cd287
Don't auto-purge ELPA packages on 'doom refresh'
...or 'doom purge', without the -e or --elpa switches (or --all).
2019-09-09 23:04:07 -04:00
Henrik Lissner
c3e2ec0157
Redesign straight initialization #1610 #1607
Straight throws an 'emacs-version-changed' error if you load it with a
version of Emacs it wasn't compiled with. This update causes this to
emit a more helpful error.
2019-07-29 21:09:21 +02:00
Henrik Lissner
4e305dd2ab
Fix bin/doom misinterpreting wrong-num-of-args errors 2019-07-29 20:58:02 +02: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
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
402260f154
Fix doom/reload & doom/reload-autoloads 2019-07-27 17:04:17 +02:00
Henrik Lissner
9c1c61752a
Fix 'doom refresh' skipping purging step 2019-07-26 20:17:29 +02:00
Henrik Lissner
44c694da47
Make bin/doom options consistent & improve errors/docs 2019-07-26 03:12:07 +02:00
Henrik Lissner
d00c5a0de5
Add doom-cli-post-{failure,success}-execute-hook vars
To replace doom-cli-post-execute-hook. Now only displays "refresh"
message after a successful command.
2019-07-26 03:12:06 +02:00
Henrik Lissner
388267d256
Add --force/-f support to doom refresh 2019-07-22 23:22:55 +02:00
Henrik Lissner
93f7520c79
Refactor Doom core init process (again)
- Eager-load all core autoloaded libraries if autoloads file isn't
  present.
- Renames functions to be more descriptive of their true purpose:
  - doom-initialize-autoloads -> doom-load-autoloads-file
  - doom-load-env-vars -> doom-load-envvars-file
- Use doom-module-p instead of featurep! for backend use (the latter is
  mainly syntax sugar for module use, and evaluates at compile/expansion
  time, which may cause hash-table-p errors early in the startup
  process).
- Reorder plist library to prevent load order race condition with the
  functions using the macros that haven't been defined yet.
2019-07-22 23:22:54 +02:00
Henrik Lissner
22404f1ec5
Fix "nil is not any command *I* know"
What good is sass if it isn't right?
2019-07-22 22:34:08 +02:00
Henrik Lissner
1c4215c187
Fix 'command not found' errors for hidden commands 2019-07-22 04:46:14 +02:00
Henrik Lissner
e9e6786dd3
Fix file-missing cli/quickstart error 2019-07-22 04:22:42 +02:00
Henrik Lissner
d2fa1a3dd1
Load seq in core-cli 2019-07-22 04:15:45 +02:00