Commit graph

182 commits

Author SHA1 Message Date
Henrik Lissner
3f866983e5
refactor(lib): doom-load 2022-09-16 13:07:28 +02:00
Henrik Lissner
b804a2f34f
refactor(lib): convert cli/autoloads.el to lib 2022-09-16 13:07:28 +02:00
Henrik Lissner
7ea4b21953
fix(cli): remove vestigial doom-initialize-modules calls
Fix: #6784
2022-09-16 13:07:28 +02:00
Henrik Lissner
ab9896c526
refactor(org): move doom-docs link defs to :lang org
Where they will be further generalized, later.

This also prevents an issue where org was loaded while the profile init
files are generated, which caused a warning about org-loaddefs which
introduces a noticable delay.
2022-09-16 13:06:17 +02:00
Henrik Lissner
9cbc173e0d
fix(lib): update doom/reload-autoloads
To reflect recent changes (particularly b914830).

Amend: b914830403
2022-09-16 03:17:46 +02:00
Henrik Lissner
39197618ec
fix(lib): only set doom-print-minimum-level in debug-mode 2022-09-16 03:17:46 +02:00
Henrik Lissner
354d71566a
fix: inhibit-null-byte-detection = t at startup 2022-09-16 03:08:29 +02:00
Henrik Lissner
00ff149ebe
fix(cli): print-group-if! -> print-group! + :if
Remove some vestigial references to the former, which was replaced with
the latter in b7bd27d.

Amend: b7bd27d22b
2022-09-16 02:42:48 +02:00
Henrik Lissner
7b1ac7cdc1
fix(cli): doom-autoloads-reload -> doom-profile-generate
Remove vestigial references to the former, which was replaced with the
latter in b914830.

Amend: b914830403
2022-09-16 02:42:30 +02:00
Henrik Lissner
cc0e6a61c3
fix(cli): add lisp/cli/profiles.el
I forgot to add the definitions for the 'doom profile{s,}' commands in
b914830, which causes "unrecognized command 'profiles sync'" errors on
'doom {sync,upgrade}'.

My unparalleled brilliance is 4 parallel universes ahead of me, clearly.

Amend: b914830403
2022-09-16 02:26:00 +02:00
Henrik Lissner
b395bd5392
refactor: use print! to emit doom! module warnings 2022-09-16 01:14:25 +02:00
Henrik Lissner
b598d41ffb
nit: correct comment header about startup optimizations
To claim they're ordered by effectiveness was silly of me, and was never
*quite* true, so I remove it altogether.
2022-09-16 01:14:25 +02:00
Henrik Lissner
f34e91d3b9
fix: guard tty-run-terminal-initialization against GUI sessions 2022-09-16 01:14:25 +02:00
Henrik Lissner
aa53ad2c1b
fix: load subr-x at compile-time in doom.el
This is more to nip 27.x issues in the bud, where fewer of subr-x's
macros are autoloaded.
2022-09-16 01:14:25 +02:00
Henrik Lissner
e411762e8c
refactor: enable module whether or not it exists
The doom-modules table should reflect the user's intentions, not the
actual state of its modules (e.g. by omitting modules that couldn't be
found at activation time).
2022-09-16 01:14:25 +02:00
Henrik Lissner
a9e0156416
docs: update modulep! docstring
To clarify, reflect recent changes, and link to `doom!` for details.
2022-09-16 01:14:24 +02:00
Henrik Lissner
85f3b19f61
docs: revise version check failure message
- Recommend 28.1.
- Swap condition.
2022-09-16 01:14:24 +02:00
Henrik Lissner
c7289da99b
fix(cli): suppress redundant logs from straight-prune-build-cache 2022-09-16 01:14:24 +02:00
Henrik Lissner
cba240f88a
refactor(cli): move native-comp call into guard
Each of these functions have a native-comp guard, which may be overkill,
but for the time being they should be grouped together, to indicate
their relationship.
2022-09-16 01:14:24 +02:00
Henrik Lissner
a023482c36
perf: delay tool-bar-setup at startup 2022-09-16 01:14:24 +02:00
Henrik Lissner
451933b2ba
fix(docs): don't hide # lines in src blocks
This would hide shebang lines and comments in languages that use # as a
line comment delimiter.
2022-09-16 01:14:24 +02:00
Henrik Lissner
c8099a89ad
refactor(cli): replace cl-callf+map-delete w/ cl-remf 2022-09-16 01:14:24 +02:00
Henrik Lissner
7e75271933
refactor(cli): precalculate cli & key in doom-cli-aliases 2022-09-16 01:14:24 +02:00
Henrik Lissner
85fac73d37
feat(cli): implement second argument of doom-cli-find
It was intended to be a flag to suppress this function from including
partial CLIs in the returned list, but wasn't actually implemented until
now.
2022-09-16 01:14:24 +02:00
Henrik Lissner
d552dbc878
fix(lib): resolve relative paths in doom-load errors
And don't forward file-missing errors, as this would convolute them.
2022-09-16 01:14:23 +02:00
Henrik Lissner
41051f4761
fix: disable UI elements earlier
Moves this from doom-ui to doom-start, since there is more savings to be
had if this is done early.

