Commit graph

81 commits

Author SHA1 Message Date
Henrik Lissner
037b018cdd
feat: add .doommodule files
These optional dotfiles indicate the root of a module or module
group (:lang), and will later contain module metadata. They will also
serve as an alternative to packages.el and doctor.el, and will aide the
parts of the v3.0 module API concerned with resolving the current module
from a path (`doom-module-from-path`), which currently rely too heavily
on parsing path strings.

For now, however, they're simply placeholders.
2024-09-14 20:47:39 -04:00
Henrik Lissner
771fccc52b
nit: minor reformatting & revision
Also corrects the version string of obsolete variable `+mu4e-backend`.
2024-09-11 19:46:14 -04:00
Henrik Lissner
0d405329fe
fix(literate): improve error handling while tangling
Now emits more informative errors in the case that the user's config.org
doesn't exist or contains no src blocks.

Fix: #6717
2024-09-01 17:29:14 -04:00
Henrik Lissner
308444d612
fix(literate): detect symlinked literate config files
`file-in-directory-p` already resolves symlinks, but on the off chance
that `+literate-config-file` points to a symlink living in a
non-symlinked directory, this heuristic will fail to realize the current
buffer belongs to your config.

Close: #6704
2024-09-01 17:29:14 -04:00
Ellis Kenyő
d330642c2e
feat(literate): add +literate/find-heading command
A command for jumping to an Org heading in your literate org config
file.

Close: #7716
2024-07-06 20:40:08 -04:00
Henrik Lissner
88bb045388
docs(*): replace all-the-icons with nerd-icons
Also colorizes the leading icon in notices.
2023-09-16 20:19:11 +02:00
Henrik Lissner
962c643bad
fix(literate,mu4e): revert recent, unintended changes
Reverts changes that snuck into 5ac2a52.

Amend: 5ac2a5258b
Ref: #6873
2022-10-07 17:33:35 +02:00
TEC
5ac2a5258b docs: change link format 2022-10-05 01:01:19 +02:00
TEC
c82e7455bb fix(literate): use same org install when using CLI 2022-09-30 22:52:42 +02:00
Henrik Lissner
1c4217aa27
refactor: minor refactors & commentary revision
* lisp/doom-cli.el:
  - reference backport source commit.
  - doom-cli--restart: a type check is all we need here. This is a
    programmer error, not a user error.
* lisp/doom-editor.el (recentf): mention recentf-show-abbreviated (added in
  emacs-mirror/emacs@32906819ad)
* lisp/doom-keybinds.el (doom-init-leader-keys-h): move to
  doom-after-init-hook, in case the user customizes leader variables in
  a previous hook (like emacs-startup-hook or after-init-hook).
* lisp/doom-start.el: use eval-when! to compile out the section on
  non-macOS systems (when Doom gets around to compiling its core files,
  later).
* modules/config/literate/autoload.el (+literate-config-file): use
  file-name-concat instead of string concat. This relaxes the
  requirement that doom-user-dir end in a /; a requirement I intend to
  fully phase out.
* modules/lang/emacs-lisp/autoload.el (+emacs-lisp-non-package): remove
  empty map! macro in flycheck-emacs-lisp-check-form. The macro already
  no-ops at compile-time/in noninteractive sessions since b480ed51a3.
* modules/ui/hl-todo/config.el (hl-todo-keyword-faces): revise
  commentary for default hl-todo keywords.

Ref: emacs-mirror/emacs@32906819ad
Ref: b480ed51a3
2022-09-24 20:31:34 +02:00
Henrik Lissner
6c76b98dbb
refactor: use doom-module-*-file variables; add two
- Adds doom-module-packages-file and doom-module-metadata-file.
- Uses them and the other doom-module-*-file variables where they were
  previously hardcoded.
- Add .el extension to doom-module-{init,config}-file; it is now the
  consumer's responsibility to strip/change/keep the extension as they
  see fit.
2022-09-24 20:31:34 +02:00
TEC
e2608cbdd5 tweak(literate): clear the tangle output buffer
While this is a hidden buffer, it's raised when an error occurs. In such
situations, it can be a little confusing to see the result of every
tangle to date instead of just the last tangle. It's easy enough to
simple clear the buffer at the start of the tangle process.
2022-09-21 00:53:30 +02:00
TEC
18b661873e fix(literate): tangle with the same Org as Doom 2022-09-16 01:23:43 +02:00
Henrik Lissner
a5c80fcb4b
refactor: deprecate doom-private-dir for doom-user-dir
- Deprecates the doom-private-dir variable in favor of doom-user-dir.
- Renames the pseudo category for the user's module: :private -> :user.
- Renames the doom-private-error error type to doom-user-error.

