Commit Graph

452 Commits

Author SHA1 Message Date
Henrik Lissner
e99ae5382c
Refactor package! macro
And have :ignore and :freeze be evaluated during package management,
rather than during macro expansion/compile time.

Also gives doom-package-prop a third, boolean argument. If non-nil,
`eval' the return value.
2018-06-24 22:23:08 +02:00
Henrik Lissner
be44b1ae8a
Fix package!'s :disable being read unconditionally
Because the package was added to doom-disabled-packages at macro
expansion time, rather than at run time. This meant that, even if you
did:

  (when nil
    (package! x :disable t))

x would still be disabled.

Reported by @ar1a
2018-06-24 12:08:55 +02:00
Henrik Lissner
f6dc6ac74e
Refactor out map.el usage
After some profiling, it turns out map-put and map-delete are 5-7x
slower (more on Emacs 25) than delq, setf/alist-get and add-to-list for
small lists (under 250 items), which is exactly how I've been using
them.

The only caveat is alist-get's signature is different on Emacs 25, thus
a polyfill is necessary in core-lib.
2018-06-23 19:53:54 +02:00
Henrik Lissner
643c64c19f
Prevent creation of ~/.emacs.d/elpa
Due o package-gnupghome-dir not being set properly.
2018-06-20 12:45:51 +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
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
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
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
04ec62c8f2
General, minor refactor & feedback revision 2018-06-14 19:49:03 +02:00
Henrik Lissner
77ac164651
Fix core libraries not loading
Caused because the load-path is reset to doom-site-load-path in
doom-initialize-packages, which was initialized before doom-core-dir was
added to it, so core-* libraries couldn't be found.
2018-06-12 12:18:21 +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
6f98aeebfb
Don't set doom-init-modules-p from doom-modules
Causes user config to not be loaded if doom-modules is used earlier.
2018-06-10 20:58:00 +02:00
Henrik Lissner
f02156286b
Error if autoloads are missing interactively
Trying to regenerate them greatly complicates doom-initialize's
potential use-cases. Keep it simple stupid!
2018-06-10 20:57:14 +02:00
Henrik Lissner
19deb4b926
Fix buffer-read-only: autoloads.el error 2018-06-10 20:55:42 +02:00
Henrik Lissner
f144691157
Don't delete autoloads file
Turns out to be more error prone. Better to just ignore the existing one
when force-initializing Doom.
2018-06-10 19:07:37 +02:00
Henrik Lissner
a87641635f
load-prefer-newer = nil for private config
load-prefer-newer = t makes debugging harder and reduces the
predictability of your config.
2018-06-10 17:28:17 +02:00
Henrik Lissner
b079db8ec3
Refactor unneeded arg out of local function _load
In doom-initialize-packages.
2018-06-10 17:28:17 +02:00
Henrik Lissner
edb6fd1964
Change how private & disabled packages are marked
They are now included in doom-packages, but with :private t or :disabled
t properties. This allows us to search for them if we wish (e.g. for
doom info).
2018-06-10 17:28:17 +02:00
Henrik Lissner
88f1ae3797
Refactor autoloads init in doom-initialize
Simplify doom-initialize-autoloads
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
1e2fc4227a
Fix void-variable: package--initialized error 2018-06-10 17:28:17 +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
b207c4040b
Minor, general refactor 2018-06-07 02:51:46 +02:00
Henrik Lissner
4978a64678
Create core directories before checking version
Otherwise the version cache file can't be written to!
2018-06-05 12:09:42 +02:00
Henrik Lissner
c9bfb58369
Minor, general refactor
Remove redundant keybinds, unused letvars, and fix
doom-module-load-path's docstring referencing its former signature.
2018-06-05 12:04:43 +02:00
Henrik Lissner
8124d5a893
Use package-activated-list for package count
Now that this variable is cached, it should always be available.
2018-06-05 12:04:43 +02:00
Henrik Lissner
282e0d6653
Move emacs version check into doom-initialize
Also fixes void-function errors caused by (now removed)
doom-same-emacs-version-p not being defined in all the contexts it was
needed.

Where it was before was clumsy design.
2018-06-05 12:04:43 +02:00
Henrik Lissner
6da8e5b3ab
Add error handling when loading autoloads files 2018-06-04 21:20:13 +02:00
Henrik Lissner
29005d9975
Load quelpa uncompiled to fix arrayp errors #647
Hopefully...
2018-06-04 21:19:46 +02:00
Henrik Lissner
9ba76b60dc
Refactor require! macro 2018-06-04 00:06:01 +02:00
Henrik Lissner
428f1e1d07
Refactor def-setting!/set! implementation
The `doom-settings` variable has been removed. Setting checks are done
with fboundp now, which is simpler.
2018-06-02 16:26:59 +02:00
Henrik Lissner
a0bec84997 Don't complain if no private packages.el 2018-06-02 01:08:23 +02:00
Henrik Lissner
b28d3414bb
Remove load-prefer-newer letvar around private init
Doesn't actually help and only slows things down.
2018-06-01 17:07:53 +02:00
Henrik Lissner
c04bccc68b
Fix disabled packages not being disabled
By loading the private packages.el in two passes. The first time ensures
later modules will know about disabled packages and the second time
ensures overwritten packages are properly overwritten.

Not the most efficient, but efficiency is low priority in noninteractive
sessions (i.e. during package management), the performance loss is
negligible, and packages.el files (should) have no other side effects
anyway.
2018-06-01 17:03:01 +02:00
Henrik Lissner
6bad6d12f3
Remove doom-psuedo-modules-dir
Not needed with now that doom-private-dir has first class support.
2018-06-01 17:01:39 +02:00
Henrik Lissner
bb6b91da9b
Downgrade missing module warnings to messages 2018-05-29 22:44:21 +02:00
Henrik Lissner
debe3e0dd3 Remove unnused letvar doom--inhibit-reload 2018-05-29 19:39:22 +02:00
Henrik Lissner
bd5ecc1aca
Display warning if a non-existent module is in your doom! block 2018-05-29 18:26:39 +02:00
Henrik Lissner
f8b9cff4aa
Get rid of doom-pre-init-hook 2018-05-28 16:07:11 +02:00
Henrik Lissner
2dc1be2ce8
Update load! macro docstring 2018-05-28 12:30:27 +02:00
Henrik Lissner
1a452b6842
💥 Change first arg of load! macro
load!'s first argument is no longer a symbol (that will cause
void-variable errors now) to save on unnecessary interning and simplify
compile-time logic. It accepts any valid form that evaluates to a string
now.

If you use load!, you need to change its argument to a string!

e.g. (load! +my-module) => (load! "+my-module")
2018-05-27 12:52:28 +02:00
Henrik Lissner
dc7488df73
Remove package-initialize hack before package commands
Doesn't appear to be necessary anymore.
2018-05-25 19:26:11 +02:00
Henrik Lissner
644dc17e32
Minor refactor of doom-initialize-packages 2018-05-25 19:25:47 +02:00
Henrik Lissner
5ef1228201
Fix nested length form typos 2018-05-25 19:22:44 +02:00
Henrik Lissner
d7a5f3b997
Fix doom-module-table failing to fetch module list
...because sexp-at-point needs a valid syntax table, and fundamental
mode ain't got one.
2018-05-25 03:07:23 +02:00
Henrik Lissner
2b8efd6783
Error of private init.el doesn't exist (it really should!) 2018-05-25 02:54:16 +02:00
Henrik Lissner
2990d5bd58
Fix hash-table-p and format type errors on blank startup 2018-05-25 01:26:24 +02:00
Henrik Lissner
a390ef8deb
Reduce doom-module-table calls significantly 2018-05-25 01:17:01 +02:00
Henrik Lissner
11705d0920
Fix void-variable error (let -> let*) 2018-05-25 01:13:28 +02:00
Henrik Lissner
59f70c2a87
Soft-fail if doom-module-table can't find your private init.el 2018-05-25 01:11:53 +02:00
Henrik Lissner
d35598520f
Only package-initialize if uninitialized (from package.el API advice) 2018-05-24 21:20:02 +02:00
Henrik Lissner
9e07940b7c
Fix use-package autoload 2018-05-24 21:20:02 +02:00
Henrik Lissner
30893b0ff1
Fix doom-initialize-packages 2018-05-24 21:20:02 +02:00
Henrik Lissner
8282280965
core-packages: revise docstrings & comments 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
1369c51000
Replace :defer HOOK/FN with :after-call keyword 2018-05-21 01:38:17 +02:00
Henrik Lissner
f2c02e32c8
General minor refactor & comment updates 2018-05-21 01:38:17 +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
f984d46a9b
Fix featurep! & load! calls while byte-compiling
The would prioritize load-file-name over byte-compile-current-file
during byte-compiling, which would result featurep! being unable to
resolve the current module and load! from figuring out where "here" was
to build its relative paths from.
2018-05-20 00:57:58 +02:00
Henrik Lissner
a46e7655dc
Move batch commands from core-packages to autoload/modules 2018-05-20 00:57:18 +02:00
Henrik Lissner
85ee9ce459
Refactor doom module API
+ Consolidate the CATEGORY -> MODULE terminology
+ Rename functions to make their function easier to understand
  + Rename doom-module-expand-file => doom-module-path
  + Rename doom-module-find-path => doom-module-locate-path
2018-05-20 00:03:57 +02:00
Henrik Lissner
5abdbaee38
Rewrite docstrings for doom-initialize{,-packages} 2018-05-20 00:01:07 +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
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
7aecb85c34
Reverse order of operations for doom//reload-packages 2018-05-18 01:10:05 +02:00
Henrik Lissner
340aa0449c
Rewrite & optimize autoload generation logic
Now includes package autoloads (which allows us to shed some fat from
various module configs, but that'll come later).
2018-05-18 01:09:14 +02:00
Henrik Lissner
82f9fb7027
Optimize package management commands
Effectively halving run time on package install, update and autoremove
commands.
2018-05-18 01:08:28 +02:00
Henrik Lissner
e2f99a8c24
Load core-lib sooner 2018-05-17 22:44:20 +02:00
Henrik Lissner
9b0dbe20b0
doom//refresh-packages -> doom//reload-packages (consistency) 2018-05-16 18:26:56 +02:00
Henrik Lissner
a1e49d174a
Exclude {packages,doctor}.el from make compile
These two files shouldn't be byte-compiled. Until now it was expected
that you'd include a no-byte-compile: t header in these files. This is
more convenient.
2018-05-16 18:13:07 +02:00
Henrik Lissner
377e8a7b3c
Refactor doom-initialize; error handling for faulty autoloads 2018-05-16 10:50:01 +02:00
Henrik Lissner
3e6d7f174a
Optimize make autoloads & improve path expansion
Make autoloads will expand the include paths of Doom autoload cookies.
This fixes an issue where paths were expanded to include a file
extension, bypassing the benefits of byte-compilation.
2018-05-16 10:50:01 +02:00
Henrik Lissner
980f5e470b
Fix edge case where package autoloads would break startup
Particularly in the case of gh loading eieio and marshal.
2018-05-16 00:57:31 +02:00
Henrik Lissner
595109209a
Fix doom//reload & optimize make all task 2018-05-16 00:11:14 +02:00
Henrik Lissner
9aa346f185
Make packages! accept list of package names (non lists)
This convenience macro lets you specify multiple packages with one
block, e.g.

  (packages! rtags ivy-rtags glsl-mode)

Each entry can be a full recipe.

  (packages! (rtags :disable t) (glsl-mode :recipe (...)))
2018-05-16 00:11:14 +02:00
Henrik Lissner
0dfe1bc3d5
Allow chained package!'s
This allows users to disable one master package, thus disabling all its
children. e.g. Disable irony, then irony-eldoc, flycheck-irony,
company-irony and company-irony-c-headers will be disabled too.
2018-05-16 00:11:14 +02:00
Henrik Lissner
09ecce0073
Fix package! :disable not disabling packages 2018-05-16 00:11:14 +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
12013b4ad4
Cache interpreter-mode-alist in doom-packages-file too 2018-05-15 21:49:51 +02:00
Henrik Lissner
97b8c04dbb
def-package!: specify id for deferred-load transient hooks
Makes them easier to identify in hook lists.
2018-05-15 21:49:51 +02:00
Henrik Lissner
af079e5f6f
Remove unused doom-deferred-packages variable 2018-05-15 21:49:51 +02:00
Henrik Lissner
70d0ce4528
Fix error when def-package-hook! was used anywhere 2018-05-15 11:23:44 +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
bdf6fceb52
Silence deleted *.elc messages if byte-compile fails 2018-05-14 21:09:12 +02:00
Henrik Lissner
bb88411cc9
General minor refactor & docstring fixes 2018-05-14 20:55:55 +02:00
Henrik Lissner
67dab98859
Improve idempotency of Doom config (in case of reloading) 2018-05-14 20:54:58 +02:00
Henrik Lissner
87699f3973
Change doom//reload to only reload private config 2018-05-14 20:37:13 +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
f2eedb44dc
Remove https from package-archives dynamically 2018-05-14 15:57:54 +02:00
Henrik Lissner
0bd88b8414
Add restart-emacs package & commands 2018-05-14 13:05:03 +02:00
Henrik Lissner
d1068723e4
Move doom-packages-file to doom-cache-dir 2018-05-14 13:05:03 +02:00
Henrik Lissner
afdc6a31b5
Move def-setting! macros to core-packages 2018-05-14 13:05:03 +02:00
Henrik Lissner
e3841c4460
Add placement checks for package macros
Doom should complain if these macros are found anywhere they're not
supposed to be.
2018-05-14 13:05:03 +02:00
Henrik Lissner
88082c0dc9
Add doom//reload command (experimental) 2018-05-14 13:05:03 +02:00
Henrik Lissner
9cd2de0ce9
Fix make recompile 2018-05-10 22:39:09 +02:00
Henrik Lissner
4fc990127c
Silence byte-compiler warnings from plugins 2018-04-18 01:08:56 -04:00
Hinckley, Troy J
daa798acfd don't use HTTPS when INSECURE variable is set 2018-04-14 17:46:51 -07:00
Henrik Lissner
a47d76f5f1
Don't error out if no targets for byte-compilation could be found 2018-04-04 08:14:06 -04:00
Henrik Lissner
5282c6c716
Fix default modules being prioritized over private ones 2018-04-03 15:57:51 -04:00