Also moves the menu-bar fix for macos out of the :os macos module into
doom-start, because it is a fix (and for a Doom optimization) and not a
feature, so it shouldn't be behind a module.
2022-09-16 01:14:23 +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
3d6e0311b9
dev: change version suffix from *-dev to *-pre
Emacs' version library (e.g. version-to-list) understands a number of
suffixes (see version-regexp-alist), but -dev is not one of them. Rather
than break compatibility (or impose a new, non-portable value onto
version-regexp-alist), I think it's best we adopt -pre instead. I
could've chosen -rc, -alpha, -beta, or -git, but I don't think any of
these accurately represent Doom's current state yet (and I don't want to
lock its versioning to git).
2022-09-16 01:14:23 +02:00
Henrik Lissner
b183a0835d
feat(lib): add active profile to doom-info 2022-09-16 01:14:23 +02:00
Henrik Lissner
4a253757cb
refactor: how UI elements are disabled at startup
The default-frame-alist properties are only necessary for the scrollbar.
The variables are enough for the rest. Also, no need to set
x-gtk-use-symtem-tooltips if we're turning off tooltips anyway.

Also moves the UI config that snuck its way into doom-start back to
doom-ui.
2022-09-16 01:14:23 +02:00
Henrik Lissner
0d7c3eaf24
feat: add doom-{before,after}-init-hook
doom-before-init-hook runs before $DOOMDIR/init.el is loaded.

doom-after-init-hook runs at the *very* end of the Emacs startup
process (after window-setup-hook).
2022-09-16 01:14:23 +02:00
Henrik Lissner
18cd2eb483
refactor: reformat doom.el and use doom-lib
Move startup optimizations after core globals, so we can employ
doom-lib's API.
2022-09-16 01:14:23 +02:00
Henrik Lissner
7a2be67efa
refactor!: redesign module init/config hooks
BREAKING CHANGE: For consistency and correctness, I've renamed the
module init/config hooks, and added new ones:

- Adds doom-before-modules-config-hook
- Adds doom-after-modules-config-hook (replaced doom-before-init-modules-hook)
- Adds doom-before-modules-init-hook
- Adds doom-after-modules-init-hook (replaced doom-init-modules-hook)
- Removed doom-after-init-modules-hook (replaced w/ after-init-hook)

The old naming (and timing) was counterintuitive. Now, it's named after
the loaded file group (init.el vs config.el), and I added before/after
variants. Altogether, this should make them less ambiguous.

I've also moved some functions in various modules to more correct hooks.

Load order before this change:
- $EMACSDIR/early-init.el
- $EMACSDIR/lisp/doom.el
- $EMACSDIR/lisp/doom-start.el
- $DOOMDIR/init.el
- {$DOOMDIR,~/.emacs.d}/modules/*/*/init.el
- `doom-before-init-modules-hook'
- {$DOOMDIR,~/.emacs.d}/modules/*/*/config.el
- `doom-init-modules-hook'
- $DOOMDIR/config.el
- `doom-after-init-modules-hook'
- `after-init-hook'
- `emacs-startup-hook'
- `window-setup-hook'

