Commit graph

46 commits

Author SHA1 Message Date
Henrik Lissner
3a5e34d67b
fix: premature doom init in doom sub-profiles
Ensures that Doom doesn't prematurely initialize itself if a non-Doom
config tries to load Doom.
2022-08-02 20:22:31 +02:00
Henrik Lissner
b9933e6637
refactor!: restructure Doom core
BREAKING CHANGE: This restructures the project in preparation for Doom
to be split into two repos. Users that have reconfigured Doom's CLI
stand a good chance of seeing breakage, especially if they've referred
to any core-* feature, e.g.

  (after! core-cli-ci ...)

To fix it, simply s/core-/doom-/, i.e.

  (after! doom-cli-ci ...)

What this commit specifically changes is:
- Renames all core features from core-* to doom-*
- Moves core/core-* -> lisp/doom-*
- Moves core/autoloads/* -> lisp/lib/*
- Moves core/templates -> templates/

Ref: #4273
2022-07-30 22:41:13 +02:00
Henrik Lissner
44f169740e
tweak: more debug output at startup
Particularly to do with profiles, in case the user starts Emacs with
--debug or --debug-init.
2022-07-28 12:01:02 +02:00
Henrik Lissner
48e3603dfe
fix: envvars in profiles.el not being set 2022-07-28 12:01:02 +02:00
Henrik Lissner
5af38fb08e
feat: make bin/doom profile aware
- Fixes Doom's former inability to (trivially) juggle multiple profiles
  based on the same EMACSDIR (see #6593).
- Adds '--profile NAME' switch to bin/doom (also recognized
  $DOOMPROFILE).
- Adds new doom-profile* variables. These will eventually replace
  doom-{local,etc,cache}-dir and doom-{autoloads,env}-file.

This is intentionally messy to ensure backwards compatibility for a
little while longer. This will be fixed over the next couple weeks.

Ref: #6593
2022-07-28 12:01:02 +02:00
Henrik Lissner
1ecb5c7b9b
fix: fall back to $EMACSDIR/profiles/*
Formerly, profiles.el and $EMACSDIR/profiles/* were mutually exclusive.
I.e. if the file existed, it'd never check the directory. Now, it will
check the directory if the requested profile isn't in profiles.el, or
the file didn't exist.

Amend: 5b6b204bcb
2022-07-27 13:54:12 +02:00
Henrik Lissner
fbc5fd7f8a
nit: revise comments in early-init.el 2022-07-27 12:11:51 +02:00
Henrik Lissner
5b6b204bcb
feat: allow Doom be used as a config bootloader
This allows users to use Doom core to switch between Emacs configs (they
don't have to be Doom configs either). Taking after Chemacs, these
configs (called "profiles") can be declared in $EMACSDIR/profiles.el or
implicitly as directories under $EMACSDIR/profiles/ (symlinks work too).
Launch a profile with `emacs --profile foo` or by setting $DOOMPROFILE:
`DOOMPROFILE=foo emacs`.

An example profiles.el looks like this:

   ((doomemacs (user-emacs-directory . "~/.config/emacs")
               (env ("DOOMDIR" . "~/.config/doom")))
    (spacemacs (user-emacs-directory . "~/.config/spacemacs"))
    (prelude   (user-emacs-directory . "~/.config/prelude"))
    (altdoom   (user-emacs-directory . "~/.config/doomemacs")
               (env ("DOOMDIR" . "~/.config/doomprivate1")))
    (altdoom2  (user-emacs-directory . "~/.config/doomemacs")
               (env ("DOOMDIR" . "~/.config/doomprivate2"))))

Chemacs users will find the format of this file familiar; the biggest
differences are:

- Keys are symbols, not strings
- There is no, special "default" profile. The fallback profile is the
  Doom Emacs config doing the bootloading, living in ~/.config/emacs or
  ~/.emacs.d. If you don't like that, set $DOOMPROFILE in your dotfiles
  to the name of another profile.

WARNING: bin/doom does not understand --profile or $DOOMPROFILE yet. To
sync a particular profile, you'll have to run its bin/doom directly,
e.g.

To sync the "global" doom:
  ~/.config/emacs/bin/doom sync
To sync your "altdoom" (and "altdoom2") profiles:
  ~/.config/doomemacs/bin/doom sync
2022-07-27 12:11:51 +02:00
Henrik Lissner
5108ffc44d
feat: backport --init-directory for 27/28 users
--init-directory was added in Emacs 29. This backports it for 27/28
users, so users can trivially load an Emacs config living in another
directory (will be necessary for future versions of Doom's sandbox).
However, for this to work, Doom needs to live in ~/.emacs.d or
~/.config/emacs.

Ref: emacs-mirror/emacs@8eaf04de83
2022-07-27 11:16:54 +02:00
Henrik Lissner
1402db5129
refactor: how Doom starts up
Restructures Doom's primary core files and entry points to prepare for
backports (from the new CLI) coming soon.

- Removes $EMACSDIR/init.el.
- Doom configures Emacs to ignore ~/.emacs and ~/_emacs files.
- Doom's bootstrapper for interactive sessions was moved out of core.el
  and doom-initialize into doom-start.el. This change is preparation for
  Doom's new profile system (coming soon™️), where this bootstrapper
  will be dynamically generated.
- core.el and early-init.el have been reorganized, comment headers moved
  around, and comments updated to reflect these changes.
2022-06-18 16:54:45 +02:00
Henrik Lissner
a831946afb
feat: no startup optimizations if debug mode is on 2022-02-17 21:14:27 +01:00
Henrik Lissner
e5e301b3e4 refactor: remove redundant load-file advice
A mistake that snuck into 55c1cac while backporting some code from the
CLI rewrite. It was harmless and likely had no side effects, however.

Amend: 55c1cac43f
2022-01-08 18:55:02 +01:00
Henrik Lissner
55c1cac43f tweak: suppress redisplays cause by site-lisp at startup 2021-12-12 22:43:40 +01:00
Henrik Lissner
68ed4e6298 tweak: suppress 'Loading X...' messages at startup
From site-files, particularly. This *might* fix the white flash while
Emacs is starting up in some scenarios.
2021-11-25 01:22:58 +01:00
Itai Y. Efrat
98f44a006a fix: unset default-input-method in early-init.el
set-language-environment sets default-input-method, which is unwanted.

Fix: #5046
2021-11-04 01:08:43 +01:00
Henrik Lissner
0ab6aba056 perf: inhibit redisplay/echo area at startup
Unnecessary redraws can add 0.2-0.4s to startup times in some cases,
especially where site-files are involved (which spam *Messages* with
"Loading X..." messages; which force redraws).

May also indirectly fix #5643 by deferring redisplay (and therefore
window-buffer-change-functions, which triggers doom-init-ui-hook, which
triggers both Doom's dashboard and persp-mode).

Also removes a redundant set-language-environment call.

Ref #5643
2021-10-18 01:15:09 +02:00
Henrik Lissner
68d8364aea refactor: adopt CalVer and reorganize core.el
Doom is adopting CalVer (starting at 21.12) and, later, I'll move Doom's
core out to a separate repo, where it'll stay with SemVer (starting at
3.0).
2021-10-10 18:36:46 +02:00
Henrik Lissner
d79cea2e4c Minor refactors, reformatting, & comment revision 2021-07-11 17:52:08 -04:00
Henrik Lissner
6ad4f0698e Fix #4995: adapt to more renamed comp-* symbols
Two more variables were renamed upstream.
2021-05-11 19:03:18 -04:00
Henrik Lissner
ea389b8eb2 Restore file-name-handler-alist a little sooner
Too late, and we risk read encoding issues when loading compressed elisp
files.
2021-05-07 02:32:51 -04:00
Henrik Lissner
e2a11d24fd core: minor refactors and comment revisions 2021-05-06 18:36:32 -04:00
Henrik Lissner
bddb2b2a2d Refactor early-init.el 2021-04-21 21:45:04 -04:00
Henrik Lissner
5da3641aad
Move init.el to early-init.el
Our first step toward dropping 26.x support. Allows our optimizations to
reach a little further into the startup.
2021-01-09 02:55:08 -05:00
Henrik Lissner
29d8f44254
Add comments 2020-11-16 19:27:39 -05:00
Henrik Lissner
6a82eedeea
Respect Xresources
This was disabled because of configs, but I'll leave it to the user to
resolve those issues.
2020-10-30 19:09:31 -04:00
Henrik Lissner
b857566239
Minor refactors 2020-10-20 16:52:39 -04:00
Henrik Lissner
b245abfe72
Set comp-deferred-compilation in early-init.el
Seems it's necessary for some and not others.

The emacs experience(TM).
2020-10-06 14:38:32 -04:00
Henrik Lissner
29b12de83e
Fix #3901: unset comp-deferred-compilation later 2020-10-06 02:08:17 -04:00
Henrik Lissner
394a18096e
Disable comp-deferred-compilation in early-init.el 2020-08-18 20:32:34 -04:00
Henrik Lissner
900ec70ee3
Ensure menu/tool/scroll bars are disabled 2020-02-21 12:49:57 -05:00
Henrik Lissner
8a9d8f03e2
Fix void-function set-scroll-bar-mode #2310
When emacs is built without GUI support.
2020-01-05 20:12:24 -05:00
Henrik Lissner
f78f71a74c
Minor refactors & comment revision 2020-01-01 23:52:02 -05:00
Henrik Lissner
a02cfdc365
No-op package--ensure-init-file completely
Rather than setting package--init-file-ensured to nil. It's less work
for Emacs at startup and is functionally equivalent.
2019-12-27 01:44:40 -05:00
Henrik Lissner
bbc6f19381
Ignore X resources for Emacs 27+
A negligible boost in startup speed.
2019-09-06 15:40:38 -04:00
Henrik Lissner
d59405b282
Minor comment revision & refactors 2019-07-23 00:30:45 +02:00
Henrik Lissner
81ab3dbc5d
Simplify and decouple init files
The two doom-gc-* variables in init.el couples the rest of the config to
these two files. The bulk of GC/file-handler optimization was moved into
core.el and simplified (all that idle-timer voodoo was overkill).

Also adds (setq frame-inhibit-implied-reize t) to early-init, which
speeds up startup a fair bit in some edge cases with larger fonts.

squash! Simplify and decouple init files
2019-07-22 02:30:38 +02:00
Henrik Lissner
3ea805cc94
Minor experimental startup optimizations
Definitely premature optimization.
2019-03-02 03:54:04 -05:00
Henrik Lissner
ddaf1e5b67 Fix wrong-type-arg error on menu-bar-open
Due to malformed menu-bar-lines frame property. Same for tool-bar-lines
as well.
2018-09-28 21:13:27 -04:00
Henrik Lissner
a9b4fe2960
Hard code gc-cons-threshold in early-init.el
In the interest of DRY-ness, I avoid redefining `doom-gc-cons-upper-limit`. This value is likely to diverge from the default value of `doom-gc-cons-upper-limit` in the future anyway.
2018-09-19 18:14:01 -04:00
Edwin Török
fae47fc448 Emacs27+: reduce number of GCs on startup from 4 to 1
Signed-off-by: Edwin Török <edwin@etorok.net>
2018-09-19 21:51:43 +01:00
Henrik Lissner
96f2208995
Move early-init.el to init.el (for now)
Calling tool-bar-mode, menu-bar-mode or scroll-bar-mode from
early-init.el seems to cause a 15-30% slowdown in startup time, possibly
for loading the UI libraries early.

Also, loading early-init.el eagerly from init.el causes a GC hit for
Emacs 25/26 users. It's too early to use this optimization.
2018-08-31 23:44:11 +02:00
Henrik Lissner
b656e68bc3
Move startup optimization to early-init
Also load early-init from init if early-init-file isn't bound. This
improves startup a modest 3-5% for Emacs 27 users.
2018-06-16 11:38:19 +02:00
Henrik Lissner
f058505306
New bin/doom (eventual replacement for make)
This commit adds bin/doom, which acts as the middle man that make once
was (and will stay for a while, though the documentation will shift away
from using it). It does everything the previous make interface did, but
is faster and more flexible. bin/doom should eventually replace the
makefile.

bin/doom also makes it easier to run Doom outside of ~/.emacs.d and
~/.doom.d with, for example:

  bin/doom run -p ~/.other.doom.d/ -e ~/.other.emacs.d

bin/doom.cmd is included for Windows users, but I don't recommend using
it yet. It hasn't been tested nor have I ever written a batch script
before.

Also update init.example.el with new defaults.
2018-05-21 01:38:17 +02:00
Henrik Lissner
0e1b2453aa
Revise comments in early-init.el 2018-03-28 00:43:25 -04:00
Henrik Lissner
a6216b152f
Disable {tool,menu,scroll}-bar-mode in early-init.el 2018-03-28 00:41:46 -04:00
Henrik Lissner
f2641dbc11
Add early-init.el for Emacs HEAD 2018-03-21 15:21:18 -04:00