Commit Graph

391 Commits

Author SHA1 Message Date
Henrik Lissner
84343f57aa
Refactor UTF-8 setters
Some were redundant
2019-03-02 03:53:13 -05:00
Henrik Lissner
d46bb287ae
General refactor of Doom core
- Code reduction and refactor across the board (cull unneeded minor
  advise, hooks and hacks or update them)
- Revise outdated comments and docstrings
- Reorganize core autoload libraries
- Remove large file check (Emacs already has a built-in one, which we
  augment to be even more performant when it does kick in)
- helpful.el can now be disabled completely through package!
2019-03-02 01:34:19 -05:00
Henrik Lissner
8a90f29c91
Make session persistence module agnostic
They've been removed from feature/workspaces and moved into
core/autoload/sessions, which falls back to desktop.el if persp-mode
isn't present. This also offers a substantial speed up to
restart+restoring and restoring sessions in general.

Also fixes #1210, where the newly spawned frame after doom/restart
wasn't focused.

Introduces the following commands:

- doom/restart
- doom/restart-and-restore
- doom/quickload-session
- doom/quicksave-session
- doom/load-session
- doom/save-session
- +workspace/restore-last-session (alias for doom/quickload-session)

And removes

- +workspace/load-session
- +workspace/save-session
- +workspace/load-last-session (renamed to +workspace/restore-last-session)
- +workspace/restart-emacs-then-restore (replaced by doom/restart-and-restore)
- :ss (ex command)
- :sl (ex command)
2019-03-02 01:34:19 -05:00
Henrik Lissner
21e01189b9
Properly keep cursor out of minibuffer prompt
The prompt in the minibuffer is read-only. You are able to move the
cursor into it before this fix.

This also more effectively silences echo-area output when deleting text
in the minibuffer. No more "Text is read-only" blocking what you're
typing.
2019-03-02 01:34:14 -05:00
Henrik Lissner
11d7ae070a
Add async-byte-compile-log-file setting to core.el 2019-02-21 19:13:35 -05:00
Henrik Lissner
19987df00a
Add IS-BSD constant
Fixes dired gls support on BSD OSes (and not just MacOS).
2019-01-05 16:06:26 -05:00
Henrik Lissner
e373052064
Restrict support to Emacs 25.3+ from now on
25.1-25.2 are no longer supported.
2018-12-28 15:22:52 -05:00
Henrik Lissner
9936532ea3
Move auth-sources & mc/list-files
...to move appropriate locations.
2018-12-23 23:16:03 -05:00
Henrik Lissner
a124497f4e
find-file-visit-truename = t 2018-12-22 14:30:29 -05:00
Henrik Lissner
f4698d2f0a
Fix uncaught errors during incremental load 2018-12-10 13:50:58 -05:00
Henrik Lissner
5d3bada86e
Don't byte-compile xdg-path in doom-private-dir
The danger of a stale value post-byte-compilation far outweighs the
benefits.
2018-10-06 20:44:25 -04:00
Henrik Lissner
fd19698927
doom|hack-local-variables => MODE-local-vars-hook
Uses a less destructive method (the same that Spacemacs uses) than the
one introduced in 13cee68, by introducing MODE-local-vars-hook hooks,
which run after local vars have been initialized.

The old method was to call `hack-local-variables` *before* mode hooks
run, however, this causes variables set by modes to have higher
precedence than local vars, which is unacceptable.

Also moved intero-mode & dante-mode to haskell-mode-local-vars-hook
2018-09-29 15:01:35 -04:00
Henrik Lissner
cae5009925
cl-remove-if -> cl-delete-if
Minor optimization for doom-load-packages-incrementally (cl-delete-if
deletes in-place).
2018-09-28 22:50:39 -04:00
Henrik Lissner
13cee6870e hack-local-variables before mode hooks
The default behavior is to read file+directory-local variables after the
major mode and its hooks have run. I think this is backwards. What if we
want to use these local variables to customize the things running in
hooks?

