Commit graph

18658 commits

Author SHA1 Message Date
Henrik Lissner
1c4217aa27
refactor: minor refactors & commentary revision
* lisp/doom-cli.el:
  - reference backport source commit.
  - doom-cli--restart: a type check is all we need here. This is a
    programmer error, not a user error.
* lisp/doom-editor.el (recentf): mention recentf-show-abbreviated (added in
  emacs-mirror/emacs@32906819ad)
* lisp/doom-keybinds.el (doom-init-leader-keys-h): move to
  doom-after-init-hook, in case the user customizes leader variables in
  a previous hook (like emacs-startup-hook or after-init-hook).
* lisp/doom-start.el: use eval-when! to compile out the section on
  non-macOS systems (when Doom gets around to compiling its core files,
  later).
* modules/config/literate/autoload.el (+literate-config-file): use
  file-name-concat instead of string concat. This relaxes the
  requirement that doom-user-dir end in a /; a requirement I intend to
  fully phase out.
* modules/lang/emacs-lisp/autoload.el (+emacs-lisp-non-package): remove
  empty map! macro in flycheck-emacs-lisp-check-form. The macro already
  no-ops at compile-time/in noninteractive sessions since b480ed51a3.
* modules/ui/hl-todo/config.el (hl-todo-keyword-faces): revise
  commentary for default hl-todo keywords.

Ref: emacs-mirror/emacs@32906819ad
Ref: b480ed51a3
2022-09-24 20:31:34 +02:00
Henrik Lissner
f0431b6fac
fix(lib): setq!: use set-default-toplevel-value
This is more correct, as we never want to use this to set buffer-local
variables.
2022-09-24 20:31:34 +02:00
Henrik Lissner
eda2e30721
fix(lib): doom-load: use doom-profile-error
...for errors emitted from the profile directory (basically just the
init file).
2022-09-24 20:31:34 +02:00
Henrik Lissner
a4b58311da
refactor(lib): simplify fn!, add-transient-hook!
* lisp/doom-lib.el:
  - (fn!): unroll the loop into a single, fast setplist that
    doesn't require a cl-lib macro (autoloading which seems to throw an
    error on flatpak/snap builds; still investigating that one).
  - (add-transient-hook!): Removes a redundant let-bind.  `sym` is
    already lexically bound outside the function. This will break
    anywhere lexical-binding is nil though. Not sure if I should cater
    to that scenario...
2022-09-24 20:31:34 +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
d33478dc79
feat(lib): backport file-name-with-extension 2022-09-24 18:46:22 +02:00
Henrik Lissner
2fc3442508
nit: revise init hook docstrings & load order commentary 2022-09-24 18:46:21 +02:00
Henrik Lissner
a3a275624e
refactor: record doom-init-time in doom-after-init-hook 2022-09-24 18:46:21 +02:00
Henrik Lissner
dda848e089
module: add :config use-package
I intend to phase out the internal usage of use-package in Doom's core
and modules. The macro is too complex and magical for our needs.

