Commit graph

28 commits

Author SHA1 Message Date
Henrik Lissner
272a8c23a9
docs: revise and fix nerd-icons doctor check
Also fixes an issue where errors weren't counted, so the explanation
would never appear.

Fix: #7431
2024-05-21 17:16:12 +02:00
Ellis Kenyő
cb016f2dba
refactor!: replace all-the-icons with nerd-icons
BREAKING CHANGE: This commit replaces all-the-icons with nerd-fonts. Any
all-the-icons-* function calls or variable references in your private
config will break and should be replaced with their nerd-icons-*
equivalent. That said, Doom will continue to install all-the-icons for
a while, so feel free to load it if you don't want to fully commit to
the change yet.

This change is happening because nerd-icon has wider support for GUI and
TUI Emacs; has a larger, more consistent selection of symbols; plus unicode
coverage.

Fix: #7368
Close: #6675
Close: #7364
2024-05-21 17:15:56 +02:00
Henrik Lissner
13e4cb4a6f
docs: add fish shell check 2024-05-21 17:15:55 +02:00
Henrik Lissner
9c2b1846a3
docs: properly indent core doctor checks 2024-05-21 17:15:55 +02:00
Henrik Lissner
edc600e9ad
docs: expand multiple/non-standard config checks
Close: #7391
Close: #7295
2024-05-21 17:15:55 +02:00
Henrik Lissner
3be546f4c4
docs: mention 29.1 support
Now that 29.1 is stable, support for it is official. This updates or
docs and doctor checks to take this into account. I've also included a
link to a Discourse post where I track support for Emacs HEAD.
2024-05-21 17:15:48 +02:00
Henrik Lissner
357d10f5a7
feat: add doctor context
Ref: f9201eb218
2023-02-23 01:34:55 -05:00
Nikola Bunjevac
7a8383c2d1
fix(cli): doctor: pluralizing single errors/warnings 2023-02-23 01:15:36 -05:00
Henrik Lissner
9e08097119
fix(cli): doctor: wrong-type-argument stringp error
`doom doctor` throws a type error for enabled modules without a
doctor.el and/or packages.el file. This occurs because, in
in775ee2f04aad, `doom-module-expand-path` was changed to return nil if
the target file did not exist, and the doctor wasn't updated to handle
this. It passes `nil` to `load`, causing this type error.

Amend: 775ee2f04a
2023-02-21 20:23:47 -05:00
Cullan Springstead
7ba11a62ef fix(cli): make doctor load module doctor files
Amend: 5a5195b84d
2023-02-18 00:45:33 -05:00
Henrik Lissner
3f16c82877
fix(cli): doctor: false positive 'X.elc is out-of-date' warnings
The doctor would look for stale byte-code in *all* build directories,
which was excessive and produced many false positives for folks who use
multiple versions of Emacs or have recently up/downgraded.
2022-09-26 02:09:20 +02:00
Henrik Lissner
1cddb5c369
fix(cli): doom doctor: void-variable key error
A regression introduced in 4efaf68, cause by an incomplete refactoring
of the loop, where not all instances of `key` were changed into `group`
and `name`.

Amend: 4efaf6837b
Fix: #6840
2022-09-25 11:43:00 +02:00
Henrik Lissner
4efaf6837b
refactor: introduce doom-module-context
Where f9201eb introduced a general context system, this one introduces
one for modules, to simplify our let-bind game when interacting with
modules, and to more efficiently expose module state to modulep! (which
gets called at runtime a great deal, so its performance is important).

* lisp/doom-lib.el (doom-log): simplify macro and introduce
  doom-inhibit-log variable.
* lisp/doom-modules.el (modulep!): fix reported file path if modulep!
  fails to find the local module.
* lisp/lib/debug.el (doom-debug-variables): disable doom-inhibit-log
  when debug mode is on.

Ref: f9201eb218
2022-09-24 22:09:46 +02:00
Henrik Lissner
f9201eb218
refactor: introduce doom-context
Introduces a system to announce what execution contexts are active, so I
can react appropriately, emit more helpful logs/warnings in the case of
issues, and throw more meaningful errors.

* bin/doom: load module CLIs in the 'modules' context.
* lisp/cli/doctor.el: load package files in 'packages' context.
* lisp/doom-cli.el:
  - (doom-before-init-hook, doom-after-init-hook): trigger hooks at the
    correct time. This may increase startup load time, as the benchmark
    now times more of the startup process.
  - (doom-cli-execute, doom-cli-context-execute,
    doom-cli-context-restore, doom-cli-context-parse,
    doom-cli--output-benchmark-h, doom-cli-call, doom-cli--restart,
    doom-cli-load, run!): remove redundant context prefix in debug logs,
    it's now redundant with doom-context, which doom-log now prefixes
    them with.
