Commit graph

5255 commits

Author SHA1 Message Date
Henrik Lissner
f8fb8b189d
refactor(cli): remove unused synopsis examples
These can be included in their own EXAMPLES: section, and doesn't need
to be treated especially.
2022-07-30 22:41:12 +02:00
Henrik Lissner
a79b2ec69e
fix(cli): ensure order of subcommands in 'doom help'
They should be in insertion order. They were formerly in
reverse-insertion order.
2022-07-30 22:41:12 +02:00
Henrik Lissner
a2d2206797
feat(cli): allow defcli! in ci.el
A project may provide a ci.el to config bin/doom's CI commands. With
this, users can also define their own 'doom ci' subcommands from there.
2022-07-30 22:40:27 +02:00
Henrik Lissner
04a09128d4
nit(cli): stub 'doom test'
To prep for v3.1.
2022-07-30 22:23:12 +02:00
Henrik Lissner
6ffee6ece7
fix(cli): ensure type specs are case insensitive 2022-07-29 12:34:58 +02:00
Henrik Lissner
491f49cfe5
refactor(cli): better error for missing profiles.el
Only appears if a profile was requested and no profile file was found.
2022-07-29 12:32:35 +02:00
Henrik Lissner
068966a4cd
bump: :core
Fuco1/smartparens@ec15aaa748 -> Fuco1/smartparens@8b6a3c3b31
bbatsov/projectile@4d6da873ae -> bbatsov/projectile@dc6e7ff658
domtronn/all-the-icons.el@ca1ef30004 -> domtronn/all-the-icons.el@b18db6be0a
jscheid/dtrt-indent@57f4072fa8 -> jscheid/dtrt-indent@d4fd1b4977
jwiegley/use-package@a7422fb8ab -> jwiegley/use-package@0ad5d9d5d8
radian-software/straight.el@0e204d418d -> radian-software/straight.el@fed2153480
2022-07-29 12:31:44 +02:00
Henrik Lissner
493a049dff
tweak: disable tty optimization in debug mode
If an error occurs before tty-run-terminal-initialization
does (producing a backtrace window), it can leave Emacs in a garbled,
unreadable state.
2022-07-29 12:24:25 +02:00
Henrik Lissner
7a9f8b18ab
refactor: resolve doom-{core,modules}-dir properly
Future proofing for changes in doom-emacs-dir.
2022-07-29 12:23:42 +02:00
Henrik Lissner
7d93feb98c
nit: minor reformatting, comment revision, & sharpquoting 2022-07-29 12:22:33 +02:00
Henrik Lissner
35a89bdfa6
fix(lib): missing bin/doom error on doom/reload
doom/reload quotes `doom-bin`, but if doom-bin uses a tilde instead of
an absolute path, the quoting means it won't be expanded to $HOME,
causing "no such file or directory" errors when trying to execute it.