Load order after this change:
- $EMACSDIR/early-init.el
- $EMACSDIR/lisp/doom.el
- $EMACSDIR/lisp/doom-start.el
- $DOOMDIR/init.el
- `doom-before-modules-init-hook'
- {$DOOMDIR,~/.emacs.d}/modules/*/*/init.el
- `doom-after-modules-init-hook'
- `doom-before-modules-config-hook'
- {$DOOMDIR,~/.emacs.d}/modules/*/*/config.el
- `doom-after-modules-config-hook'
- $DOOMDIR/config.el
- `after-init-hook'
- `emacs-startup-hook'
- `window-setup-hook'
2022-09-16 01:14:22 +02:00
Henrik Lissner
57a91235bd
perf: add additional startup optimizations
Also switches `expand-file-name` calls with the much faster
`file-name-concat` where possible.
2022-09-16 01:14:22 +02:00
Henrik Lissner
42d88421ba
refactor: move startup optimizations to doom.el
I move our hackiest and least offensive startup optimizations to core,
so they're easy for me to keep track of (they'll likely change often,
between major Emacs releases), to keep them from affecting non-Doom
profiles, and make it easy for readers to use as a reference.
2022-09-16 01:14:22 +02:00
Henrik Lissner
9ac167fb84
fix: IS-LINUX = t for more unix system-types 2022-09-16 01:14:22 +02:00
Henrik Lissner
6ddaed5cdd
nit: comment revision and formatting
For clarity, to enforce conventions, and explain the unexplained.
2022-09-16 01:14:22 +02:00
Henrik Lissner
75881c7d45
refactor: do Emacs version check at compile time too
In case the user tries to byte-compile Doom with the wrong version of
Emacs.
2022-09-16 01:14:22 +02:00
Henrik Lissner
3a0f1aa3ef
refactor: register :core & :user as virtual modules
...that are always enabled. This way, the module API treats them as any
other module.

This also changes doom-module-load-path. If supplied directories,
doom-user-dir will not be the CAR of its return value. If no dirs are
supplied, then doom-core-dir and doom-user-dir are included (and will
always be the first two items in the returned list).
2022-09-16 01:14:22 +02:00
Henrik Lissner
10eb5db12d
feat: allow doom-module-set to disable modules 2022-09-16 01:14:22 +02:00
Henrik Lissner
c5188c4388
perf: cache module flags in symbol plists
For small amounts of data, symbol plists are the most efficient (space
and time wise) as data access gets in Emacs. Hash tables, though O(1),
impose a minimum threshold of overhead before it becomes the efficient
option, but this benefit won't be obvious for datasets of at least 60 or
less.

Since modulep! is used *a lot*, and used to determine a module's
state (and state of its flags), there is a benefit to caching it.
Still, this is only a read-only cache, and does not replace the
`doom-modules` hash-table, which will always be the preferred interface
for the rest of the module API.
2022-09-16 01:14:22 +02:00
Henrik Lissner
7161f27bb3
fix: add doom--current-module clause to modulep!
To fix an edge case where it fails to deduce the current module.
2022-09-16 01:14:21 +02:00
Henrik Lissner
0c918f3b2d
refactor: change doom-module-list signature
Used to return the hash-table `doom-modules` (if not all-p), but I've
changed it to return a list of cons cells (:CATEGORY . MODULE),
representing all enabled modules, in the order they were enabled.

The purpose of this change is to prepare for a change in the structure
of doom-modules, and how Doom stores its module metadata.
2022-09-16 01:14:21 +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
a67b212b99
fix: make doom-module-from-path's PATH arg required 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
07d22adb4a
nit: revise comments, reformat config sections 2022-09-16 01:14:21 +02:00
Henrik Lissner
b480ed51a3
refactor(lib): suppress map! at compile/batch time
It's not useful in those scenarios, and is more likely to throw up
unrecoverably keybind conflict errors, when load order is determined by
an over-eager byte-compiler, rather than Doom's standard startup
process.
2022-09-16 01:14:21 +02:00
Henrik Lissner
701f51c3d6
refactor(lib): use uninterned symbols for transient/chained hooks
The debugger appears to display uninterned symbols properly, and since
these symbols should never be touched/referenced by users, there's no
reason to pollute the obarray with these transient symbols.
2022-09-16 01:14:21 +02:00