Commit graph

17756 commits

Author SHA1 Message Date
Henrik Lissner
f350a28db2
revert: fix(rss): fix *rss* workspace doesn't exist
Removed by request.

Ref: #6422
Revert: f178eb6f52
2022-06-20 16:11:02 +02:00
Henrik Lissner
d1472c191e
tweak(cli): be verbose about site files in debug mode
More information for hapless debuggers like me!

Ref: #6473
2022-06-20 13:37:54 +02:00
Henrik Lissner
eb7329d912
fix(org): unbalanced parenthesis
Causing odd org related errors at startup or 'doom doctor'.

Amend: fb1c8eb11d
2022-06-20 03:45:46 +02:00
Henrik Lissner
210381bdcf
fix(lib): autoload format-spec on 27.x
This function wasn't autoloaded until 28, causing void-function errors
if it's used.
2022-06-20 03:02:25 +02:00
Henrik Lissner
343def0b1e
fix(cli): void-function relpath on 'doom compile' 2022-06-20 02:27:23 +02:00
Henrik Lissner
8b93e8b15c
fix(tabs): wrong-type-arg stringp (Git "...") error
Newer versions of project.el changed the return value of
`project-current` to a three-part list, rather than a cons cell.
centaur-tabs expects the old signature and we get a type error.

This advice ensures centaur-tabs works with old or new versions of
project, and is a temporary measure until the issue is resolved
upstream.

Ref: ema2159/centaur-tabs#181
Fix: #6280
2022-06-20 02:07:42 +02:00
Henrik Lissner
fb1c8eb11d
fix(org): lazy loading of org-protocol
First, removal of the old org-protocol advice needed to be updated,
because org-protocol-detect-protocol-server was renamed to
org--protocol-detect-protocol-server upstream.

Second, I only noticed now that our lazy loader for org-protocol wasn't
active until Org was loaded, which was far too late, and meant
org-protocol wasn't working out of the box. This fixes that.
2022-06-20 01:55:21 +02:00
Henrik Lissner
b81e4af66a
fix(cli): deploy git hooks to repo at $PWD, not $EMACSDIR 2022-06-19 23:05:33 +02:00
Henrik Lissner
d002e4c89d
dev(ci): comment out unused CI config
Until 'doom make {docs,codeowners}' are done, they'd throw errors.
2022-06-19 22:51:46 +02:00
Henrik Lissner
12e9b4422f
tweak(cli): show benchmark for doom {build,purge}
These two commands tend to take a while.
2022-06-19 22:51:46 +02:00
Henrik Lissner
ab7f7058f3
docs(cli): show correct command in error message
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.
2022-06-19 22:51:46 +02:00
Henrik Lissner
50a0c2ef46
fix(cli): ci.el loader
- :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.
2022-06-19 22:49:47 +02:00
Henrik Lissner
7862a9e15d
docs(cli): add more exit! usecases 2022-06-19 22:01:28 +02:00
Henrik Lissner
da74525cbc
tweak(cli): process arguments before executing CLIs 2022-06-19 21:39:17 +02:00
Henrik Lissner
d226946f59
fix(cli): aliases to pseudo commands
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
2022-06-19 21:26:53 +02:00
Henrik Lissner
92a5c28687
feat(rest): add +jq flag
Adds support for setting variables from results using jq expressions.

Ref: https://github.com/pashky/restclient.el
Ref: https://github.com/ljos/jq-mode
Close: #5238
2022-06-19 14:56:04 +02:00
Henrik Lissner
49ef0fa8dd
tweak(cli): improve message when no similar commands found
Rather than display a blank line, let the user know no similar commands
were found.
2022-06-19 13:07:28 +02:00
Henrik Lissner
6eefd4c1df
fix(cli): wrong-type-arg error on unrecognized command
If you type an unrecognized command, you get an "Error: unrecognized
command X" error, then a list of similar commands, followed by a
recommendation to check out 'doom help Y' or 'doom --help Y', where Y is
the nearest recognized parent command. E.g. 'doom ci blah' is an unknown
command, but 'doom ci' is known, therefore Y = 'doom ci'.

This fix ensures that Y is properly resolved.