This does mean hack-local-variables will run at least twice when the
mode changes, but this is an acceptable compromise.
2018-09-28 21:13:28 -04:00
Henrik Lissner
078e3028a6 Minor, general comment revision 2018-09-28 21:02:59 -04:00
Henrik Lissner
c8b07f3caa
Fail gracefully if incremental load fails
...and continue loading other packages regardless.
2018-09-20 10:42:45 -04:00
Henrik Lissner
ba16dd8954
Resolve symlinks in doom-emacs-dir (and inline it) 2018-09-19 19:41:46 -04:00
Henrik Lissner
cc28aacecb
Don't inline DOOMDIR in doom-private-dir
Breaks DOOMDIR when config is byte-compiled, as mentioned in #900
2018-09-19 19:27:49 -04:00
Henrik Lissner
f4e119a642 Couple core-packages to package.el sooner
This way, if the user loads package.el themselves, doom's package.el
settings will take effect immediately.
2018-09-18 15:19:50 -04:00
Henrik Lissner
b96d50b3de history-length = 500 2018-09-18 15:19:50 -04:00
Henrik Lissner
e80f5e4c85
Remove unnecessary optimization in doom-try-run-hook
Hooks run with this should already be run in a gc-deferred state (at
startup), so deferring garbage collection _again_ may just cause
unnecessary consing.
2018-09-18 11:45:13 -04:00
Henrik Lissner
b7be38b2a9
New incremental lazy-loading at startup
This is for loading large packages (like org and magit) quietly in the
background during idle time. It is already set up to incrementally load
org and magit.

This is still experimental, however. the idle timers may need to be
tweaked.
2018-09-18 11:42:35 -04:00
Henrik Lissner
a9fdeefe15
Revert 142d364
Only add doom-private-dir to load-path during autoload generation,
otherwise a $DOOMDIR/autoload.el will shadow the built-in autoload.el
Emacs package.

Note: with `doom-private-dir' in `load-path', Doom autoloads files will
be unable to declare autoloads for the built-in autoload.el Emacs
package, should $DOOMDIR/autoload.el exist. Not sure why they'd want to
though, so it's an acceptable compromise for simpler autoload
declarations.
2018-09-14 09:39:40 -04:00
Henrik Lissner
142d3646ef
Add doom-private-dir to load-path
Makes private autoload paths simpler
2018-09-13 19:15:15 -04:00
Henrik Lissner
75036cefb0 Revert max-{specpdl-size,lisp-eval-depth} changes
They were unnecessary and could cause crashing in some cases.
2018-09-10 09:04:27 -04:00
Henrik Lissner
f07ae6a02b
max-specpdl-size = 5000, max-lisp-eval-depth = 2500
The defaults were designed for much, much older systems. We can safely
increase this to stave off premature abortion of intentional deeply
nested loops or excessive allocations.
2018-09-09 09:58:20 -04:00
Henrik Lissner
57579b883b
Refactor doom core files 2018-09-09 09:58:20 -04:00
Henrik Lissner
7d3ffdff06
Remove third line in section headers
This is truly important stuff. We've saved many lives with this update.
2018-09-09 09:58:19 -04:00
Henrik Lissner
eaa10946f1
Refactor startup optimizations
+ Add doom-gc-cons-upper-limit variable
+ Don't use most-positive-fixnum, in case Emacs somehow wants to
  allocate that much!
+ Don't use startup optimizations in noninteractive sessions
+ Restore gc-cons-threshold on idle timer, instead of hook (to defer the
  possible GC pause and so deferred packages can take advantage of these
  optimizations).
2018-09-03 03:58:43 +02:00
Henrik Lissner
daef19ba64
Defer garbage collection in the minibuffer
This can speed up things that run in or from the minibuffer, like
projectile/helm/ivy commands.
2018-09-02 17:06:12 +02:00
Henrik Lissner
712b775f36
Remove doom*set-indirect-buffer-filename hack
This was done to help the modeline build its file path in indirect
buffers, but this has been fixed by using buffer-base-buffer.