Emacs uses the term "user" to refer to the "things" in user space (e.g.
user-init-file, user-emacs-directory, user-mail-address, xdg-user-dirs,
package-user-dir, etc), and I'd like to be consistent with that. It also
has the nice side-effect of being slightly shorter. I also hope
'doom-user-error' will be less obtuse to beginners than
'doom-private-error'.
2022-08-14 20:43:35 +02:00
Henrik Lissner
4cf5ae8be1
fix(literate): tangling loop on 'doom sync'
Why the setenv call wasn't persisted into session restart (#6642) needs
further investigation, but for now this seems to solve the issue.

Fix: #6642
2022-08-09 17:12:56 +02:00
Henrik Lissner
7c9d7a4551
fix(literate): report failures clearly
If tangling failed, it would do so silently, continuing on with the
'doom sync'. This causes a visible error instead, aborting the 'doom
sync'. Unfortunately, org-babel-tangle doesn't appear to produce any
errors, so this our error message can't be improved at this stage.

Fix: #6642
2022-08-08 18:23:47 +02:00
Henrik Lissner
1abcf913aa
revert: fix(docs): set mode in file-local vars
emacs-straight/org-mode@e22b4eb7aa introduced a breaking change that
made it impossible to rely on .dir-locals.el to change org-mode buffers
in $EMACSDIR to doom-docs-org-mode (without infinite recursion), so we
used file-local variables in 7e400ab.

emacs-straight/org-mode@215de6176b reverted that change, so we can use
.dir-locals.el again, and this is my preference, since it requires less
boilerplate across our hundreds of org files.

Ref: emacs-straight/org-mode@215de6176b
Ref: emacs-straight/org-mode@e22b4eb7aa
Revert: 7e400abdc0
2022-08-07 19:08:07 +02:00
Henrik Lissner
bcca96a69a
refactor(literate): remove unused envvar __DOOMRESTART
Also remove the "Restarting..." message; it's an implementation detail
that isn't important to the end user.
2022-08-05 00:49:17 +02:00
Henrik Lissner
1f8bf7accb
merge: rewrite-docs
I've omitted docs/*.org from this merge, as there is still work left to
do there, but I am pushing the module docs early so folks can benefit
from the new docs sooner.
2022-08-03 03:27:50 +02:00
Henrik Lissner
7e400abdc0
fix(docs): set mode in file-local vars
Due to emacs-straight/org-mode@e22b4eb, a replacement major mode (for
org-mode) can no longer be specified from .dir-locals.el, as it spirals
into infinite recursion. Therefore, a mode: line is needed in all Doom
docs.

Ref: emacs-straight/org-mode@e22b4eb7aa
2022-08-03 02:46:33 +02:00
Henrik Lissner
1255315bfc
refactor(docs): replace nav menus with virtual one
Now that the header is dynamically generated (when doom-docs-mode is
active), a literal header is unnecessary.
2022-08-02 19:37:07 +02:00
Henrik Lissner
e77a45bc22
docs: use lowercase keywords
As per Org's new defaults, which we're adopting elsewhere, so may as
well adopt it here.
2022-08-02 16:23:43 +02:00
Henrik Lissner
614a54b036
fix(literate): Doom core load paths
The file structure of the project was changed in b9933e6. This updates
the :config literate module to reflect that.

Amend: b9933e6637
2022-07-31 13:52:20 +02:00
Henrik Lissner
043d32fefd
fix(literate): load doom core when tangling
This exposes Doom's stdlib to the sub-process that tangles your literate
config, so that src blocks therein (or their header arguments) can call
upon them or reference its variables (like IS-LINUX et co).

Fix: #6588
2022-07-23 16:42:29 +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
74cc541597
refactor(literate): DRY tangling
And remove unused cache file.

Ref: #6281
2022-06-29 18:14:20 +02:00
TEC
8df91f0b33 feat(literate): add async config tangling 2022-06-23 03:13:55 +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
7246db457c docs: replace doom-source with doom-repo links
I will later use "source" to refer to module sources, so better we avoid
the terminology for now.
2022-02-01 18:55:27 +01:00
Henrik Lissner
88844e9cec docs: simplify internal docs links
Fewer links means less confusion.

