Commit graph

18658 commits

Author SHA1 Message Date
Henrik Lissner
7aa87eb019
fix(profiles): not loading $EMACSDIR/init.el
`startup--load-user-init-file` persists its original
user-emacs-directory in a lexical binding that we cannot affect from
early-init.el, and uses it to find init.el. This prevents non-Doom
profiles' init.el files from being loaded.

A way around this is to have our own $EMACSDIR/init.el that loads
{user-emacs-directory}/init.el, but that's unnecessary work and ruins
our users' ability to use their $EMACSDIR as their $DOOMDIR, so I opted
for advice instead, to force it to recognize the changed
user-emacs-directory.

Fix: https://discourse.doomemacs.org/t/3251
2022-10-02 18:46:37 +02:00
Henrik Lissner
d8d06390d2
fix(profiles): ensure trailing / on user-emacs-directory
To quote `user-emacs-directory`'s docstring:

> Note that this should end with a directory separator.

However, users may forget to add one in their profile configs, which
will cause errors.

Fix: #6608
2022-10-02 18:46:37 +02:00
TEC
d3839197f1 fix(mu4e): cooperative lock file watching
Some time ago I noticed the cooperative lock file management wasn't
working as I remember. I forget what exactly I was thinking, but
basically I've poked at the code until it seems to work better.
2022-10-02 13:10:17 +02:00
Henrik Lissner
a6f0bf3123
fix(lib): infinite recursion in doom-first-*-hook
It's possible for these hooks to be triggered recursively, such as in
the case of emojify's "Emoji images not available should I download them
now?" prompt (reported upstream).

Fix: iqbalansari/emacs-emojify#100
2022-10-01 17:09:15 +02:00
Ellis Kenyő
4d24a3f1a7 feat(org): restore org-contrib packages removed upstream
org-contrib is slowly removing packages (most of which have moved or
will move to their own repos or into Org proper).

Ref: emacsmirror/org-contrib@3dd9841522
Ref: emacsmirror/org-contrib@c555d8d489
Ref: emacsmirror/org-contrib@0740bd3fe6
Close: #6740
2022-09-30 23:02:34 +02:00
Ken Bolton
e9a1908e0d
docs(cli): doom upgrade: s/-f/--force
Fix: #6712
2022-09-30 22:59:37 +02:00
TEC
c82e7455bb fix(literate): use same org install when using CLI 2022-09-30 22:52:42 +02:00
Ivan
850907ed9a
fix(lib): doom/delete-this-file nil path handling
Fix the handling of a nil path within doom/delete-this-file.

If path is nil (e.g. called interactively when buffer is not visiting a
file), avoid calling abbreviate-file-name on nil, otherwise an error
will be signaled:

  (wrong-type-argument stringp nil)

Additionally, fix the subsequent path checks. These were treating two
distinct scenarios as a "Buffer is not visiting any file" user-error:

- nil path
- non-existent path
- Only the first should result in that error. The second should proceed
  to the next path check (which was previously unreachable), to signal
  the appropriate error, "File doesn't exist: %s".
2022-09-30 22:48:59 +02:00
TEC
3a19152787 fix(mu4e): +mu4e/capture-msg-to-agenda with mu 1.8 2022-09-30 22:45:23 +02:00
TEC
f2d62acaad tweak(mu4e): try harder to attach files in order
In 4d9ea6853b I reacted to a either a change that I presume occurred
in org-msg at some point, or behaviour originally unnoticed, that led to
bulk-selected files being attached in reverse. Further investigation has
indicated that this isn't actually making attachment order work as
expected, just hiding the reverse behaviour from bulk-attachment. The
better approach is to keep the dired mark reversal, and change
org-msg-attach-attach to add new files to the end, not the start, of the
list of attachments.
2022-09-30 22:44:39 +02:00
TEC
30a4eb7f77 fix(mu4e): file attachment prompt arguments
There are two changes to the default optional read-file-name arguments
that should be made for the purpose of attaching files:
1. The optional MUSTMATCH argument should be set, as one can't exactly
   attach non-existent files.