Both ui/modeline and ui/doom-modeline have been refactored to
accommodate this.
2018-09-01 12:39:26 +02:00
Henrik Lissner
300181aba3
Move custom hooks in core.el closer to top
Conform to the Doom/lisp convention of defining customizable elements
close to the top of files.
2018-08-26 00:20:18 +02:00
Henrik Lissner
631c4004ba
Load custom-file only once & after user's config
This change facilitates the users that prefer their custom-file
somewhere other than doom-local-dir (e.g. in ~/.doom.d/custom.el).

This change prevents loading both files during startup. Just change
`custom-file` and Doom will load it after your config.el is loaded (but
before doom-post-init-hook runs).
2018-08-25 19:45:23 +02:00
Henrik Lissner
62977247c9
Revert da7f9019 & refactor doom init hooks 2018-08-21 04:27:14 +02:00
Henrik Lissner
da7f9019d1
Run doom-post-init-hook as late as possible
Possibly fixes recursive load errors, to do with
kill-buffer-query-functions and buffer-predicate autoloads loading in a
weird way on Emacs 25 (and especially on MacOS, for some reason).
2018-08-21 04:03:05 +02:00
Henrik Lissner
ee73d6c9af
Minor reformatting & comment tweaks 2018-08-21 03:34:39 +02:00
Henrik Lissner
f923ed4341
Add docstrings to doom-inhibit-switch-*-hooks vars 2018-08-17 04:34:43 +02:00
Henrik Lissner
deea5f11b3
Fix enter/exit window/buffer hook names 2018-08-17 04:01:46 +02:00
Henrik Lissner
4a4b012b5d
Move custom hooks to core/core.el
Also ensures that the custom hooks aren't fired until as late as
possible, which prevents a few packages from prematurely loading at
startup. Faster startup! Yay!
2018-08-17 01:57:09 +02:00
Henrik Lissner
25d9786edf
Add early-init-file support to doom/profile-emacs #788
And fix wrong-type-argument: stringp errors when running esup.

Also ensure that doom|run-all-startup-hooks sets after-init-time.
2018-08-13 03:47:33 +02:00
Henrik Lissner
36044fccc9
defconst -> defvar for global constants
So they can be changed prior to being defined (e.g. for
doom/open-vanilla-sandbox).
2018-08-12 02:45:28 +02:00
Henrik Lissner
6eafdd7c62
Refactor module load process
doom! no longer loads modules, it only sets
doom-modules (incrementally).

Instead, modules are loaded by doom-initialize-modules (which makes more
sense).
2018-08-08 23:37:30 +02:00
Henrik Lissner
f88a97177c
Rename doom-ensure-core-directories
Give it a more descriptive name
2018-08-08 23:37:30 +02:00
Henrik Lissner
ea0f46b181
Add 2nd arg to doom-initialize to load core libs
This restores the correct value of noninteractive while core libs are
loading, so packages like recentf can avoid initializing when running
emacs non interactively (thus polluting output or possibly causing
errors).
2018-08-03 16:35:42 +02:00
Henrik Lissner
f16597ec72
Set gamegrid-user-score-file-directory
THIS IS IMPORTANT GUYS
2018-08-02 17:06:30 +02:00
Henrik Lissner
f3a3465c04
history-length = 250
Reduce from 500 to slim savehist data files and general Emacs memory
footprint.
2018-07-29 17:41:59 +02:00
Henrik Lissner
4941e327f4
General refactor for readability
+ Removes redundant/unhelpful comments
+ Renames functions, hooks and variables to be self-documenting
+ Use add-to-list to ensure idempotency (and is more performant)
2018-07-09 15:33:31 +02:00
Henrik Lissner
3d3d04b21c
Move use-package config to core-modules 2018-06-20 12:48:59 +02:00
Henrik Lissner
1efb0a8298
Rename core-dispatcher -> core-cli
The file's role is easier to guess at a glance.
2018-06-20 12:04:11 +02:00
Henrik Lissner
151858a8dc
Redesign Doom error handling
Another refactor, again to improve the locality of doom errors and make
the data that accompanies them more useful in determining the origin and
source of issues. Also, bin/doom is now a little more informative about
how to debug errors.
2018-06-20 02:07:12 +02:00
Henrik Lissner
84756b33a0
Fix closure symbolp errors blocking stacktraces
Caused because of symbol-file advice assuming SYMBOL would always be a
symbol.