* lisp/doom-lib.el (doom-log): prefix doom-context to doom-log output,
  unless it starts with :.
* lisp/doom-packages.el (package!, doom-packages--read): throw error if
  not used in a packages.el file or in the context of our package
  manager.
* lisp/doom-profiles.el (doom-profile--generate-init-vars,
  doom-profile--generate-load-modules): use modules doom-context instead
  of doom-init-time to detect startup.
* lisp/doom-start.el (doom-load-packages-incrementally-h): move function
  closer to end of doom-after-init-hook.
* lisp/doom.el:
  - (doom-before-init-hook, doom--set-initial-values-h,
    doom--begin-init-h): rename doom--set-initial-values-h to
    doom--begin-init-h and ensure it runs as late in
    doom-before-init-hook as possible, as that is the point where Doom's
    "initialization" formally begins.
  - (doom-after-init-hook): don't trigger at the end of command-line-1
    in non-interactive sessions. This will be triggered manually in
    doom-cli.el's run!.
* lisp/lib/config.el (doom/reload, doom/reload-autoloads,
  doom/reload-env): use 'reload' context for reload commands.
* modules/lang/emacs-lisp/autoload.el (+emacs-lisp-eval): use 'eval'
  context.
* modules/lang/org/config.el: remove doom-reloading-p; check for
  'reload' doom context instead.
2022-09-24 22:09:05 +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
Henrik Lissner
5a5195b84d
fix: add :depth field to modules
This introduces a depth field for modules so that they may dictate their
load order explicitly, it also treats depths <= -100 or >= 100 as
special depths, which will be loaded early, before their respective
doom-{before,after}-module-{init,config}-hook. This permits psuedo
modules like :core and :user modules to be treated as normal modules
without too many special cases.

This also fixes a module load order issue on Emacs 29 (#6813), caused by
emacs-mirror/emacs@4311bd0bd7, which changed the return value order of
hash-table-{keys,values} causing modules to be loaded in reverse order;
resulting in the loss of evil keybinds, among other things.

Other notable changes:
- Changes the data structure for module data caches from a list to a
  vector. Uses less memory and permits faster lookups. Also adds two
  depth fields to the front of it.
- Changes the signature of doom-module-list and doom-package-list.
- Renames doom--read-packages -> doom-packages--read for consistency
  with naming convention.
- Add doom-module-depth function.
- Adds a temporary doom-core-dir/init.el file, which is responsible for
  loading doom-*.el.

Fix: #6813
Ref: emacs-mirror/emacs@4311bd0bd7
2022-09-24 18:46:21 +02:00
Henrik Lissner
1be11539e8
refactor(cli): explain! to use print!'s fill function 2022-09-16 01:14:23 +02:00
Henrik Lissner
b914830403
refactor!: complete profile gen and init systems
BREAKING CHANGE: This commit makes three breaking changes:

- Doom now fully and dynamically generates (and byte-compiles) your
  profile and its init files, which includes your autoloads, loading
  your init files and modules, and then some. This replaces
  doom-initialize-modules, doom-initialize-core-modules, and
  doom-module-loader, which have been removed. This has also improved
  startup time by a bit, but if you use these functions in your CLIs,
  for instance, this will be a breaking change.
- `doom sync` is now required for Doom to see your profiles (and must be
  run whenever you change them, or when you up/downgrade Emacs across
  major versions).
- $DOOMDIR/init.el is now read much earlier than it used to be. Before
  any of doom-{ui,keybinds,editor,projects}, before any autoloads are
  loaded, and before your load-path has been populated with your
  packages. It now runs in the context of early-init.el, giving users
  freer range over what they can affect, but a more minimalistic
  environment to do it in.

  If you must have some logic run when all that is set up, add it to one
  of the module hooks added in e08f68b or 283308a.

This also poses a significant change to Doom's load order (see the
commentary change in lib/doom.el), along with the following (non
breaking) changes:

1. Adds a new `doom profiles sync` command. This will forcibly resync
   your profiles, while `doom sync` will only do so if your profiles
   have changed.
2. Doom now fully and dynamically generates (and byte-compiles) your
   user-init-file, which includes loading all your init files, modules,
   and custom-file. This replaces the job of doom-initialize-modules,
   doom-initialize-core-modules, and doom-module-loader, which have been
   removed. This has also improved startup time by a bit.
