Commit graph

61 commits

Author SHA1 Message Date
Henrik Lissner
98d7b97d33
Fix 'doom run' not (re)executing startup hooks
Makes leader keys (among other things) unable to function.
2020-05-17 06:14:37 -04:00
Henrik Lissner
805976b8bd
Handle the case where EMACSDIR has no trailing slash 2020-05-15 04:53:59 -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
aa64ece46d
Silence deprecation & site-file loading messages in CLI 2020-05-04 16:51:21 -04:00
Henrik Lissner
981ed73e66
Fix void-variable straight-process-buffer error #2596 2020-02-24 22:56:58 -05:00
Henrik Lissner
f7445a10db
General refactor & reformatting across the board 2020-02-18 22:56:47 -05:00
Henrik Lissner
4bd59f5ed9
Dump *straight-process* buffer after straight errors 2020-01-08 22:07:03 -05:00
Henrik Lissner
637243a7e8
Merge pull request #2304 from rohitpaulk/fix-empty-help
cli: Handle --help without an argument
2020-01-05 20:10:11 -05:00
Paul Kuruvilla
8818f2f7e8 cli: Handle --help without an argument 2020-01-04 11:32:14 +05:30
Henrik Lissner
960d756b47
General, minor refactors 2019-12-30 18:23:56 -05:00
Henrik Lissner
2ed4e0d55c
bin/doom: warn if run as root 2019-12-20 21:48:25 -05:00
Henrik Lissner
1e6ef4d6e4
Rewrite interactive CLI commands
- Replace doom//upgrade with doom/upgrade
- Replace doom//autoloads with doom/reload-autoloads
- Replace doom//refresh with doom/reload
- Remove doom//install; there should be no workflow for this command
- Remove doom//autoremove; autoremove was replaced with purge. Maybe
  I'll write a doom//purge analogue. Not sure yet.
- Use compile instead of hacky wrapper around core-cli API

Rewrite interactive CLI commands

- Rewrite doom//upgrade & doom//autoloads
- Remove doom//install; there really should be no use-case for it
- Remove doom//autoremove; autoremove was replaced with purge. I'll get
  around to writing a doom//purge eventually.

fixup! Rewrite interactive CLI commands
2019-12-13 16:17:05 -05:00
Henrik Lissner
ecb76d536b
cli: clarify post-error debug mode instructions 2019-12-08 00:56:11 -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
ddce674a6c
Minor refactors across the board 2019-10-07 16:10:33 -04:00
Henrik Lissner
f6b8807e83
Add -o option to 'doom env'
Now you can output envvar files where ever you like.
2019-09-05 14:20:50 -04:00
Henrik Lissner
81ee250c09
Minor refactor & revision across the board 2019-09-03 00:59:46 -04:00
Henrik Lissner
4b736bef68
Introduce doom-interactive-mode
As soft inverse alias for noninteractive; this makes it easier to unit
test functionality that depends on the session type.
2019-09-03 00:37:30 -04:00
Henrik Lissner
081f09aac8
Fix 'doom run' #1724 2019-08-28 22:08:13 -04:00
Henrik Lissner
e6c3a012e8
bin/doom: set user-emacs-directory
Fixes an issue where bin/doom wasn't running from the emacs config it
was located in.
2019-08-27 12:36:58 -04:00
Henrik Lissner
aad0b2f842
Change how unit tests are set up and run
Moves init.test.el to core/test/init.el and initializes the test
environment from within the current session, rather than through a bash
script middle man.

TODO: don't buffer the unit test results
2019-08-27 00:07:01 -04:00
Henrik Lissner
8ac1e1a781
Refactor doom init process
- Refactors doom-initialize
- Moves doom-initialize-modules call to init.el, to more easily isolate
  it during unit testing.
2019-08-27 00:05:12 -04:00
Henrik Lissner
2122a31962
Add new instanced test runner
This will run the unit tests for each module in a separate Emacs
instance. It's a fair bit slower, but much more useful for something as
stateful as an Emacs config.

