Commit Graph

463 Commits

Author SHA1 Message Date
Byungwan Jun
c70b966850 fix(cli): auto-generated script error
The auto-generated script has bom characters on my mac. if bin/doom
exits with code 254, it gives me the below error:
`.../doom.123.0.sh: line 1: #!/usr/bin/env: No such file or directory`
2024-06-03 16:20:13 -04:00
Marien Zwart
e203309e5c refactor(lib): use ripgrep instead of git grep
Although this is a refactor for normal users of Doom, it is a bugfix for
one (I assume) unsupported configuration: when Doom is not running from
a git checkout. In that case, `doom--help-package-configs` currently
returns Git's error messages. This breaks `doom/help-packages` because
it expects each returned line to contain at least one `:` character, so
it errors out with `Wrong number of arguments: (file line _match &rest),
2`.

Using ripgrep here should be equivalent for normal users as long as they
have not added untracked files not covered by Doom's .gitignore.
2024-06-03 16:19:42 -04:00
StrawberryTea
2729a3f7e3 fix: obey the comp namespace change
Some of the comp functions were declared private.
2024-06-03 15:57:56 -04:00
Levin Du
ede616fdd7
fix(cli): doom-packages-ensure: ensure local packages are built
If the package is local, the local-repo has absolute local file path,
and straight-modified-dir will return as it is, which always exists.

Fix it by passing package only to straight-modified-dir.
2024-04-16 03:00:56 -04:00
Levin Du
5a92e1b94a
fix: doom-initialize-core-packages: extract plist from alist
The doom-package-list is a list of (module :key value ...). To get the
plist, apply cdr first.
2024-04-16 02:59:04 -04:00
Henrik Lissner
ff4a0bc54a
fix: doom-run-hook-on: check context & chain hooks unconditionally
Consult the doom-context to determine if a transient hook should fire,
rather than after-init-time (less reliable; there may be times we want
them to fire post-init).