3. Defines new doom-state-dir variable, though not used yet (saving that
   and the other breaking changes for the 3.0 release).
4. Redesigns profile directory variables (doom-profile-*-dir) to prepare
   for future XDG-compliance.
5. Removed unused/unimportant profile variables in doom.el.
6. Added lisp/doom-profiles.el. It's hardly feature complete, but it's
   enough to power the system as it is now.
7. Updates the "load order" commentary in doom.el to reflect these
   changes.
2022-09-16 01:14:23 +02:00
Henrik Lissner
775ee2f04a
refactor: rethink doom-module-*-path functions
- Rename doom-module-path -> doom-module-expand-path, to better reflect
  its purpose.
- Optimize doom-module-locate-path to try caches and
  locate-file-internal, before looping through doom-modules-dirs.
- Rely on file-name-concat to join paths, rather than string
  concatenation. file-name-concat is more robust for the purpose and
  has lower overhead than expand-file-name.
2022-09-16 01:14:21 +02:00
Henrik Lissner
a5bb50e957
docs: improve emacs version checks and their explanations
- Add a 27.x check, recommending that users upgrade to 28.1.
- Removed the check for <27. Loading doom.el with sub-27 will already
  fail with a detailed error about supported versions.
- Now detects development (.50) and pre-release (.9x) builds of Emacs,
  and warns the user of their dangers.
- Revises the warning for 29+ or .50|.9x users.
2022-09-16 01:14:21 +02:00
Henrik Lissner
7a2fa1e313
fix(cli): doctor warnings about irrelevant bytecode
This would check for stale bytecode across all profiles or even .local*
directories created by shell.nix, which is unnecessary.
2022-09-10 20:03:24 +02:00
Henrik Lissner
45a66cda60
fix: ensure module state is in scope for modulep!
Otherwise, doom-module-from-path (and modulep!) would fail to detect the
module they're in, or at least, modulep! would incorrectly return nil,
even for enabled modules.

This issue is what would've caused the package list or the doctor to
include/consider packages in disabled modules or behind disabled flags.
2022-09-10 19:11:03 +02:00
Henrik Lissner
a0fe199237
fix(cli): void-variable doom-dir on 'doom doctor'
A regression caused by an overaggressive search and replace (for
e986d6b).

Amend: e986d6bef9
2022-09-06 23:31:01 +02:00
Henrik Lissner
e986d6bef9
refactor(lib): deprecate doom-dir
This function never really added much value over doom-path or
file-name-concat, so I'm phasing it out.
2022-09-06 22:55:48 +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
0407621aff
refactor: deprecate EMACS2[89]+, NATIVECOMP, MODULES
To reduce redundancy, remove the maintenance hassle that version
constants would impose later on, and rely on built-in
facilities (featurep) more over global variables or doomisms, these
global constants have been deprecated in favor of Emacs "features":

- EMACS28+   -- replace with (> emacs-major-version 27)
- EMACS29+   -- replace with (> emacs-major-version 28)
- NATIVECOMP -- replace with (featurep 'native-compile)
- MODULES    -- replace with (featurep 'dynamic-modules)

(These constants will be formally removed when v3 is released. The IS-*
constants are likely next, but I haven't decided on their substitutes
yet)

I also decided to follow native-compile's example and provide features
for Emacs' system features (since system-configuration-features' docs
outs itself as a poor method to detect features):

- dynamic-modules
- jansson
- native-compile -- this one already exists, but will instead be removed
  if it's non-functional; i.e. (native-comp-available-p) returns nil.

These are now detectable using featurep, which is fast and built-in.
2022-08-14 20:43:35 +02:00
Henrik Lissner
2ff8228133
fix(docs): handle missing autoloads file in core doctor
Instead of a long winded backtrace about a missing autoloads file, let
the user know a 'doom sync' is needed.
2022-08-10 13:18:08 +02:00
Henrik Lissner
b9933e6637
refactor!: restructure Doom core
BREAKING CHANGE: This restructures the project in preparation for Doom
to be split into two repos. Users that have reconfigured Doom's CLI
stand a good chance of seeing breakage, especially if they've referred
to any core-* feature, e.g.

  (after! core-cli-ci ...)

To fix it, simply s/core-/doom-/, i.e.

  (after! doom-cli-ci ...)

What this commit specifically changes is:
- Renames all core features from core-* to doom-*
- Moves core/core-* -> lisp/doom-*
- Moves core/autoloads/* -> lisp/lib/*
- Moves core/templates -> templates/

Ref: #4273
2022-07-30 22:41:13 +02:00
Renamed from core/cli/doctor.el (Browse further)