That said, until we've fully removed it, this :config use-package is
hardcoded to be enabled-by-default, until use-package has been
refactored out of core and modules. It'd be wise not to add it to your
doom! blocks yet.
2022-09-24 18:46:21 +02:00
Henrik Lissner
e61441af52
refactor: use defcustom to define doom-first-*-hook
This will soon be done by convention for variables Doom expects users to
customize.
2022-09-24 18:46:21 +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
772f9f26d9
fix: prevent error on tagless doom-version
This would throw an error when we eventually drop the -pre tag in
doom-version.
2022-09-24 11:52:38 +02:00
Henrik Lissner
19f9e1fdd7
fix: doom-module-locate-path: try load-suffixes 2022-09-24 11:52:34 +02:00
Henrik Lissner
fef7c27bbc
feat: add doom-module-locate-paths function
This is a common idiom within Doom's internals, to create a list
of (existing) module files in any desired order.
2022-09-23 18:03:31 +02:00
Antonio Ruiz
e9ef904eee docs(calendar): say calfw instead of the calendar 2022-09-21 01:05:34 +02:00
Antonio Ruiz
fc2682e4ff fix(notmuch): use new workspace name in +notmuch/quit
This change was meant to be included in the first commit where I changed
the default notmuch workspace name.
2022-09-21 01:05:34 +02:00
Antonio Ruiz
6fc1aa9c62 feat(rss): only call elfeed if necessary
If our *rss* workspace is already populated by elfeed buffers, there is
no reason to re-initialize elfeed.
2022-09-21 01:05:34 +02:00
Antonio Ruiz
3f9e62dab7 feat(notmuch): use a different workspace name
The workspace name *notmuch* is more consistent with Doom's other app
workspace names like *mu4e* and *rss*.
2022-09-21 01:05:34 +02:00
Antonio Ruiz
b2154b5f9b fix(irc): do not emit an error when calling =irc
When the *IRC* workspace is already populated by circe buffers, there is
no reason to emit an error, just switch to the *IRC* workspace and do
nothing.
2022-09-21 01:05:34 +02:00
Antonio Ruiz
31a6fa77d0 feat(calendar): only initialize calfw if necessary
If the *calendar* workspace is already populated with calfw buffers,
there is no reason to re-initialize calfw.
2022-09-21 01:05:34 +02:00
Antonio Ruiz
9d14d093c0 feat(calendar): use a different workspace name
The workspace name *calendar* is more consistent with other app
workspaces like *mu4e*, *notmuch*, *rss*, and *IRC*.
2022-09-21 01:05:34 +02:00
Antonio Ruiz
32baf538ee feat(mu4e): only call mu4e if necessary
If we are already reading emails in Mu4e or composing a message, there
is no reason to go back to the main window.
2022-09-21 01:05:34 +02:00
TEC
f6bddc8fe2 tweak(mu4e): autoload +mu4e-lock-available
+mu4e-lock-available seems like a potential entry-point to the mu-lock
functionality, e.g. on startup check if another Emacs process has mu4e
active, and so it might as well be turned into an autoload.
2022-09-21 00:58:30 +02:00
TEC
4d9ea6853b tweak(mu4e): don't reverse dired marks to attach
Originally this was added to have the order of attached files match the
order of mark selection. Recent usage indicates that this was either
misguided or the behaviour has changed, as this now achieves the opposite
effect --- with nreverse files are attached in reverse order. Removing
nreverse provides the expected behaviour.
2022-09-21 00:56:33 +02:00
TEC
2662d68ae8 fix(mu4e): only widen the mu4e headers frame
It's a bit silly to just unconditionally widen the current frame when
you could have the mu4e headers view in another frame entirely. Instead
we can look for the mu4e headers buffer, and only widen frames where it
is the active buffer.
2022-09-21 00:56:20 +02:00
Samuel Tschiedel
9b73ce3ad8 fix(magit): remap magit-browse-thing to forge-browse-*
When using evil +everywhere, we disable the default forge bindings.
We must then explicitly remap magit-browse-thing, as it's just a
placeholder command (bound in multiple places).
2022-09-21 00:54:09 +02:00
TEC
e2608cbdd5 tweak(literate): clear the tangle output buffer
While this is a hidden buffer, it's raised when an error occurs. In such
situations, it can be a little confusing to see the result of every
tangle to date instead of just the last tangle. It's easy enough to
simple clear the buffer at the start of the tangle process.
2022-09-21 00:53:30 +02:00
Henrik Lissner
028de9483f
fix: load compiled module files, if available
Not that they'll be compiled anytime soon, but just in case.
2022-09-20 17:32:00 +02:00
Henrik Lissner
31be70b565
tweak(cli): add --debug-init if $DEBUG=1
For more debug output, and sooner.
2022-09-20 13:34:58 +02:00
Henrik Lissner
b7b66e6202
fix: $DOOMDIR loading twice and too early
An unintended change snuck into 2c14eff. The :core and :user virtual
modules are no longer stripped from the module list before iterating
through (and loading) them. This meant that Doom would load these two
like regular modules (and first, since these two are always at the start
of the list).