Amend: 6c0b7e1530
2022-06-19 13:03:28 +02:00
Henrik Lissner
446e1432bc
fix(cli): show full synopsis for pseudo commands
Before:
  $ doom help help
  Usage:  COMMAND [ARGS...]

  TODO

  TODO

After:
  Usage: doom help [-g|--no-global] [--manpage] [--commands]
                   [--synopsis|--subcommands|--similar|--envvars|--postamble] [--]
                   COMMAND [ARGS...]

  Show documentation for a Doom CLI command.

  OPTIONS:
    -g, --no-global
      Hide global options.

    --manpage
      Generate in manpage format.

    --commands
      List all known commands.

    --synopsis, --subcommands, --similar, --envvars, --postamble
      Show only the specified sections..

Amend: 6c0b7e1530
2022-06-19 12:50:21 +02:00
Henrik Lissner
8d881f44c4
fix(cli): various errors in 'doom help'
- Wrong number of arguments: #<subr max> 0
- Symbol's value as variable is void: localonly?

Amend: 6c0b7e1530
2022-06-19 12:50:21 +02:00
Henrik Lissner
42d84e7e21
fix(cli): possible divide-by-zero when calculating similarity
If given two empty strings (which doesn't happens anywhere in the
codebase atm, but just in case).
2022-06-19 12:50:17 +02:00
Henrik Lissner
979495cf33
fix(cli): void-function doom-clean-byte-compiled-files on 'doom upgrade'
This function was renamed in 6c0b7e1.

Amend: 6c0b7e1530
2022-06-19 12:08:24 +02:00
Henrik Lissner
fb7f4c6cbe
fix(cli): time out if native-comp hangs
Some packages (primarily vterm, evil-collection, and with-editor) end up
hanging their native compilation process. In vterm's case it's because
it invisibly prompts to compile its module then waits forever for user
input that'll never come. I haven't figured out why it happens for the
others though.

In any case, since the workaround is to simply kill these processes and
carry on, I added this timeout mechanism to do it for you (timing out
after 30s of no movement). A more elegant solution will have to wait
until the rewrite of our package manager.

Fix: #5592
2022-06-19 12:01:52 +02:00
Henrik Lissner
837f404fbc
fix(lib): update doom/reload & doom/reload-autoloads
To reflect changes to bootstrapper made in 1402db5.

Amend: 1402db5129
Fix: #6470
2022-06-19 11:48:17 +02:00
Henrik Lissner
33d9e741b0
refactor(ci): move .github/ci.el to /ci.el
So 'doom ci' picks up on this project's CI settings.
2022-06-19 03:18:57 +02:00
Henrik Lissner
f913ff07b3
fix(cli): void-function doom-packages-install error on 'doom install' 2022-06-19 03:00:10 +02:00
Henrik Lissner
074f63ff31
fix(cli): ignore invalid __DOOMGEOM value 2022-06-19 02:44:00 +02:00
Henrik Lissner
beef0aef02
fix(cli): split tput call into two separate calls
This fixes an issue where, on some systems, `tput cols lines` does not
produce "N\nM" (where N = number of columns in the terminal and M =
number of lines), and instead produces "N\n", causing parsing errors.
2022-06-19 02:39:22 +02:00
Henrik Lissner
8816508d6c
fix(cli): update 'doom upgrade'
To reflect changes made in 6c0b7e1.

Amend: 6c0b7e1530
2022-06-19 02:34:23 +02:00
Henrik Lissner
f4e7e8be56
fix(cli): type error when __DOOMGEOM is empty 2022-06-19 02:20:34 +02:00
Henrik Lissner
09ddac1d7a
feat(cli): resolve EMACSDIR to doomscript's parent directory
If no EMACSDIR is given, assume ../ is the Emacs config we want to
operate out of, taking after bin/doom.

And use bash. This script was designed for the convenience of other
scripters on unix systems, so it can afford a small hit to portability.
2022-06-19 02:20:34 +02:00
Henrik Lissner
74f3c1d11c
fix(cli): doom {compile,clean} errors
- An improper autoload was preventing 'doom clean' from being
  recognized.
- 'doom compile' hadn't been updated to reflect changes introduced
  recently in 1402db5.

