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
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
--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
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
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
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.
- 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
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
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
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))
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
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
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).
- 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.
BREAKING CHANGE: This renames the fn! macro to lambda! and fn!! to fn!.
I hadn't put much thought into their names when they were added, but now
that they're seeing more use, I've reconsidered.
The reasoning is (and I'll refer to them by their new names):
- If you're using fn!, you care more about the syntax's brevity, than if
you were using lambda!, so I wanted fn! to have the (even if slightly)
shorter name.
- lambda! decorates native lambda (with cl-function). Its old name
did not suggest that connection like other !-macros in Doom's library
do.
- Their old names implied the two macros were somehow related or that
one decorated the other. They aren't and don't.
'doom help' is aliased to the pseudo command ':help'. (doom-cli-find
'("doom" "help")) would return a list of all CLIs that are pertinent to
'doom help's execution, but it resolves aliases, making it unclear to
recipients of this list what the initial command was.
This requires callers resolve the CLIs themselves, but at least now the
user has the choice.
So the doctor doesn't complain about pseudo packages, like revealjs,
which is not actually an Emacs package, we're just using straight.el to
install it for org-re-reveal.
Before:
$ doom ci hook commit-msg test
Error: "doom ci" expected 0 arguments, but got 1
Usage: doom ci COMMAND [ARGS...]
See 'doom h[elp] ci' or 'doom ci {-?,--help}' for documentation.
After:
$ doom ci hook commit-msg test
Error: ":before doom ci" expected 0 arguments, but got 1
Usage: doom ci hook commit-msg FILE
See 'doom h[elp] ci hook commit-msg' or 'doom ci hook commit-msg {-?,--help}' for documentation.
- :before ci will try to load $REPOROOT/ci.el or $DOOMDIR/ci.el. It
finds $REPOROOT by calling `git`, but doesn't handle errors. Now it
does.
- Because &rest was in :before ci's argspec, :before ci * subcommands
would be inaccessible (not that any exist atm, though).
- Let the user know when it finds the project's ci.el.
To understand what's going on here, understand this: this is a regular
CLI command:
(defcli! (doom sync) () ...)
And this is a pseudo command:
(defcli! (:before doom sync) () ...)
If a pseudo command is aliased to another pseudo command:
(defcli! (:before doom (foo bar baz)) ...)
In which case, ':before doom bar' and ':before doom baz' are aliases for
':before doom foo', there was a bug that cut out the keyword, so in
actuality, ':before doom {bar,baz}' were aliased to 'doom bar'.
This fixes that, and the peculiar issue of 'doom purge' executing 'doom
build' due to this, living in core/cli/packages.el:
(defcli! (:before (build b purge p)) (&context context)
(require 'comp nil t)
(doom-initialize-core-packages))
Ref: https://github.com/doomemacs/doomemacs/issues/4273#issuecomment-1159610824