This is harmless for :core, because it has no init.el or config.el, but
:user does! This means $DOOMDIR/{init,config}.el would be loaded
twice (once before all other modules and again afterwards), causing load
order issues (like #6818).

Fix: #6818
Amend: 2c14eff7f1
2022-09-20 13:03:47 +02:00
Henrik Lissner
c5de95f722
perf: defer init for frame's buffer-predicate
Ensures that it doesn't pull in the buffer library so early in the
startup process, or gets called prematurely.
2022-09-20 02:29:14 +02:00
Henrik Lissner
7a81b0252f
fix(lib): doom/help-search-{load-path,loaded-files}
And updates them to reflect upstream changes to the consult--grep API.

Ref: c994e3ed59
2022-09-20 02:29:08 +02:00
Henrik Lissner
c994e3ed59
bump: :completion vertico
minad/consult@6319aec351 -> minad/consult@76aab86015
minad/marginalia@69442c2d94 -> minad/marginalia@7f5bf7818b
minad/vertico@2ad4619665 -> minad/vertico@8078b8cb94
oantolin/embark@5d0459d27a -> oantolin/embark@3add321d74
oantolin/orderless@8b9af2796f -> oantolin/orderless@6b86527b30
tumashu/vertico-posframe@7ca364d319 -> tumashu/vertico-posframe@46aa1dffd1
2022-09-20 02:26:51 +02:00
Henrik Lissner
024048dd5e
perf: disable autoload-compute-prefixes & optimize var cache
- Batch more variables in Doom's autoloads files.
- Remove all the register-definition-prefixes calls generated in
  autoloads files (for both modules' and packages' autoloads). These
  don't serve much purpose, and only incur added cost growing a large
  hash table.
2022-09-20 01:43:33 +02:00
Henrik Lissner
16469f1f9d
perf: defer local-vars hooks until after-init-hook
Any buffers created before after-init-hook could trigger these hooks,
which may house expensive functions, but never anything that is
important at startup time.

However, it must not occur later than after-init-hook (which triggers
before file arguments are processed and file buffers are created).
2022-09-20 01:40:59 +02:00
Henrik Lissner
7a75b63959
fix: incorrect user-init-file set
Prior to this, it would incorrectly be set to
$EMACSDIR/.local/etc/@/init.el.el.
2022-09-20 01:40:59 +02:00
Henrik Lissner
2c14eff7f1
fix: freezing+side-effects on M-x or C-h {f,v}
To understand this issue, you have to understand these two things:

1. Doom builds an init file which combines all its autoloads (for
   packages and modules), and Doom's bootstrapper (which loads modules,
   $DOOMDIR, etc). This init file is byte-compiled.

2. When Emacs byte-compiles elisp, docstrings are lazy-loaded (by
   embedding them in the elc as commented text to be retrieved later).
   This is generally done to save on memory.

Now the issue: when these lazy-loaded docstrings are retrieved, Emacs
may evaluate the whole file to find it, including Doom's bootstrap
process, reloading all its files, the user's config files, and running
all its startup hooks. Not only is this terribly expensive, reloading
these files may have disastrous effects.

One such effect is compounded by Marginalia, which invokes this
docstring fetch process (by calling the `documentation` function in
`marginalia--function-doc`) for *each* symbol in the `M-x` or `C-h
{v,f}` completion lists, which means Doom re-bootstraps multiple times
and rapidly, causing Emacs to totally lock up.

The solution is to simply gate the expensive part of the initfile so it
doesn't run more than once, at startup, and when `doom/reload` is
called. The rest of the file loads instantly.

Still, this is a bit flimsy. I'll think of a more elegant solution
later.
2022-09-20 01:40:59 +02:00
Henrik Lissner
5c9672a28a
bump: :ui treemacs
Alexander-Miller/treemacs@b18a05b1f6 -> Alexander-Miller/treemacs@e4bb236bd5
emacs-lsp/lsp-treemacs@355e468b7f -> emacs-lsp/lsp-treemacs@f7ae97560c

A new major version of treemacs was released some days ago. The
currently pinned version is from February 2022, and it stops LSP servers
from starting with message "cannot load treemacs-lib" via lsp-treemacs.

Fix: #6814
Close: #6812
Co-authored-by: logc <logc@users.noreply.github.com>
2022-09-20 00:56:07 +02:00
Henrik Lissner
46d99917ba
fix(cli): debug output despite no debug-mode
Let's not fall back on original `message` function, at the end of
`with-output-to!`s advice stack.
2022-09-19 17:33:25 +02:00
Henrik Lissner
869852aed9
refactor: startup--load-user-init-file@init-doom advice
- Since its arguments aren't used, make the advice n-arity, to future
  proof the advice.