2. The INITIAL argument should be set to the empty string so that if
   default-directory is customised for some reason or another that
   selecting it leads to the expected directory being selected.
   Without INITIAL or DEFAULT-FILENAME being specified, the current file
   path will be used, which is never desirable as this is simply a path
   to the message buffer.
2022-09-30 22:43:46 +02:00
Ellis Kenyő
f1e793405d fix(macos): only use trash on local hosts
Fix: #6804
2022-09-30 22:42:46 +02:00
TEC
a207a8b703 feat(mu4e): more DWIM-y mu4e entry point (=mu4e)
Replace the rather crude "don't do anything if already in a mu4e-y
buffer" behaviour with a more refined approach that tries to find the
live mu4e buffer likely of the most interest and switch to that, before
calling (mu4e) if no such buffer is found.
2022-09-30 22:40:43 +02:00
毕达哥拉斯
2c31028a56
fix(treemacs): treemacs-collapse-dirs not changing
`treemacs-collapse-dirs` cannot be changed by setting
`+treemacs-git-mode` to `extended` or `deferred`

Fix: #6850
2022-09-30 22:39:24 +02:00
Dave Lucia
04fa5fb948
fix(web): remove .sface from web mode autolist
elixir-mode can now handle .sface files from surface-ui.org

Ref: #4905
2022-09-30 22:35:07 +02:00
Henrik Lissner
285b460c80
fix: module load order
A mistake in 5a5195b caused modules without an explicit :depth to be
loaded in the wrong order (because their final depth wasn't cached
correctly, and so were all given a depth of 0, thus falling back on
their insertion order, which is precisely what 5a5195b was trying to
fix). This commit fixes that and changes the module cache vectors to
match the structure of doom-module-context, for consistency.

Amend: 5a5195b84d
Fix: #6813
Fix: #6859
2022-09-29 17:35:59 +02:00
Henrik Lissner
9f512a60bf
nit: mention test env for startup optimizations
And remove "debug-mode" clause because of c20ba77.

Ref: c20ba77ff7
2022-09-29 17:35:56 +02:00
Henrik Lissner
71f7e4b5b8
perf: defer resetting inhibit vars further 2022-09-26 12:41:00 +02:00
Henrik Lissner
fbe94ba9f2
perf: inhibit display-startup-screen 2022-09-26 12:39:10 +02:00
Henrik Lissner
5bfe0ba53f
fix(cli): load $DOOMRC relative to $PWD
Rather than doing so relative to bin/doom.
2022-09-26 12:31:27 +02:00
Henrik Lissner
95bdc3b566
fix(lib): doom/reload-*: void-function doom-with-context
This macro used to be `doom-with-context`, but was renamed in the middle
of backporting f9201eb218, but these references were missed.