This would prevent backtraces from happening, making debugging
impossibly obtuse.

This may indirectly fix #701
2018-06-20 01:59:07 +02:00
Henrik Lissner
600d7bcb4f
core: minor refactor/reformat
+ Prefer cl-loop over cl-mapcan for performance reasons.
+ Remove unnecessary let form
+ Log doom-try-run-hook when doom-debug-mode is on.
2018-06-19 20:55:44 +02:00
Henrik Lissner
0fefc43d39
Refactor autoloads init & error handling
Also reduces byte-compiled forms in the backtrace of a
doom-autoload-error.
2018-06-19 17:19:11 +02:00
Henrik Lissner
2c1b0ccaf8
Fix doom|run-all-startup-hooks
Wasn't using doom-try-run-hook correctly.
2018-06-19 12:01:51 +02:00
Henrik Lissner
4685eddb66
Don't eat stacks in backtraces in debug mode
The error handlers were a little too effective. They obscured a large
chunk of the stacktrace after errors, even in debug mode. This fixes
that and ensures backtraces in debug mode are more helpful.
2018-06-18 17:14:17 +02:00
Henrik Lissner
32954ecb69
Move compile-time fix for disabled packages
This fix prevented the byte-compiler from trying to load packages that
were disabled or failed their :when/:unless/:if predicates. This commit
moves it into doom-byte-compile, so the :no-require predicate doesn't
have to run on every package in an interactive session, eating MY
PRECIOUS cpu cycles.

I do love my cpu cycles, yessiree.
2018-06-18 14:52:24 +02:00
Henrik Lissner
ab07e07352
Improve general error handling at startup
This will hopefully reveal more information as to the cause and origin
of errors at startup. It should also make doom-debug-mode more likely to
produce a backtrace in non-interactive sessions.
2018-06-18 14:47:36 +02:00
Henrik Lissner
0d925cda5e
Load core-os sooner & in all sessions
Indirectly fixes set-env! errors when using it from your init files.
2018-06-18 12:04:30 +02:00
Henrik Lissner
26caea7f2b
Move doom-docs-dir to core.el 2018-06-17 21:39:40 +02:00
Henrik Lissner
03022d09f9
Remove doom//x naming convention
This naming convention was meant to be for batch commands, but it grew
to include "commands that were helpful with managing Doom", but many of
these commands shouldn't be interactive in the first place!
2018-06-17 21:35:58 +02:00
Henrik Lissner
1184967531
Advise symbol-file to return doom-file property
...if it exists. Otherwise fall back on original functionality. This
allows certain symbols to overwrite where Emacs thinks they were
defined.

Warning: only use this for autodefs! It may have unintended side-effects
for other symbols.
2018-06-15 16:20:20 +02:00
Henrik Lissner
bbda434365
Move startup optimizations into init.el
Doesn't really belong in core.el and only applies to interactive
sessions.
2018-06-15 16:20:20 +02:00
Henrik Lissner
db8b4091dd
Fix bin/doom ignoring -d flag
defconst -> defvar
2018-06-15 00:25:39 +02:00
Henrik Lissner
04ec62c8f2
General, minor refactor & feedback revision 2018-06-14 19:49:03 +02:00
Henrik Lissner
933023d779 Minor reformatting & docstring revision in core.el 2018-06-13 22:16:08 +02:00
Henrik Lissner
85591ca296
Move custom-file into local-dir (not etc-dir)
Makes more sense to put more vital files in local than etc or cache.
2018-06-12 12:17:33 +02:00
Henrik Lissner
4425fdfca4
defvar -> defconst for dir vars 2018-06-12 01:48:09 +02:00
Henrik Lissner
4c40195d40
Slightly better version check error 2018-06-12 01:47:43 +02:00
Henrik Lissner
0741c8851a
Split core-packages into two (packages & modules)
+ Move doom-initialize et co into core.el
+ Lazy load core-packages
+ load! has been moved into core-lib
+ Added FILE! and DIR! macros
+ Fix package! not returning correct value when package is disabled
+ Remove :disabled support for def-package-hook! officially
2018-06-12 00:02:04 +02:00
Henrik Lissner
2605a3938e
Initialize modules conditionally
doom-modules will be initialized on demand in non-interactive sessions.
2018-06-10 17:28:17 +02:00
Henrik Lissner
01d1a814f9
Refactor doom-initialize functions
Removes doom-module-table; which was inflexible (though more stable). It
prevented you from putting your doom! block in anywhere but
~/.doom.d/init.el.