- Add commentary on load's side-effect on user-init-file.
- Add NOSUFFIX arg to load call, to spare Emacs the file IO of searching
  for init.%d.elc{.{so{,.gz},elc{,.gz},el{,.gz},,gz}}.
2022-09-19 00:02:58 +02:00
Henrik Lissner
b65da762b8
fix(cli): 'Profiles not initialized' error
Due to $DOOMPROFILE being set to an empty string when persisting Doom
CLI sessions, which would affect any case where a CLI command restarts
the session (e.g. when the :config literate module tangles a config or
'doom --debug ...' restarts to set DEBUG=1).
2022-09-19 00:01:03 +02:00
Henrik Lissner
e20af47f22
dev: revise bug report issue form
- Adds back a checklist, to pressure folks to do their homework.
- De-emphasizes pastebin in the system info.
- Revises instructions and postamble for brevity and simplicity. I hope
  less reading to do will translate into more of it being read!
2022-09-18 21:14:06 +02:00
Henrik Lissner
4a4315e36a
dev: remove feature/bump request issue forms
This removes the feature and bump request templates, as our issue
tracker will no longer accept them. They should either be submitted to
our Discourse/Discord, or come in the form of a pull request (as a proof
of concept proposal/RFC), or a bug report (in case a bump is needed to
address a bug).

Ref: https://discourse.doomemacs.org
Ref: https://doomemacs.org/discord
2022-09-18 21:12:25 +02:00
Henrik Lissner
f9de598daa
tweak(lib): doom-info: split byte-compiled-config trait into 3
What used to be a `byte-compiled-config` trait, displayed in your `M-x
doom/info`, is now `compiled-user-config`, `compiled-core`, and
`compiled-modules`, for more helpful granularity for debugging possible
byte-code issues.
2022-09-18 14:01:52 +02:00
Henrik Lissner
231fc9cf53
fix(cli): link $XDG_*_HOME to fake $HOME for doom run
Due to a technical limitation of Emacs <=28, launching Emacs out of a
non-standard location is non-trivial, and `doom run` tries to promise
that it can do so on demand. Emacs 29 does introduce a --init-directory
switch that would make this easy, but it'll be some time before we can
rely on it.

So 'doom run' creates a fake $HOME in /tmp/doom.run/ and writes a
bootloader there to load your Doom config remotely. But there's a
problem: in this fake $HOME, none of the user's config, cache, data, or
binscript directories are available, so I symlink them there. This
should at least resolve the most trivial incompatibilities (like the
lack of all-the-icons fonts, which typically get installed to
$HOME/.local/share/fonts/ -- see #6807), but there may be yet more edge
cases. Still, this is a good enough compromise for now.

Fix: #6807
2022-09-18 13:55:47 +02:00
Henrik Lissner
e2ce4345d2
bump: :lang org
abo-abo/org-download@947ca22364 -> abo-abo/org-download@19e166f0a8
alf/ob-restclient.el@3ac834b02b -> alf/ob-restclient.el@1b021ce1c6
emacs-straight/org-mode@00adad9357 -> emacs-straight/org-mode@86c4635dba
emacsmirror/org-contrib@39e2abc562 -> emacsmirror/org-contrib@0740bd3fe6
hakimel/reveal.js@e219184f37 -> hakimel/reveal.js@c1c4145240
org-roam/org-roam@7f453f3fff -> org-roam/org-roam@d95d25615e

Close: #6692
Fix: #6691
2022-09-18 13:10:49 +02:00
Henrik Lissner
8fd7e8bed0
fix(lib): doom/reload to reflect recent changes
Fix: #6806
2022-09-18 13:10:49 +02:00
Henrik Lissner
195359cf99
fix: properly disable tooltip-mode
In 4a25375, it seemed that only setting the variables to nil early
enough would be sufficient, but this turned out not to be the case.
There's no avoiding calling the mode to disable it.

Ref: 58c0de6841
Amend: 4a253757cb
2022-09-18 10:36:00 +02:00
Henrik Lissner
9d52ba2747
fix: envvar file not loading
This is because display-graphic-p returns nil so early in the startup
process.

Fix: #6802
2022-09-18 01:08:27 +02:00
Henrik Lissner
7fd6cd4398
refactor: remove redundant server-auth-dir setting
And move server-name setter to :config.
2022-09-18 00:54:10 +02:00