Fix: #6849
Amend: f9201eb218
2022-09-26 12:06:42 +02: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
07171185bb
fix: doom-module-context: nil doom-module-context
If a module isn't enabled, this should silently set the context to an
empty array, not nil, which causes a (aref nil 2) type error.
2022-09-26 02:08:07 +02:00
Henrik Lissner
b8038e93cf
fix: doom-package-list: failures to resolve module context
doom-module-from-path fails to deduce the module from some paths (it
seems to struggle with doom-user-dir in some cases), causing a (aref nil
2) error (see #6845).

Fix: #6845
2022-09-26 02:08:00 +02:00
Henrik Lissner
07c1534ea3
fix(modeline): void-function +modeline-refresh-bars-h error
Occurs during non-interactive startup of the user's config (e.g. 'doom
doctor'), while :ui (modeline +light) is enabled.

This is a makeshift solution until I get around to finishing the +light
feature.
2022-09-26 00:47:28 +02:00
Henrik Lissner
39b8934236
fix(lib): package! error from doom/bump-* commands
package! complains that "package! can only be used in packages.el
files".

Amend: 4efaf6837b
Amend: f9201eb218
2022-09-25 19:18:05 +02:00
Henrik Lissner
d362490d45
fix(docs): if doom-emacs-dir doesn't end w/ slash
Doom is slowly transitioning away from requiring that its doom-*-dir
variables end in a slash (see two refs below), but there are some
vestiges of it left. This is one of them.

Fix: #6842
Ref: 00e8f6b72a
Ref: b914830403
2022-09-25 18:21:32 +02:00
ivanbrennan
2bb7e8d018 fix(lib): doom-info symlink-path
The `if` clauses were swapped, such that a non-symlinked path was shown
like,

  ~/.config/emacs/ -> ~/.config/emacs/

and a symlinked path was shown as,

  ~/.config/emacs/
2022-09-25 18:18:00 +02:00
Henrik Lissner
2645ed491b
perf: autoloads: remove definition-prefixes & abbreviate paths
Reduces the file size of the autoloads path by ~5%, memory usage by ~7%,
and buys around ~30-50ms in startup time.
2022-09-25 17:52:07 +02:00
Henrik Lissner
156fade7e2
fix(emacs-lisp): set doom-module-context in eval handler
So module context is in scope of evaluated code.

Amend: 4efaf6837b
2022-09-25 17:52:07 +02:00
Henrik Lissner
5222612527
refactor(cli): reorganize CLI library
* lisp/cli/help.el (doom help): move to lisp/cli/meta.el, and add :dump
  definition.
* lisp/doom-cli.el:
  - (doom-before-init-hook): trigger hook after the file is done
    loading.
  - (doom-cli-backtrace-depth, doom-cli-straight-error-lines,
    doom-cli-benchmark-threshold): rename these variables' prefix from
    `doom-cli-` to `doom-cli-log-`.
  - (doom-cli--plist): rename to doom-cli--group-plist, to better clue
    in what changes it.
  - (doom-cli-context-parse): remove unused letbind (argsleft).
  - (doom-cli-create-context-functions, doom-cli-before-run-functions,
    doom-cli-after-run-functions): define with defcustom instead of
    defvar, to indicate that they are (especially) intended for end-user
    configuration.
2022-09-25 17:52:07 +02:00
Henrik Lissner
a29041735c
tweak(cli): read $DOOMPATH like $EMACSLOADPATH
$EMACSLOADPATH is read to pre-fill load-path. Empty entries therein are
substituted with the default value of load-path. I am mirroring this
behavior with the $DOOMPATH variable.
2022-09-25 17:52:07 +02:00
Henrik Lissner
1a1e7b808b
fix(cli): doom env: deny DOOMPROFILE more precisely
The former regexp was too permissive. Not that it was an issue, but it's
one thing less to worry about.
2022-09-25 17:52:05 +02:00
Henrik Lissner
9c72b0e81f
nit: early-init: update commentary 2022-09-25 13:28:29 +02:00
Henrik Lissner
fa345fcc62
refactor: early-init: distinguish failure/fallthrough states
If lisp/doom.el does not exist, then we assume the user isn't loading a
Doom config and fall through to $EMACSDIR/early-init.el, if it exists.
However, `load`'s NOERROR argument suppresses more than just
file-missing errors -- it suppress permissions errors and other
legitimate IO errors that I want to treat as error states, not
fall-through states. This commit fixes that.

* early-init.el (gc-cons-threshold): Set a reasonable more default for
  gc-cons-threshold for non-Doom configs (16mb), instead of
  most-positive-fixnum, which would eventually cause
  freezing/stuttering for non-Doom profiles.
2022-09-25 13:25:15 +02:00
Henrik Lissner
e61af32307
fix: early-init: wrong-type-argument stringp nil
early-init-file is nil in most cases, at this point, so use
user-init-file instead.
2022-09-25 13:08:11 +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
8bf308f9b1
fix: failure to recognize X switches in PGTK builds
This is a regression introduced in 1c4217a.

Doom unsets command-line-x-option-alist when it reasonably suspects it's
not running in an X environment. The heuristic for that is checking when
`initial-window-system` is set to `x`, but as it turns out, PGTK builds
of Emacs set this to `pgtk`, so PGTK users were deprived of Emacs' X
switches, like --geometry, --foreground, --font, etc (they'd throw an
"Unknown option" error at startup). This was fixed.

However, this heuristic isn't perfect. Not all PGTK users are on X (I'd
hazard to guess most of them aren't). So a more reliable check is
needed (and it's too early in the startup process for us to call
display-graphic-p on any frame). The `(not IS-LINUX)` or `(or IS-MAC
IS-WINDOWS)` I had previously used (before 1c4217a) wasn't enough
either, because users can (and do) install X on these
systems (especially where WSL is involved). Still, until I've found a
better one, this is an acceptable workaround.

Amend: 1c4217aa27
2022-09-25 11:35:48 +02:00
Henrik Lissner
731764ae71
fix(cli): doom install: wrong-number-of-args error
This corrects a typo that snuck into 6c76b98.

Amend: 6c76b98dbb
2022-09-24 23:09:17 +02:00
Henrik Lissner
594d70292d
refactor: remove use-package from doom-keybinds.el
One step toward a use-package-less future.

Ref: dda848e089
2022-09-24 22:10:02 +02:00
Henrik Lissner
ffad2bc49e
perf: move doom-init-ui-h to window-setup-hook
This has little effect on startup time now, but seems to buy 100-200ms
with some 3.0 optimizations that will come soon.
2022-09-24 22:10:02 +02:00
Henrik Lissner
5f37069402
fix(cli): excessive "cannot find X" logs
It doesn't really matter if these files can't be found, and it only
services to fill up the logs with noise.
2022-09-24 22:10:02 +02:00
Henrik Lissner
c20ba77ff7
tweak: employ startup optimizations even in debug mode
It's kind of a pain to have different behavior when you're debugging.
Some errors may not present without them, so best to remain predictable
and permit these optimizations even when debug mode is on.
2022-09-24 22:10:02 +02:00
Henrik Lissner
29dfce32bd
fix(doom-dashboard): hide benchmark until available
The dashboard has a chance to display before doom-init-time is
calculated. To prevent the resulting type error, hide it until it is
ready.
2022-09-24 22:10:02 +02:00
Henrik Lissner
8c442d84b9
perf: custom-dont-initialize = t
defcustom does some initialization work to accommodate the possibility
that the user has set the variable before it was defined.  This work is
unneeded so early at startup, so I disable it (temporarily).

In the future, Doom will use defcustom more, as it's a helpful
indication to readers what variables I intended for configuration (and
helps with discovery of options through `M-x doom/help-custom-variable`
or `M-x customize`). As that transition occurs, the benefit of this
optimization will begin to show, but for now its effect on startup time
is negligible.

* lisp/doom.el (warning-suppress-types): set this immediately. Since its
  default value is nil and this happens so early at startup, we don't
  have to be considerate of defaults. Plus, this custom-dont-initialize
  optimization can cause breakage if a warning is thrown *before* before
  this setting is changed.
2022-09-24 22:10:02 +02:00
Henrik Lissner
1c32e317cc
tweak(lib): log calling hook from doom-run-hook
Makes it easier to trace hooks through logs.
2022-09-24 22:10:02 +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
5d2313155c
fix: overriding doom-version's plist
setplist will overwrite a symbol's previous properties (like
documentation).
2022-09-24 22:09:39 +02:00
Henrik Lissner
71b2b09f5c
fix(cli): doom-cli-load: replace load! w/ doom-load
load! effectively loads (file-name-concat (dir!) PATH) which, in this
case, is concatenating two absolute file paths. Emacs does the right
thing and loads PATH, but I don't want to rely on this good fortune as
it could be broken in a future update.
2022-09-24 22:09:39 +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