It is replaced (somewhat) by (doom-modules).
2018-06-10 17:30:26 +02:00
Henrik Lissner
81c465a545
Move OS constants to core/core.el
So it is universally available to all of Doom, rather than excluding
sessions that haven't called doom-initialize interactively.
2018-06-08 13:31:45 +02:00
Henrik Lissner
b26bbd4762
Fix args-out-of-range in enable-minor-mode-maybe
Caused by trying to use out-of-scope match data.
2018-06-07 02:51:03 +02:00
Henrik Lissner
dd3872dd32
Add DOOMDIR envvar
So doom-private-dir can be customized via shell dotfiles (or chemacs).
2018-06-05 17:20:20 +02:00
Henrik Lissner
1d9ae834f2
Minor refactors & docstring revision
These are not the refactors you are looking for.
2018-06-04 21:17:49 +02:00
Henrik Lissner
8b7888d58f
Increase GC threshold from 8 to 16mb 2018-05-30 19:15:43 +02:00
Henrik Lissner
3f6bfee027
Remember customized settings (load custom-file) 2018-05-30 19:15:29 +02:00
Henrik Lissner
f8b9cff4aa
Get rid of doom-pre-init-hook 2018-05-28 16:07:11 +02:00
Henrik Lissner
a55e2251e6
auto-mode-case-fold = nil
This disables the case insensitive second pass through auto-mode-alist
on case sensitive systems.
2018-05-24 21:20:02 +02:00
Henrik Lissner
8746c12fae
Redesign Doom bootstrap, caching & autoload generation logic
The autoloads file has been split into doom-autoload-file and
doom-package-autoload-file. The former is for Doom's modules and
standard library; the latter is for compiling all package autoloads like
load-path and auto-mode-alist (among other things).

This reduced my startup speed from ~1s to ~0.5s
2018-05-24 21:20:02 +02:00
Henrik Lissner
5d42b1512b
Fix naive path concatenation for doom-private-dir #513 2018-05-24 11:49:01 +02:00
Henrik Lissner
b452aded76
Mention doom-emacs-dir must end with a slash 2018-05-24 11:44:17 +02:00
Henrik Lissner
ac5eaf0fb3
Load core-lib before core-package
So that core-package may use the Doom standard library.
2018-05-21 01:38:17 +02:00
Henrik Lissner
6f5e710d98
Refactor startup process, hooks, doom-initialize & doom!
+ Brings back doom-pre-init-hook and doom-post-init-hook hooks.
+ Extracts autoload file loading logic into doom-initialize-autoloads
  function.
2018-05-19 23:59:55 +02:00
Henrik Lissner
17d5721102
Minor reformatting of core startup config 2018-05-19 23:49:25 +02:00
Henrik Lissner
a19a64b16b
Complain if using Emacs <25
More helpful than advice-add errors.
2018-05-19 18:01:54 +02:00
Henrik Lissner
fa37d7b05e
Refactor core initialization process
A vastly simpler bootstrap process.

