Commit graph

100 commits

Author SHA1 Message Date
Henrik Lissner
d2bc2ff44b
config/literate: improve tangling algorithm
- 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.
2020-08-08 02:57:04 -04:00
Henrik Lissner
f4e6d36574
Move 'restart Emacs to see changes' message to 'doom sync'
It isn't the autoloads generator's responsibility to do this. The
"changes" referred to consist of more than just the regenerated
autoloads file.
2020-05-26 04:09:11 -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
16d44de0db
Add/improve docs for doom sync's -u & -p switches 2020-05-25 16:26:16 -04:00
Henrik Lissner
8c37928de2
Disable 'doom refresh'
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.
2020-05-25 16:23:17 -04:00
Henrik Lissner
5cba174bd9
Add doom-sync-{pre,post}-hook 2020-05-25 16:03:16 -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
be889d09e8
Rename doom-format lib -> doom-output
`format` isn't an appropriate for this library, considering it (and
future additions to it) will be mainly concerned with printing or
capturing output.
2020-05-25 15:55:29 -04:00
Henrik Lissner
cc5f498586
Add magic cli.el in modules & refactor module init
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.
2020-05-25 15:55:28 -04:00
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