- Merge doom-issue and doom-commit links into doom-ref (for auto-linking
  Issue/PR/commit references).
- Merge doom-module-source and doom-docs-source links into doom-source.
- Rename doom-report-issue to doom-report.
- Use '!' as the icon for module issues link.
- Remove doom-repo (replaced with "doom:*" in :lang org module).
- Add doomdir and emacsdir links to :lang org module.
2021-11-21 20:04:28 +01:00
Henrik Lissner
c27f005011 docs(:config): update READMEs to new format 2021-11-21 20:04:28 +01:00
Henrik Lissner
f604ce6d01 Minor refactors & reformatting 2021-05-25 10:35:21 -04:00
Henrik Lissner
8424e0a780 config/literate: simplify tangle process
This removes expansion of #+INCLUDE directives at tangle time because
it's too much trouble to maintain a workflow that org doesn't support,
without modifying the user's files, which goes against Doom's "your
system your rules" mantra. The tangling process is just too brittle to
hack without compounding edge cases.

Fixes #5089
2021-05-24 17:52:27 -04:00
Henrik Lissner
df3c221c73 cli: don't repeat "Executing..." line on restart 2021-05-24 17:32:46 -04:00
Henrik Lissner
18e1795a98 org-confirm-babel-evaluate = nil while tangling 2021-03-22 21:11:22 -04:00
Henrik Lissner
e08c5f537e Fix #4623: tangle to config.el by default
Only uses this if no compile destination is specified in header or src
block parameters.
2021-02-07 23:57:44 -05:00
Song Pan
338be4f212 Fix 404 link. 2020-11-11 12:33:30 +00:00
Henrik Lissner
4dc888d104
Tangle org files on save if in same dir as config.org 2020-08-28 04:33:56 -04:00
Henrik Lissner
362f101227
config/literate: fix hanging paren
Whoopsidoodlepopsicolanumptywombatbiscuitmuffin.
2020-08-27 17:30:43 -04:00
Henrik Lissner
666ea63591
config/literate: make default tangle target DOOMDIR/config.el
Rather than ./config.el, which means it will end up in the wrong place
if the user moves their config.org out of $DOOMDIR or into a
subdirectory.
2020-08-27 17:19:52 -04:00
Henrik Lissner
63a03848a3
Fix literate tangling on 'doom sync'
Relevant to #3746
2020-08-25 06:01:35 -04:00
Henrik Lissner
a8b7c00426
config/literate: don't add save hook more than once
Hinders the user's ability to disable tangle-on-save behavior.
2020-08-22 17:40:25 -04:00
Henrik Lissner
f83e6fe1cc
Fix #3804: rename TANGLE -> __TANGLE
So 'doom env' will naturally exclude it.
2020-08-22 03:37:14 -04:00
Henrik Lissner
bb1e2247dd
Fix #3781: command not found
Due to overzealous quoting.
2020-08-19 12:45:23 -04:00
Henrik Lissner
9b991fc29f
Fix #3781: revert 55b87b3a9 2020-08-19 12:10:14 -04:00
Henrik Lissner
55b87b3a94
bin/doom: source postscript instead
This way the postscript can refer to the doom script via "$0" and its
arguments via "$@" (making it easier for cli commands to rerun the last
command).
2020-08-18 20:32:34 -04:00
Henrik Lissner
cbebbd5278
Fix #3746: bin/doom hangs after tangling config
Because +literate-tangle-h wasn't returning non-nil in interactive
sessions.
2020-08-14 00:00:36 -04:00
Henrik Lissner
f5ba3d9498
config/literate: revise readme 2020-08-12 02:52:45 -04:00
Henrik Lissner
64dfc709bf
Fix #3729: config.org not getting tangled
Because the wrong file is being inserted into the temporary org buffer,
org never finds anything to tangle!
2020-08-11 14:00:33 -04:00
Henrik Lissner
eb9cb0c6e9
Fix org version conflicts due to literate config #3649
Tangling would load org libraries. If org hasn't been installed yet,
this means the older version is loaded, later interfering with the
installation and byte-compilation of the new package, causing down the
road.
2020-08-09 01:50:42 -04:00