Also load core libs in core-lib (duh)
2018-05-19 16:42:48 +02:00
Henrik Lissner
80adb9c1f6
General refactor for consistency & idempotency
Also updated comments
2018-05-18 01:26:41 +02:00
Henrik Lissner
18e6a6b1db
Include package autoloads in doom-autoloads-file
This offloads some of the work Doom has to do creating
`doom-packages-file` onto `make autoloads`. This closely mimics the
package-quickstart-refresh functionality in Emacs 27+, but is more
specialized.

This means package autoloads are now loaded on every startup.

Many :mode, :interpreter, and :commands declarations in def-package!
blocks are made redundant by this and will be cleaned up soon.
2018-05-15 22:17:43 +02:00
Henrik Lissner
94f9e43f25
Rewrite :defer semantics
:defer now supports a hook, a cons cell with (SYMBOL . INTEGER) where
SYMBOL is a hook and INTEGER is a number of idle seconds before the
package is autoloaded, or just the integer (as per the default behavior
of :defer).

Also fixes an issue where switch-buffer-deffered packages (like
smartparens) wouldn't load.
2018-05-15 10:54:45 +02:00
Henrik Lissner
bec79a3d4c
Major refactor of Doom bootstrap process
+ New `input` and `buffer` support for :defer in def-package! can now
  defer packages until the first command invoked after startup or first
  interactive buffer switch, respectively
+ Exploit these new :defer techniques to lazy-load many core packages,
  netting Doom a 20-30% decrease in startup time
+ Various userland macros (like package!, def-package-hook!, packages!,
  and disable-packages!) will now throw an error if used incorrectly
  (i.e. outside of their intended files; e.g. package! should be used in
  packages.el files)
+ Removed support for multiple/nested doom! calls. There should only be
  THE ONE in ~/.doom.d/init.el (or ~/.config/doom/init.el)
+ Fix an issue where load-path and auto-mode-list modifications would
  not persist because doom-packages-file was cached too late.
+ Added package-activated-list to cached variables in
  doom-packages-file, thus we no longer need custom-file.
+ Load Doom core files from doom-initialize. Now doom-initialize can be
  called from state-dependent non-interactive functions, instead of
  reloading core/core.el, which was clumsy
+ Removed the doom-post-init-hook hook. There was no reason for it to
  exist when doom-init-hook can simply be appended to
2018-05-14 20:37:13 +02:00
Henrik Lissner
bb4a8e98e6
load-prefer-newer = noninteractive 2018-05-14 18:34:34 +02:00
Henrik Lissner
a1b385a23d
eval-when-compile EMACS2*+ consts 2018-05-14 13:05:33 +02:00
Henrik Lissner
b1ddcf1787
Fix locality of makefile commands 2018-04-04 00:01:11 -04:00
Henrik Lissner
6aac8666f3
Ensure after-init hooks are available from private init.el 2018-04-03 22:36:23 -04:00
Henrik Lissner
b6fab5da8d
Fix core not loading byte-compiled private config files 2018-04-03 19:46:47 -04:00
Henrik Lissner
d85a2a6af0
Refactor noninteractive init; set doom-emacs-dir internally 2018-04-03 19:46:22 -04:00
Henrik Lissner
197631f6a4
Apply doom fixes/hacks before loading private init.el
Fixes void-variable: doom-auto-minor-mode-alist errors
2018-04-03 16:24:19 -04:00
Henrik Lissner
68e0694e29
Load private config.el before doom init hooks
Used to load it too late, after customizations were initialized by
doom-init-hook and doom-post-init-hook hooks.
2018-04-03 15:08:31 -04:00
Henrik Lissner
355b4b1364
💥 Replace config/private w/ first-class support
The config/private module has been removed. ~/.doom.d (or
~/.config/doom; whichever is detected first) is now a first class
citizen of Doom and should just work(tm).

Your init.el only needs to contain:

  (require 'core (concat user-emacs-directory "core/core"))

And you may place your doom! block in ~/.doom.d/init.el (or
~/.config/doom/init.el).
2018-04-03 03:07:30 -04:00