Commit graph

303 commits

Author SHA1 Message Date
Henrik Lissner
3fe81f4291
fix(cli): wrong-number-of-args error when auto-resolving prompts
E.g. 'doom sync -!' will auto-resolve repo conflicts, but this error was
preventing that.
2022-09-10 01:36:58 +02:00
Henrik Lissner
6e8de0bd89
refactor(lib): use num-processors
This C function was introduced in Emacs 28.1.
2022-09-08 13:36:17 +02:00
Henrik Lissner
cd269753cf
fix(lib): leave point at bob in with-file-contents!
with-file-contents!'s docstring promises that point will end up at the
beginning of the buffer, but this promise wasn't kept until now.
2022-09-08 00:24:16 +02:00
Henrik Lissner
b121c5e1c6
refactor(lib): provide doom-libs as subfeatures
This allows us to load them via doom-require. Why not use normal
features? Because Doom's libraries are designed to be loaded as part of
Doom, and will openly rely on Doom state if needed; this is a contract I
want to enforce by ensuring their only entry points are through
`doom-require` or autoloading.

I will add them to the rest of the libraries later.

Site-node: this also adds Commentary+Code to the comment headings, as I
want a space to use that space to describe the library, when I get
around to it.
2022-09-08 00:20:26 +02:00
Henrik Lissner
a179b8d262
feat(lib): add doom-{require,load}
These functions are light wrappers around require and load, such that
Doom will catch (and decorate) any errors from the target file, and is
also capable of loading Doom's subfeatures.
2022-09-07 23:19:37 +02:00
Henrik Lissner
a0fc7bad5a
fix(cli): create doom directories early
This is a regression from 948f946, where a bunch of mkdir calls were
removed prematurely. In v3, other processes are responsible for creating
these directories, but those haven't been implemented yet.

Fix: #6756
Amend: 948f9461a7
2022-09-07 17:25:01 +02:00
Henrik Lissner
18887163f9
tweak(cli): add lisp/cli to doom-cli-load-path by default 2022-09-07 17:25:00 +02:00
Henrik Lissner
4efdf51ca5
release(modules): 22.09.0-dev
Ref: 2b39e41368
2022-09-07 01:48:37 +02:00
Henrik Lissner
e87fd8ac13
fix: validate fd --version output
Ref: https://discourse.doomemacs.org/t/3144
2022-09-07 01:48:37 +02:00
ivanbrennan
1d942b4ab6 fix(lib): doom/version use canonical filenames
If doom-emacs-dir contains a "~", attempting to call `git -C` will fail
with an error like:

  fatal: cannot change to '~/.config/emacs/': No such file or directory