Also ensures that they're chained to find-file hooks whether or not this
is a daemon session (since they could concievably be triggered before
the daemon finishes initializing, but after Doom initializes).
2024-04-09 12:42:00 -04:00
Henrik Lissner
96e3255c33
nit: reformat+revise comments
Includes minor refactors to appease the byte-compiler or use more
succinct (but equivalent) syntax.
2024-04-09 12:39:51 -04:00
Henrik Lissner
d317fa4667
refactor: menu-bar (re)initialization on MacOS
Before this, it was non-trivial to *truly* disable the menu-bar in GUI
frames on MacOS, unless you knew about the
doom-restore-menu-bar-in-gui-frames-h hook and removed it. With this
change, the hook will bow out if the user has tampered with/called
menu-bar-mode at all.
2024-04-09 12:29:22 -04:00
Henrik Lissner
da3d0687c5
fix: doom-init-fonts-h: don't run more than needed
The face and theme-face manipulation only needs to happen once per
frame, and the `set-fontset-font` calls only need to happen once per
session (or whenever the user calls `M-x doom/reload-fonts`). This
change ensures this and saves Emacs some work when initializing new
frames, as well as resolves `set-fontset-font` related segfaults in some
edge cases (#7803).

Fix: #7803
2024-04-09 03:14:08 -04:00
Henrik Lissner
4f51652111
fix(lib): remove-recent-file: improve completion UI
Integrates with completion frameworks (particularly vertico) that read
capf metadata.
2024-04-06 12:37:10 -04:00
Henrik Lissner
f18603e66a
feat(lib): sudo-{find,this}-file: invoke save-place
After switching to the sudo-ed tramp buffer, this restores the point and
scroll position of the window to match the source buffer.

I exploit save-place here instead of simply saving/restoring (point)
and (window-start), because I believe it's better UX that save-place
treat the two buffers as effectively the same now and in the future, and
record the last cursor position equally between them, even if the
implementation is messier. This *could* be generalized into an advice
for save-place-find-file-hook and save-place-to-alist, but that's an
experiment for another day.

This is an experimental implementation and may change later.

Close: #7181
Co-authored-by: YourFin <YourFin@users.noreply.github.com>
2024-04-05 18:38:14 -04:00
Henrik Lissner
82e0641bf7
refactor: remove redundant auto-mode-alist entries
Also removes the *.{hex,nes} entry because it's far too niche to be a
global default.
2024-04-05 12:06:18 -04:00
Henrik Lissner
8d370d5608
refactor: doom--last-frame: remove unused symbol
Its last reference was removed in e889b2c. Not sure why this stuck
around for so long.

Ref: 0bb4d4dfcb
2024-04-04 23:46:07 -04:00
Henrik Lissner
0b93ecf42c
fix(lib): sudo-{find,this}-file: disable auto-save
auto-save can trigger processes that hang silently in the background,
making those buffers inoperable (hanging Emacs) for the rest of the
session, even if they are killed (tramp caches them), so I suppress them
solely for these temporary tramp buffers created by doom/sudo-find-file
and doom/sudo-this-file.
2024-04-04 23:46:04 -04:00
Henrik Lissner
38a3adcf0e
fix(lib): find-subling-file-search: wrong-number-of-args error
I backported `find-sibling-file` from Emacs 29+ in 198fe82, but it
passes a third argument (REGEXP) to `file-expand-wildcards` which wasn't
introduced until 29, so users on 28 or earlier would see a
wrong-number-of-arguments error (see #7795).

Rather than backport the entire `file-expand-wildcards`
function (risking other edge cases), I've advised its usage in
`find-sibling-file-search` to behave as it would in 29+ with a non-nil
REGEXP argument.

Amend: 198fe82b6d
Fix: #7795
2024-04-04 13:00:12 -04:00
Henrik Lissner
d166d754d6
release(modules): 24.04.0-dev
Ref: 2b39e41368
2024-04-04 00:23:20 -04:00
Henrik Lissner
869ad10f34
refactor: startup optimizations
I revisit all our startup optimizations to see how they fair in Emacs
29.x and 30.x. Most of them still hold up. I've revised and updated most
of the accompanying comments to better explain them, given what I know
now compared to when I first wrote them.
2024-04-04 00:17:02 -04:00
Henrik Lissner
2debe85a8a
fix(cli): doom upgrade: void-variable num
Fix: #7791
2024-04-03 19:21:14 -04:00
Henrik Lissner
c6fc0e5bc0
fix(cli): don't delete repos beyond $DOOMLOCALDIR
Doom makes multiple attempts to re-clone repos if they failed the first
time, however, if a user provides a :local-repo and that location isn't
a git repo, Doom assumes this it is the result of a failed clone, and so
deletes it to "try" again (which will fail). This can result in lost
work.

This prevents this from happening to packages/repos outside of
$DOOMLOCALDIR (all packages under $DOOMLOCALDIR must be git repos).

Fix: #7785
Amend: 3643c4dadd
Amend: 1fa8d3a4b9
2024-04-01 19:43:39 -04:00
Henrik Lissner
392fe88ed0
fix(lib): sudo-{this,save}-file: file path for indirect clones
If the buffer is an indirect clone, it may not have a buffer-file-name.

Also changes the command to throw an error if the current file has no
file path *and* is not a dired buffer.
2024-04-01 14:03:35 -04:00
carehabit
230c82fc95
docs: remove unintended repetition
Signed-off-by: carehabit <shenyuting@outlook.com>
2024-04-01 13:30:10 -04:00
Henrik Lissner
3643c4dadd
fix(cli): void-function directory-empty-p error
directory-empty-p was introduced in 28.1, but Doom still supports 27.1,
so 27.x users would see this error when running any bin/doom command
that clones packages.

Fix: #7779
Amend: 1fa8d3a4b9
2024-03-30 11:50:57 -04:00
Henrik Lissner
b01e496405
fix(cli): doom sync: rebuild-all loop
Addresses an edge case where 'doom sync' could fall into an inescapable
'rebuild all packages' loop.

Fix: #7775
2024-03-29 23:41:12 -04:00
Henrik Lissner
65240e9b92
fix(cli): suppress 'checked out X' when X = nil 2024-03-29 12:32:12 -04:00
Henrik Lissner
544e579c44
fix(cli): doom upgrade: ensure upgrade remote is deleted
It seems the temporary branch that 'doom upgrade' creates is sometimes
left over after a 'doom upgrade', preventing the next 'git fetch' from
completing.

Ref: #7771
2024-03-28 09:43:43 -04:00
Henrik Lissner
b443371981
fix(cli): doom install: $DOOMDIR templates (part 2)
Caused by a regression originally introduced in b6b755d, but incorrectly
fixed in 89c56a3. Don't code while sleep deprived, kids.

Amend: 89c56a3393
Amend: b6b755dea4
2024-03-28 00:23:17 -04:00
Henrik Lissner
89c56a3393
fix(cli): doom install: $DOOMDIR templates
Caused by a regression introduced in b6b755d.

Amend: b6b755dea4
2024-03-27 17:15:43 -04:00
Henrik Lissner
3f966f49d8
fix(cli): doom upgrade: remove doom-compile-clean call
This function was removed in 63c470b.

Amend: 63c470bff3
2024-03-27 10:27:44 -04:00
Henrik Lissner
d6a3450917
fix(cli): shell-quote-argument: wrong-number-of-args error
shell-quote-argument's second argument was introduced in 29.1. Users on
older versions of Emacs will get an error.

Amend: d5bad5b430
2024-03-27 10:27:05 -04:00
Henrik Lissner
b6b755dea4
fix(cli): doom install: $DOOMDIR paths in output
Close: #7768
Co-authored-by: plajjan <plajjan@users.noreply.github.com>
2024-03-27 09:39:05 -04:00
Henrik Lissner
201051c368
fix(cli): doom sync: suppress rebuild prompt when upgrading
12a765c introduced suppression of package-rebuilding prompts on 'doom
upgrade', but inadvertently reversed the check. This fixes that (and
refactors the if/or tree into a `cond`).

Amend: 12a765c509
2024-03-27 00:26:18 -04:00
Henrik Lissner
aef2b12100
feat(cli): doom upgrade: add -B option
To mirror doom sync's -B option.
2024-03-27 00:26:18 -04:00
Henrik Lissner
d5bad5b430
fix(cli): straight: regurgitate type errors as connection errors
See included comment for explanation.
2024-03-26 22:58:56 -04:00
Henrik Lissner
c0c52f0f61
fix: ensure load-path et co are set on doom/reload
This addresses a number of missing-package errors after running
doom/reload.

Fix: #7764
Fix: #7636
Fix: #7182
2024-03-26 22:25:29 -04:00
Henrik Lissner
12a765c509
feat(cli): doom sync: change -B to suppress rebuilding
Prior to this, -B would suppress the prompt for package rebuilding if
your Emacs version or hostname changed. Now, it fully inhibits
rebuilding in either case.

Fix: #7760
Ref: cff091982e
2024-03-26 21:36:14 -04:00
Henrik Lissner
286be1b249
fix(cli): void-variable doom-profile-env-file-name error
This variable ref snuck into cff0919, but hasn't been introduced yet.

Fix: #7755
Amend: cff091982e
2024-03-24 18:55:43 -04:00
Henrik Lissner
6d682eef85
fix(cli): void-function doom-packages-install error
Function was renamed to doom-packages-ensure in cff0919.

Fix: #7755
Amend: cff091982e
2024-03-24 18:38:18 -04:00
Henrik Lissner
8d50cd8bfb
tweak(lib): print!: join (path ...) segments 2024-03-24 18:09:54 -04:00
Henrik Lissner
2df24d29f3
bump: :core
Fuco1/smartparens@0778a8a840 -> Fuco1/smartparens@ddc6233ea6
bbatsov/projectile@e45f0b0cc4 -> bbatsov/projectile@0163b335a1
emacs-compat/compat@eb8fbfa558 -> emacs-compat/compat@8d4e8a3666
emacs-straight/project@10a6b691e3 -> emacs-straight/project@b6989856ab
joddie/pcre2el@018531ba0c -> joddie/pcre2el@380723b270
jscheid/dtrt-indent@0230ec5032 -> jscheid/dtrt-indent@5d1b44f9a1
justbur/emacs-which-key@4d20bc8525 -> justbur/emacs-which-key@96911a1d3f
noctuid/general.el@bda777cd30 -> noctuid/general.el@ced143c30d
radian-software/straight.el@b3760f5829 -> radian-software/straight.el@b1062df10b
rainstormstudio/nerd-icons.el@c6a4acf194 -> rainstormstudio/nerd-icons.el@8095215a50
2024-03-24 18:08:09 -04:00
Henrik Lissner
e24a583d5c
tweak: move project-list-file to profile data dir
Ref: doomemacs/core#1
2024-03-24 18:03:13 -04:00
Henrik Lissner
77df11af11
refactor(cli): remove unused cli/help.el
This file was "renamed" to meta.el at some point, but the old file was
forgotten (and unused).
2024-03-24 18:03:13 -04:00
Henrik Lissner
32ef0989ab
fix(cli): appease byte-compiler wrt defcli-obsolete! 2024-03-24 18:03:13 -04:00
Henrik Lissner
bfd21edeeb
nit: reformat core packages.el 2024-03-24 18:03:13 -04:00
Henrik Lissner
2591201aa1
refactor(cli): rename 'doom purge' -> 'doom gc'
'doom purge' is now deprecated.

Also changes 'doom sync's -p option to --gc. Since GCing causes the loss
of historical data, I'd rather it be a long option to make it a little
harder to do accidentally.
2024-03-24 18:03:13 -04:00
Henrik Lissner
cff091982e
fix(cli): rewrite 'doom sync'; deprecate 'doom build'
This changes 'doom sync' to be smarter about responding to changed
package recipes/pins, changes in Emacs version, or instances where the user
has copied a config to a new system.

In all these cases, the user would formerly have to know about a
specific combination of 'doom sync -u' and 'doom build' to ensure Doom
is in a good state. With this change, 'doom sync' handles all these
cases.

Also, 'doom build' is now deprecated (and 'doom sync' now has a
--rebuild option to mimic its old behavior).

Also also, sometimes, a package may silently fail when cloned (which
used to result in an empty repo). Now, if this is detected, cloning will
be re-attempted up to 3 times before aborting with much more visible
error.

Note: these are stopgap solutions, until v3 is finished.
2024-03-24 18:03:12 -04:00
Henrik Lissner
1fa8d3a4b9
fix(cli): retry on failure to clone packages (or abort)
Something often reported are file-missing errors when a package that
should be present isn't. This can easily happen if, say, during a 'doom
sync' or 'doom upgrade' a package fails to clone correctly and the user
misses the errors, then tries to carry on as normal. What's worse is
that Straight leaves behind an empty directory, which it treats as a
sign that the package has been cloned correctly, so it doesn't raise any
fuss over them.

With this change, 'doom sync' (and 'doom upgrade') will now try again,
if the clone process fails the first time (up to 3 times) before
aborting the whole process altogether, which should be loud enough for
users not to miss. Note that these failures at 99.99% because of
network (or upstream downtime) issues.

For now, this does leave Doom in an incomplete state (until you try
again when the connection issue is resolved), but a rollback step will
be added in v3 to prevent this, as well as better error messages (as
well as @doomelpa mirror for packages on less reliable hosts, like
codeberg, savannah, etc).
2024-03-24 18:03:12 -04:00
Henrik Lissner
63c470bff3
refactor!(cli): remove compile and clean commands
BREAKING CHANGE: This removes the 'doom compile' and 'doom clean'
commands, and offers no immediate replacement for them (and no plan to
include one). In the future, byte-compilation of Doom's internals will
be baked into 'doom sync', but until then, Doom is not optimized to take
advantage of byte-compilation, and forcing it provides no benefit.
2024-03-24 18:03:12 -04:00
Jonas Jelten
bbadabda51 feat: allow setting evil states for leader keys
This allows adjusting the evil-states a leader key is active for.
2024-03-22 10:24:21 -04:00
Henrik Lissner
f71689304e
tweak: enable startup optimizations in debug mode
Before this, startup optimizations were disabled in debug mode, but more
often than not, this just made it difficult to reproduce some errors at
startup.
2024-03-19 21:42:09 -04:00
Henrik Lissner
6b55c6adc6
refactor: inline doom--make-font-specs
This function isn't (and won't be) used anywhere else. No reason for it
to be its own function.
2024-03-19 20:47:21 -04:00