Amend: 6c0b7e1530
Ref: 1402db5129
2022-06-19 01:39:32 +02:00
Henrik Lissner
6963b784cc
refactor(cli): extract doom/info renderer
Into doom-info-string, which will wrap its contents to a given column
using the new print library.
2022-06-19 01:31:56 +02:00
Henrik Lissner
23678c52fe
refactor(lib): tidy up doom/version 2022-06-19 01:31:38 +02:00
Henrik Lissner
498d88ba9b
feat(cli): add -j/--jobs NUM options
To 'doom sync', 'doom upgrade', and 'doom build'. So users can decide
whether they want Doom 100%'ing their CPUs.

After 3.0, many of these commands will be merged, so a little code
duplication is fine for now.
2022-06-19 01:29:40 +02:00
Henrik Lissner
89e02c1c2b
fix(cli): wrong-number-of-args error on 'doom upgrade'
When I added call! to the DSL, I forgot to update doom-cli-call calls.
This should quell these errors when running 'doom upgrade':

  x There was an unexpected runtime error
    Message: Wrong number of arguments
    Details: (((cl-struct-doom-cli-context-tags cl-struct-doom-cli-option-...
    Backtrace:
      (doom-cli-call ("doom" "sync" "-u"))
      (cond (packages\? (doom-cli-call sync-cmd) (doom-print (doom-print-...

Amend: 6c0b7e1530
2022-06-19 01:17:25 +02:00
Henrik Lissner
647abad97d
fix(cli): void-variable ansi-color--control-seq-fragment-regexp
This variable wasn't introduced until Emacs 29.

Amend: 6c0b7e1530
2022-06-19 01:15:02 +02:00
Henrik Lissner
2e9997a3d5
fix(cli): void-variable doom-repo-* errors on 'doom upgrade'
Amend: 6c0b7e1530
2022-06-19 01:10:54 +02:00
Henrik Lissner
d5db9076af
fix(cli): wrong-number-of-args error on 'doom sync'
Amend: 6c0b7e1530
2022-06-19 01:07:01 +02:00
Henrik Lissner
81a52402b2
fix(cli): void-variable packages-only?
Amend: 6c0b7e1530
2022-06-19 01:05:26 +02:00
Henrik Lissner
58561ba278
dev: update workflows
- Remove defunct test workflow (will be replaced later).
- Pass secrets into add-to-project so it can see our github token.
2022-06-19 01:01:35 +02:00
Henrik Lissner
3633c19df8
docs: recommend Emacs 28.1 instead of 27.2 2022-06-18 23:53:12 +02:00
Henrik Lissner
daad6bc21d
feat(cli): add 'doom make completions' for zsh
'doom make completions' will generate a rudimentary ZSH completion
script for bin/doom. It can be used from your shell dotfiles, but I
recommend caching the output with a function like:
https://github.com/hlissner/dotfiles/blob/master/config/zsh/.zshenv#L1-L14.

Then add this to your .zshrc:

  _cache doom make completions --zsh && compdef _doom doom

Ref: https://github.com/hlissner/dotfiles/blob/master/config/zsh/.zshenv#L1-L14
2022-06-18 23:53:12 +02:00
Henrik Lissner
e5b7edcd8d
feat(cli): add bin/doomscript
Meant as a simple elisp interpreter with Doom's CLI framework preloaded.
Can be used as a shebang line:

  #!/usr/bin/env doomscript
  (princ "hello world!")

This isn't used for bin/doom because it requires doomscript be in your
$PATH, and any attempt to resolve its location in bin/doom's shebang
line would reduce its portability. Neither of these should be an issue
for the type of user who'd find this useful.
2022-06-18 23:53:12 +02:00
Henrik Lissner
149306ef01
fix(ci): update ci config
To reflect recent changes to Doom's CLI framework.
2022-06-18 23:53:12 +02:00
Henrik Lissner
6c0b7e1530
refactor!(cli): rewrite CLI framework libraries
BREAKING CHANGE: this changes Doom's CLI framework in subtle ways, which
is listed in greater detail below. If you've never extended Doom's CLI,
then this won't affect you, but otherwise it'd be recommended you read
on below.

This commit focuses on the CLI framework itself and backports some
foundational changes to its DSL and how it resolves command line
arguments to CLIs, validates input, displays documentation, and persists
state across sessions -- and more. This is done in preparation for the
final stretch towarding completing the CLI rewrite (see #4273).

This is also an effort to generalize Doom's CLI (both its framework and
bin/doom), to increase it versatility and make it a viable dev tool for
other Doom projects (on our Github org) and beyond.

However, there is a *lot* to cover so I'll try to be brief:

- Refactor: generalize Doom's CLI framework by moving all bin/doom
  specific configuration/commands out of core-cli into bin/doom. This
  makes it easier to use bin/doom as a project-agnostic development
  tool (or for users to write their own).
- Refactor: change the namespace for CLI variables/functions from
  doom-cli-X to doom-X.
- Fix: subcommands being mistaken as arguments. "doom make index" will
  resolve to (defcli! (doom make index)) if it exists,
  otherwise (defcli! (doom make)) with "index" as an argument. Before
  this, it would resolve to the latter no matter what. &rest can
  override this; with (defcli! (doom make) (&rest args)), (defcli! (doom
  make index)) will never be invoked.
- Refactor!: redesign our output library (was core/autoload/output.el,
  is now core/autoload/print.el), and how our CLI framework buffers and
  logs output, and now merges logs across (exit! ...) restarts.
- Feat: add support for :before and :after pseudo commands. E.g.

    (defcli! (:before doom help) () ...)
    (defcli! (:after doom sync) () ...)

  Caveat: unlike advice, only one of each can be defined per-command.
- Feat: option arguments now have rudimentary type validation (see
  `doom-cli-option-arg-types`). E.g.

    (defcli! (doom foo) ((foo ("--foo" num))) ...)

  If NUM is not a numeric, it will throw a validation error.

  Any type that isn't in `doom-cli-option-arg-types` will be treated as a
  wildcard string type. `num` can also be replaced with a specification,
  e.g. "HOST[:PORT]", and can be formatted by using symbol quotes:
  "`HOST'[:`PORT']".
- Feat: it is no longer required that options *immediately* follow the command
  that defines them (but it must be somewhere after it, not before). E.g.
    With:
      (defcli! (:before doom foo) ((foo ("--foo"))) ...)
      (defcli! (doom foo baz) () ...)
    Before:
      FAIL: doom --foo foo baz
      GOOD: doom foo --foo baz
      FAIL: doom foo baz --foo
    After:
      FAIL: doom --foo foo baz
      GOOD: doom foo --foo baz
      GOOD: doom foo baz --foo
- Refactor: CLI session state is now kept in a doom-cli-context struct (which
  can be bound to a CLI-local variable with &context in the arglist):

    (defcli! (doom sync) (&context context)
      (print! "Command: " (doom-cli-context-command context)))

  These contexts are persisted across sessions (when restarted). This is
  necessary to support seamless script restarting (i.e. execve
  emulation) in post-3.0.
- Feat: Doom's CLI framework now understands "--". Everything after it will be
  treated as regular arguments, instead of sub-commands or options.
- Refactor!: the semantics of &rest for CLIs has changed. It used to be "all
  extra literal, non-option arguments". It now means *all* unprocessed
  arguments, and its use will suppress "unrecognized option" errors, and
  tells the framework not to process any further subcommands. Use &args
  if you just want "all literal arguments following this command".
- Feat: add new auxiliary keywords for CLI arglists: &context, &multiple,
  &flags, &args, &stdin, &whole, and &cli.
  - &context SYM: binds the currently running context to SYM (a
    `doom-cli-context` struct). Helpful for introspection or passing
    along state when calling subcommands by hand (with `call!`).
  - &stdin SYM: SYM will be bound to a string containing any input piped
    into the running script, or nil if none. Use
    `doom-cli-context-pipe-p` to detect whether the script has been
    piped into or out of.
  - &multiple OPTIONS...: allows all following OPTIONS to be repeated. E.g. "foo
    -x a -x b -x c" will pass (list ("-x" . "a") ("-x" . "b") ("-x" .
    "c")) as -x's value.
  - &flags OPTIONS...: All options after "&flags" get an implicit --no-* switch
    and cannot accept arguments. Will be set to :yes or :no depending on which flag is
    provided, and nil if the flag isn't provided. Otherwise, a default
    value can be specified in that options' arglist. E.g.

      (defcli! (doom foo) (&flags (foo ("--foo" :no))) ...)

    When called, this command sets FOO to :yes if --foo, :no if --no-foo, and
    defaults to :no otherwise.
  - &args SYM: this replaces what &rest used to be; it binds to SYM a
    list of all unprocessed (non-option) arguments.
  - &rest SYM: now binds SYM to a list of all unprocessed arguments, including
    options. This also suppresses "unrecognized option" errors, but will render
    any sub-commands inaccessible. E.g.

      (defcli! (doom make) (&rest rest) ...)
      ;; These are now inaccessible!
      (defcli! (doom make foo) (&rest rest) ...)
      (defcli! (doom make bar) (&rest rest) ...)
  - &cli SYM: binds SYM to the currently running `doom-cli` struct. Can also be
    obtained via `(doom-cli-get (doom-cli-context-command context))`. Possibly
    useful for introspection.
- feat: add defobsolete! macro for quickly defining obsolete commands.
- feat: add defalias! macro for quickly defining alias commands.
- feat: add defautoload! macro for defining an autoloaded command (won't
  be loaded until it is called for).
- refactor!: rename defcligroup! to defgroup! for consistency.
- fix: CLIs will now recursively inherit plist properties from parent
  defcli-group!'s (but will stack :prefix).
- refactor!: remove obsolete 'doom update':
- refactor!: further generalize 'doom ci'
  - In an effort to generalize 'doom ci' (so other Doom--or
    non-doom--projects can use it), all its subcommands have been
    changed to operate on the current working directory's repo instead
    of $EMACSDIR.
  - Doom-specific CI configuration was moved to .github/ci.el.
  - All 'doom ci' commands will now preload one of \$CURRENT_REPO_ROOT/ci.el or
    \$DOOMDIR/ci.el before executing.
- refactor!: changed 'doom env'
  - 'doom env {-c,--clear}' is now 'doom env {clear,c}'
  - -r/--reject and -a/--allow may now be specified multiple times
- refactor!: rewrote CLI help framework and error handling to be more
  sophisticated and detailed.
- feat: can now initiate $PAGER on output with (exit! :pager) (or use
  :pager? to only invoke pager is output is longer than the terminal is
  tall).
- refactor!: changed semantics+conventions for global bin/doom options
  - Single-character global options are now uppercased, to distinguish them from
    local options:
    - -d (for debug mode) is now -D
    - -y (to suppress prompts) is now -!
    - -l (to load elisp) is now -L
    - -h (short for --help) is now -?
  - Replace --yes/-y switches with --force/-!
  - -L/--load FILE: now silently ignores file errors.
  - Add --strict-load FILE: does the same as -L/--load, but throws an error if
    FILE does not exist/is unreadable.
  - Add -E/--eval FORM: evaluates arbitrary lisp before commands are processed.
  - -L/--load, --strict-load, and -E/--eval can now be used multiple times in
    one command.
  - Add --pager COMMAND to specify an explicit pager. Will also obey
    $DOOMPAGER envvar. Does not obey $PAGER.
- Fix #3746: which was likely caused by the generated post-script overwriting
  the old mid-execution. By salting the postscript filenames (with both an
  overarching session ID and a step counter).
- Docs: document websites, environment variables, and exit codes in
  'doom --help'
- Feat: add imenu support for def{cli,alias,obsolete}!

Ref: #4273
Fix: #3746
Fix: #3844
2022-06-18 23:53:12 +02:00
Henrik Lissner
6c5537b487
fix(emacs-lisp): eval forms from within the current buffer
This fix ensures that functions/macros that are evaluated with +eval/*
et co will remember where they were defined (if possible), so you don't
have to see this in their documentation again:

  FUNCTION is a function without a source file.

Ref: https://github.com/doomemacs/doomemacs/pull/6444#issuecomment-1159457888
2022-06-18 18:19:39 +02:00
NightMachinery
ff7ae66372
fix(org): make last arg of +org--follow-search-string-a optional
To accommodate the optional second argument of org-roam-id-open in
org-roam-v1.

Ref: 946a879a4a/org-roam.el (L1140)
2022-06-18 17:25:22 +02:00
Strikerlulu
1ed1064ce1
feat(nix): add generic completing-read support to +nix/lookup-option 2022-06-18 17:22:47 +02:00
Sam Jones
a8dabe1aec fix(go): exactly match test function name 2022-06-18 17:21:20 +02:00