Fix this by canonicalizing the filename.
2022-09-07 00:20:24 +02:00
Henrik Lissner
878781e2e4
refactor(cli): remove unneeded (require 'doom)
This wasn't needed here in the first place, and was accidentally carried
over while backporting it and surrounding changes from my local v3
branch.
2022-09-06 23:53:12 +02:00
Henrik Lissner
2b1f6031b2
refactor(lib): rely less on global state for defaults
I prefer to be more explicit about these variables' defaults, then to
rely on proper load order and unverified global state to ensure they're
properly set.
2022-09-06 23:51:44 +02:00
Henrik Lissner
0a51fdff53
refactor(lib): move doom-log to doom-lib
This is such an essential macro that it should be universally available,
and not stowed away in the print library.
2022-09-06 23:46:42 +02:00
Henrik Lissner
48369fb654
fix(lib): add native-comp vars to known debug vars
And reformat the list to distinguish Doom vars from Emacs ones.

Amend: 3853dff5e1
2022-09-06 23:34:56 +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
b93f398568
refactor(lib): enforce namespace for helpers 2022-09-06 23:26:05 +02:00
Henrik Lissner
9b4973198b
refactor(lib): use new file API
Ref: 8d4b6b3028
Ref: 83f18402e3
2022-09-06 23:22:01 +02:00
Henrik Lissner
3cfcfc5055
refactor(lib): use with-memoization
Ref: 2b01166d1d
2022-09-06 23:18:49 +02:00
Henrik Lissner
cee89a5d3f
refactor!(cli): remove 'doom {refresh,re}'
BREAKING CHANGE: This finally removes 'doom refresh'. It was first
deprecated in 8a77633 and disabled in 8c37928, and has long since been
replaced with 'doom sync'.

Ref: 8c37928de2
Ref: 8a7763337d
2022-09-06 23:08:55 +02:00
Henrik Lissner
2383e924c0
refactor: move essential defs + init to top of core
Also adds a new error type: doom-profile-error.
2022-09-06 23:04:17 +02:00
Henrik Lissner
2e6a69f501
refactor: improve Emacs/Doom version checks
And emit more informative errors if they fail.

This eval-when-compile approach is used in preparation for v3, where
Doom's core libraries will be byte-compiled.
2022-09-06 23:04:17 +02:00
Henrik Lissner
948f9461a7
refactor(cli): merge doom-cli-lib into doom-cli
This was done to purge superfluous files from Doom's project structure
and simplify its entry points. And with early-init.el now acting as
Doom's universal bootstrapper (see c05e615), we don't have enough
bootstrap logic to warrant being its own file.

Also removes the redundant version check, given doom.el is assured to be
loaded before doom-cli, and performs its own check.

Ref: c05e61536e
2022-09-06 23:01:39 +02:00
Henrik Lissner
6dfed1ff47
refactor(cli): simplify struct definitions
There's no need to be this meticulous. It only pads the line count, and
for little merit.
2022-09-06 22:56:08 +02:00
Henrik Lissner
8971ee36e5
refactor(cli): use new API to write temp files
Ref: 8d4b6b3028
2022-09-06 22:56:03 +02:00
Henrik Lissner
c370cb1784
fix(cli): duplicate log files 2022-09-06 22:55:48 +02:00
Henrik Lissner
aef14f078d
feat(cli): add --benchmark switch 2022-09-06 22:55:48 +02:00
Henrik Lissner
4009509db5
feat(lib): add eval-when-compile! macro
Unlike eval-when-compile, the body of this macro's calls will only be
evaluated while byte-compiling.
2022-09-06 22:55:48 +02:00
Henrik Lissner
83f18402e3
feat(lib): add with-file! & with-file-contents! macros
Convenience macros to express more succinctly the with-temp-buffer +
insert-file-contents + write-region idiom for file IO in elisp.
2022-09-06 22:55:48 +02:00
Henrik Lissner
8d4b6b3028
feat(lib): add doom-file-{read,write} functions
A concise alternative to the file IO elisp idioms we're used to,
involving some combination of with-temp-file, with-temp-buffer,
insert-file-contents, coding-system-for-{read,write}, write-region, read
loops, print-to-current-buffer loops, etc.

These were engineered to make reading/writing text and lisp data from/to
files simpler, and will be used extensively in the v3 CLI.
2022-09-06 22:55:48 +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
f66d9e1f0e
feat(lib): only return dirs if doom-glob SEGMENTS end with /
Also, doom-glob will return relative paths if SEGMENTS don't form an
absolute path.
2022-09-06 22:55:48 +02:00
Henrik Lissner
cadc778a03
perf(lib): optimize doom-path
Consecutive expand-file-name and recursive apply's can be expensive, so
the function has been simplified to rely more on file-name-concat. This
does change one trait about it, however: absolute paths in SEGMENTS no
long reroot the whole path, and are concatenated as ordinary file
segments.

The performance benefit is more pronounced on Emacs 28+, and will be
even more so when Doom later starts byte-compiling its libraries.
2022-09-06 22:55:48 +02:00
Henrik Lissner
2b07fd1dd8
bump: :core
Wilfred/helpful@94a07d49a8 -> Wilfred/helpful@6633d82c6e
bbatsov/projectile@dc6e7ff658 -> bbatsov/projectile@20aa2adccc
domtronn/all-the-icons.el@b18db6be0a -> domtronn/all-the-icons.el@4a4d6269b8
justbur/emacs-which-key@1ab1d0cc88 -> justbur/emacs-which-key@8093644032
jwiegley/use-package@0ad5d9d5d8 -> jwiegley/use-package@e2d173b120
radian-software/straight.el@fed2153480 -> radian-software/straight.el@e20a44c4ac

Includes a fix for codeberg and sourcehut fetchers in MELPA recipes.

Fix: #6541
2022-09-06 22:55:47 +02:00
Henrik Lissner
42ac62df74
fix: defer projectile's project cleanup
There are two issues here.

1. Projectile uses file-remote-p to check for remote (tramp) paths in
   its known project list, when it automatically cleans it up on
   projectile-mode's activation. This causes tramp.el to be loaded,
   which is expensive.
2. file-remote-p relies on an entry in file-name-handler-alist
   (autoloaded by tramp.el) to detect remote paths, which causes tramp
   to be loaded. However, Doom sets file-name-handler-alist to nil at
   startup for a noteable boost in startup performance.

   Normally, this is not an issue, as I defer projectile-mode until well
   after file-name-handler-alist is restored, but it is trivial for a
   user to inadvertantly load it too early (often as part of another
   package that depends on it, or by blindly following projectile's
   install instructions and calling projectile-mode themselves).

In order to address both of these, I defer projectile's cleanup process
altogether. Another approach I considered was to ensure projectile-mode
wasn't activated until the right time, regardless of when projectile is
loaded, but this may trouble savvier Emacs users who need projectile's
API early during startup, so it needs more consideration.

Fix: #6552
Ref: bbatsov/projectile#1649
2022-09-06 22:55:47 +02:00
Henrik Lissner
7e65329289
refactor: move gcmh config to doom-start
Configuration for interactive sessions ought to live in doom-start.

Ref: 3ce4b38c3d92
2022-09-06 22:55:47 +02:00
Henrik Lissner
1a639b7341
feat: add auto-mode-alist entries for future doom dotfiles 2022-09-06 22:55:47 +02:00
Henrik Lissner
b68c93d924
refactor: move doom-*-reload-hook to lib/config.el
These hooks are only used by this library, and in interactive sessions,
neither of which make them a good fit for doom.el.
2022-09-06 22:55:47 +02:00
Henrik Lissner
6cf0e04de0
refactor: move doom-first-*-hook to doom-start
doom-start is responsible for configuring an interactive session, so
variables associated with interactive sessions ought to live there.
2022-09-06 22:55:47 +02:00
Henrik Lissner
3853dff5e1
tweak: disable ahead-of-time native compilation
Rather than impose a 10-45min compilation step on users, I've disabled
ahead-of-time compilation for deferred compilation. In exchange, it will
eat up some CPU time the first time each uncompiled package is loaded,
but as this happens asynchronously (and are then quietly loaded in the
background), I think this is acceptable.

An --aot switch (or similar) will be added to `doom sync` and `doom
build` in the future, in case folks prefer the old behavior.
2022-09-06 22:55:47 +02:00
Henrik Lissner
b7f84bdd01
perf: defer incremental loading for nativecomp users
It'd be detrimental to runtime performance to incrementally load more
packages as Emacs is natively compiling others, so hold off on it a bit
longer.
2022-09-06 22:55:47 +02:00
Henrik Lissner
1dac4ac37b
refactor: move file-name-handler-alist hack to early-init
In the future, early-init.el (among other parts of Doom) will be
byte-compiled, plus I'd rather keep these optimizations in one place.

Ref: 1d8c61698b
2022-09-06 22:55:46 +02:00
Henrik Lissner
71469d8056
feat: add nongnu-elpa source for straight 2022-09-06 22:55:46 +02:00
Henrik Lissner
338f59c456
feat(lib): backport bol & eol from 29
Ref: emacs-mirror/emacs@f117b5df4d
2022-09-06 22:55:46 +02:00
Henrik Lissner
2b01166d1d
feat(lib): backport with-memoization from 29
Ref: emacs-mirror/emacs@3c972723e4
2022-09-06 22:55:46 +02:00
Henrik Lissner
edaa887bd9
refactor(lib): add + use defbackport! macro
In the future, doom-lib (among other things) will be byte-compiled as
part of 'doom sync'. To spare runtime the overhead of checking for these
functions, I've wrapped these in a macro. It also makes their
definitions a tad simpler.
2022-09-06 22:55:46 +02:00
Henrik Lissner
5ebc2528d8
perf(lib): use symbol plist for fn! lookup table
A good deal faster than alists at this scale.
2022-09-06 22:55:46 +02:00
Henrik Lissner
65c86ea3ff
feat(lib): backport with-environment-variables from 28.1
And alias letenv! to it. Not sure if I want to deprecate it though,
given the length of the macro it's linked to...
2022-09-06 22:55:46 +02:00
Henrik Lissner
995b40378d
fix: remove use-package-font-lock-keywords reference
This was removed upstream, and while we haven't bumped use-package for
this to affect us, I may as well remove it early.

Doom will be dropping use-package from core in 3.0, in any case.

Fix: #6699
Ref: 8a3d29e433
2022-09-06 22:55:46 +02:00
Henrik Lissner
98b8f01de3
fix(lib): vestigial call to missing cat function
This was brought over from `doom-info` in f33d8e7, but one of the
lexical function calls wasn't refactored out.

Ref: a5c80fcb4b/lisp/lib/debug.el (L216-L219)
Fix: #6698
Amend: c5e3f4d632
Co-authored-by: ivanbrennan <ivanbrennan@users.noreply.github.com>
2022-09-06 22:55:45 +02:00
ivanbrennan
c44bc81a05 fix(lib): defer-feature! fallback FNS
If defer-feature! was called with one argument (as is the case in the
:lang common-lisp module), FNS defaulted to an empty list. As a result,
FEATURE was deferred but never re-added to the features list, and after!
blocks were never triggered.

Instead of defaulting to an empty list, fallback to a singleton list
containing just (FEATURE). This aligns with the behavior this macro had
prior to 5b8b04f0c8, which generalized FNS
to support a list of functions rather than just one.
2022-08-19 11:24:34 +02:00