Fix: #6603
2022-07-28 22:29:32 +02:00
Henrik Lissner
a22cd75839
fix(cli): log benchmarks & postscripts to stderr
And only write benchmark to stdout if the command succeeded (exit code =
0) and isn't restarting (exit code = 254).
2022-07-28 22:29:32 +02:00
Henrik Lissner
fe2ea9f443
fix(cli): redundant lines in stderr logs 2022-07-28 22:29:32 +02:00
Henrik Lissner
20d5440023
fix(cli): don't persist options/args in context
They're overwritten anyway. And leftover state can cause confusion in
sub-sessions.
2022-07-28 22:29:18 +02:00
Henrik Lissner
7eeec53c30
fix(cli): improve end-of-file error in profiles file
Otherwise, the error message complains that the error originates from
core-cli.el.
2022-07-28 18:15:15 +02:00
Henrik Lissner
12b52909e3
fix(cli): env setter for profile loader
Amend: 48e3603dfe
2022-07-28 18:15:15 +02:00
Henrik Lissner
743b740e79
fix(cli): verbose output in debug mode 2022-07-28 18:15:15 +02:00
Henrik Lissner
49d3f1e96c
feat(cli): accept omit list on (exit! :restart)
A list of arguments to omit can now be passed to (exit! :restart). For
example, `(exit! :restart "-c" :omit "--foo=" "--bar" "--baz=2")` will
restart the current script with a new switch (-c) and three switches
removed (--foo + one argument, --bar, --baz + two arguments).
2022-07-28 18:05:42 +02:00
Henrik Lissner
22eace62d0
fix: doom-local-dir for profiles
- Ensure it ends in slash,
- Ensure it includes the @-tag (e.g. default@latest),
- Remove vestigial code path that is unreachable.
2022-07-28 12:40:32 +02:00
Henrik Lissner
df8caf2867
nit(cli): revise header commentary
To properly reflect that it's unsafe to load core-cli in interactive
sessions, but safe to load core-cli-lib.
2022-07-28 12:01:02 +02:00
Henrik Lissner
5af38fb08e
feat: make bin/doom profile aware
- Fixes Doom's former inability to (trivially) juggle multiple profiles
  based on the same EMACSDIR (see #6593).
- Adds '--profile NAME' switch to bin/doom (also recognized
  $DOOMPROFILE).
- Adds new doom-profile* variables. These will eventually replace
  doom-{local,etc,cache}-dir and doom-{autoloads,env}-file.

This is intentionally messy to ensure backwards compatibility for a
little while longer. This will be fixed over the next couple weeks.

Ref: #6593
2022-07-28 12:01:02 +02:00
Henrik Lissner
1448b8eee1
refactor(cli): remove redundant ensure-list call 2022-07-24 13:16:02 +02:00
Henrik Lissner
87b165fdfb
perf(cli): gc-cons-percentage = 1.0
This is the new default for this variable in 29 (for batch sessions);
I'm backporting it because it's sensible.

Ref: https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS#L120-L125
2022-07-23 16:42:29 +02:00
Henrik Lissner
8308d68b61
fix: support :source and :inherit in package! :recipe
These are straight.el keywords that package! would fail to recognize
until now.
2022-07-23 16:42:29 +02:00
Álan Crístoffer
b636d9e793
fix: strip './' from projectile file list produced by fd
Fix: #6504
Ref: bbatsov/projectile#1784
2022-07-23 15:57:23 +02:00
Henrik Lissner
cd8fb0059d
fix(cli): validation for regexp arguments
string-match-p throws an error if given an invalid regexp, which is what
we *should* be testing for, not its return value (which should be
ignored), but this wasn't the case before this commit.

Fix: #6534
2022-07-05 14:15:06 +02:00
Henrik Lissner
e35cc0dfe7
release(modules): 22.07.0-dev
Ref: 2b39e41368
2022-07-04 21:12:13 +02:00
Henrik Lissner
94a4a7a58b
fix(cli): display global options in --help output
Global options were omitted in help output for subcommands before this
fix. This caused #6533, where the user was unable to find the correct
option to suppress prompts because 'doom upgrade --help' would not show
--force/-!, but 'doom --help' would. Still, it's unreasonable to expect
the user to know this beforehand.

Ref: #6533
2022-07-04 18:44:01 +02:00
Henrik Lissner
38a3a50951
fix(cli): void-function always
`always` was added in Emacs 28 and is unavailable to 27.x users, which
is unacceptable while Doom supports 27.x.

Fix: #6532
Amend: 74cc541597
2022-07-04 18:37:05 +02:00
Henrik Lissner
af4c18e283
fix(cli): recognize command argument for --pager
--pager incorrectly expected a boolean argument, when it should accept
any arbitrary pager command (set to a blank string to disable the
pager).

Ref: #6526
2022-07-04 02:58:17 +02:00
Henrik Lissner
442d607ec0
fix: remove outdated uses of user-emacs-directory
Doom changes user-emacs-directory (see 46844b5 for explanation), so
doom-emacs-dir should be used to refer to your $EMACSDIR instead.

Fix: #6530
Ref: 46844b55de
2022-07-04 02:58:11 +02:00
Henrik Lissner
7d0d90ec50
revert: refactor(lib): remove doom-apply-ansi-color-to-compilation-buffer-h
ansi-color-compilation-filter wasn't introduced until Emacs 28, so this
removal was too hasty, but should be reconsidered when we drop 27.x
support.

Fix: #6515
Revert: 2f7171bf8a
2022-06-29 18:14:21 +02:00
Henrik Lissner
14b2395424
refactor: remove unused core variables
doom-debug-p and doom-interactive-p have always been intentionally
redundant, because changing the variables they replaced had other
side-effects, which made writing tests for them difficult. Since our
new (yet unpublished) tests lean heavily toward integration testing more
than unit testing, this becomes an implementation detail.

And doom-init-p's only use was refactor out at some point in the past,
so it's no longer used.

Also done to reduce Doom's footprint, in general.
2022-06-29 18:14:20 +02:00
Henrik Lissner
a65e97bf2c
fix(cli): return *all* aliases from doom-cli-aliases
Now it walks the command tree breadth-first to collect *all* aliases
that lead to the given command.
2022-06-22 23:04:59 +02:00
Henrik Lissner
001065ba42
refactor(cli): minor refactors & allow flychecker in CLIs
- Add comments to doom-cli-context-parse.
- Simplify/inline code here and there.
- Remove sacrifice to appease byte-compiler.

Thanks to a346928 there's no need to appease the byte-compiler with this
eval-when-compile hackery.

Ref: a34692826f18
2022-06-22 23:04:54 +02:00
Henrik Lissner
e651547abb
fix(cli): &rest not consuming rest of arguments
An edge case that occurs when no options are supplied to make arguments
non-null.
2022-06-22 23:04:14 +02:00
Henrik Lissner
2aca862187
fix(cli): prevent oversized error data spam
A backtrace with a sufficiently large object (especially with circular
references) could unhelpfully flood the screen.
2022-06-22 23:04:14 +02:00
Henrik Lissner
2660fcce25
fix(cli): not printing straight log after it errors
This regression was introduced in 6c0b7e1, preventing the debugger from
printing straight.el's process log when a straight.el error occurs.
Instead, it would print a less-than-helpful backtrace.

Amend: 6c0b7e1530
2022-06-22 23:04:14 +02:00
Henrik Lissner
666cc1fda7
refactor(cli): remove :stub, :obsolete, :deprecated, :since
I've removed these CLI properties because they were either
unused (:deprecated and :since) or poorly implemented (:stub and
:obsolete). And I'd rather have fewer magical properties, and instead
delegate these roles to the defobsolete! and (new) defstub!  macros.
Also, in the future, the help API will ascertain :since dynamically, so
it won't be very useful.

In summary:
- Use defstub! instead of :stub
- Use defobsolete! instead of :obsolete or :deprecated
- This removes the doom-cli-deprecated-error type (it's not really an
  error to begin with).
- Removes :stub, :obsolete, :deprecated, and :since
2022-06-22 23:04:14 +02:00
Henrik Lissner
a4aab45656
fix(emacs-lisp): flycheck false positives in Doom configs 2022-06-22 23:04:00 +02:00
Henrik Lissner
e4aa07f811
feat(cli): record aliases in doom-cli-context-path
doom-cli-context-path stores the path taken to get to the current
command. For example, given:

  (defcli! (doom boop) () ...)
  (defcli! (doom baz) () (call! '(boop)))
  (defalias! (doom bar) (doom baz))
  (defalias! (doom foo) (doom bar))
  (run! "doom" "foo")

Then the doom-cli-context-path by 'doom boop' will be:

Before this commit: ((doom baz))
After this commit:  ((doom baz) (doom bar) (doom foo))
2022-06-22 20:35:52 +02:00
Henrik Lissner
23b289b9a5
feat(cli): fall back to :docs for docstring
Also allows for a dynamically generated docstring. Careful though, it's
evaluated when `defcli!` is evaluated, not when the CLI is executed.
2022-06-22 20:35:17 +02:00
Henrik Lissner
834ff3ea85
fix(cli): autoloaded clis aliased to wrong commands
I use a shortcut like this to autoload multiple (different) CLIs living
in the same file:

  (defautoload! ((foo bar baz)) "file")

However, this creates premature aliases between autoloaded CLIs. When
'baz' is invoked, instead of loading "file", it resolves to 'foo'
first *then* loads it, causing 'foo' to be executed instead of 'baz'.
This commit fixes that.

Also, minor refactor: I removed the plist argument from a
doom-cli-command-normalize call because it wasn't needed or useful to
the consumer of its return value.

Amend: d226946f59
2022-06-22 02:27:34 +02:00
Henrik Lissner
f0e8728bbc
fix(lib): restart-emacs name collision on Emacs 29+
Emacs 29 introduces a new command: restart-emacs, which clashes with the
more featureful restart-emacs package that Doom installs to manage the
session. Fortunately, the built-in one is defines in files.el, which is
eagerly loaded at startup, so as long as the third-party one is
loaded (at some point), it shouldn't be a problem.

Fix: #6492
2022-06-22 01:10:07 +02:00
Henrik Lissner
6d0639d101
fix(lib): avoid doom-load-session on restart if not in Doom
If for some reason you restart into another config (or startup fails for
one reason or another), don't call doom-load-session and break things.
2022-06-21 23:33:07 +02:00
Henrik Lissner
66d06261aa
perf(lib): factor seq out of fn! & bake in lookup table
A little more time and space gained by cutting out seq entirely and
pre-generating the argument lookup table. At least, in uncompiled use
cases.

The original implementation used regexp to lookup arguments, which
was (relatively) expensive. By comparison, using `assq` is *much*
faster, especially for datasets this small; and more so when I get
around to byte-compiling Doom's core (assq has its own byte-compiler
opcode).
2022-06-21 23:27:19 +02:00
Henrik Lissner
1583db5983
fix(lib): void-variable x error in fn!
Amend: 72a8485d77
2022-06-21 23:01:13 +02:00
Henrik Lissner
5519c030ff
fix(cli): -!/--force being ignored
Forgot to adapt the old code to use doom-cli-context struct!

Fix: #6485
2022-06-21 23:00:00 +02:00
Henrik Lissner
72a8485d77
perf(lib): optimize fn! macro
- Reduces allocations by avoiding copies produced by reverse and seq,
  and by avoiding a closure.
- Reduces runtime by avoiding the overhead of seq's generics.
2022-06-21 22:51:45 +02:00
Henrik Lissner
681d40ab58
refactor(lib): use feature checks for backports
Instead of imprecise version checks.

Fix: #6489
2022-06-21 21:29:08 +02:00