Now I just need to push the rewritten tests.
2019-07-26 03:12:07 +02:00
Henrik Lissner
44c694da47
Make bin/doom options consistent & improve errors/docs 2019-07-26 03:12:07 +02:00
Henrik Lissner
a7ce48c2df
bin/doom: add -l/--local/DOOMLOCALDIR
Will come in handy for the new testing framework.
2019-07-22 02:37:48 +02:00
Henrik Lissner
060ede0e2e
General, minor reformatting across the board
And an offering of blood to our great lord Byte Compiler-sama.
2019-07-22 02:37:45 +02:00
Henrik Lissner
149b2617b0
💥 revise hook/var fns naming convention (2/2)
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.
2019-07-22 02:30:38 +02:00
chrunchyjesus
9236999df1
fix shebang 2019-06-08 07:13:19 +02:00
Misaka Mikoto
902f734cfb bin/doom POSIX compliance 2019-06-03 21:16:11 +10:00
Henrik Lissner
9bea168cc1
Rewrite doom-doctor
- Use message library instead of reinventing the wheel
- Fix -d/--debug support for `bin/doom doctor`
- Add indent and autofill support to print! and format!
- Add doom-message-backend for forcing format! to use a specific backend
- Phase out anaphoric when! macro in doctor scripts, it was hardly used
2019-04-24 18:16:05 -04:00
Henrik Lissner
348ba8f7d0
Correct type in bin/doom help 2019-04-04 18:54:27 -04:00
Henrik Lissner
2e4feed1a4
bin/doom: alias -h/--help to help command 2019-03-03 21:56:24 -05:00
Henrik Lissner
0d902e8cf1
bin/doom: demote missing -p path error to warning
The error would prevent bin/doom quickstart from working with a custom
private directory. Instead, just warn that it doesn't exist.

Fixes #974
2018-10-21 20:01:09 -04:00
Henrik Lissner
2637544022
bin/doom: refactor no-args error message
Dumping usage to stdout just drowns out the problem: they forgot a
command!
2018-09-30 00:55:39 -04:00
Henrik Lissner
a91df46aa8
bin/doom: revert debug-on-error = t
It's too destructive. Will sometimes crash the script with no error
output.
2018-09-28 21:59:06 -04:00
Henrik Lissner
8a8b5c6089 Refactor bin/doom & doom-dispatch
Done to make bin/doom produce better debugger output (and more readily).
A lot of bin/doom errors aren't recurring, so it's better to produce the
full error report ASAP.
2018-09-28 21:13:27 -04:00
Edwin Török
575c3cccd9 make compile: exit with non-zero code on error
This would allow the CI to fail to compilation errors.
2018-09-12 22:55:13 +01:00
Henrik Lissner
33d692a6be
Make bin/doom work when it's symlinked 2018-08-30 16:31:09 +02:00
Henrik Lissner
e5096f854d
bin/doom: minimize user-error messages 2018-08-19 03:24:41 +02:00
Ben Johnson
94092081db
Fix running make from inside doom
The `term.el` package defines an environment variable `EMACS` inside its shell process, containing the Emacs and term.el version, in a string that looks like this: `26.1 (term:0.96)`. This interferes with the `bin/doom` command, which expects that environment variable to be a path to an Emacs binary. Trying to run make inside a doom terminal thus gives you this error:

```
Emacs isn't installed
make: *** [Makefile:5: all] Error 1
```

This simple fix just checks if `$EMACS` looks like a term version string, and ignores it if so.
2018-08-14 01:08:13 -07:00
Henrik Lissner
9f9b7ad792
Add EMACSDIR envvar support to bin/doom
As an alternative to the -e/--emacsd options. Sometimes it is more
consistent to customize bin/doom this way. e.g.

EMACS=/another/bin/emacs DOOMDIR=~/someplace EMACSDIR=~/emacsd bin/doom install
2018-06-20 02:07:20 +02:00
Henrik Lissner
151858a8dc
Redesign Doom error handling
Another refactor, again to improve the locality of doom errors and make
the data that accompanies them more useful in determining the origin and
source of issues. Also, bin/doom is now a little more informative about
how to debug errors.
2018-06-20 02:07:12 +02:00
Henrik Lissner
fb406a165b
bin/doom: more feedback about enabled options 2018-06-15 04:22:05 +02:00
Henrik Lissner
2c0e93773b
bin/doom: set YES and DEBUG envvars on -y/-d 2018-06-15 04:13:03 +02:00
Henrik Lissner
bd55e53691
Add -i/--insecure flag to bin/doom 2018-06-15 03:58:04 +02:00
Henrik Lissner
90be135d8b
bin/doom: ensure default-directory is in emacs dir
user-emacs-directory could be changed elsewhere.
2018-06-05 17:26:45 +02:00
Henrik Lissner
a3889dc8b1
bin/doom: don't set DOOMDIR
Now that we use it for doom-private-dir
2018-06-05 17:26:31 +02:00
Henrik Lissner
08a453bd5e
bin/doom: show usage info if no command is entered 2018-06-02 02:56:18 +02:00
Henrik Lissner
6fdd6cb14c
bin/doom: respond to -h/--help
In case people try that before `help`
2018-06-02 02:55:52 +02:00
Henrik Lissner
d998ef3159
Fix emacs-lisp header in bin/doom 2018-05-29 23:14:33 +02:00