Commit Graph

433 Commits

Author SHA1 Message Date
Henrik Lissner
76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00
Henrik Lissner
0eb200c49f
Refactor package! macro 2019-07-22 23:22:54 +02:00
Henrik Lissner
93f7520c79
Refactor Doom core init process (again)
- Eager-load all core autoloaded libraries if autoloads file isn't
  present.
- Renames functions to be more descriptive of their true purpose:
  - doom-initialize-autoloads -> doom-load-autoloads-file
  - doom-load-env-vars -> doom-load-envvars-file
- Use doom-module-p instead of featurep! for backend use (the latter is
  mainly syntax sugar for module use, and evaluates at compile/expansion
  time, which may cause hash-table-p errors early in the startup
  process).
- Reorder plist library to prevent load order race condition with the
  functions using the macros that haven't been defined yet.
2019-07-22 23:22:54 +02:00
Henrik Lissner
23d111132a
Update core-packages.el comments 2019-07-22 23:22:54 +02:00
Henrik Lissner
ea65f82e4d
Fix void doom-package-list error on first install 2019-07-22 03:48:29 +02:00
Henrik Lissner
82bcc2a68f
Disable straight+use-package integration
They won't be loaded together, and shouldn't be used anyway, what with
Doom's package management system.
2019-07-22 02:37:48 +02:00
Henrik Lissner
b90dede1ab
💥 Replace package.el/quelpa with straight #374
There are a few kinks to iron out, but for the most part it's done. Doom
Emacs, powered by straight. Goodbye gnutls and elpa/quelpa issues.

This update doesn't come with rollback or lockfile support yet, but I
will eventually include one with Doom, and packages will be (by default,
anyway) updated in sync with Doom.

Relevant threads: #1577 #1566 #1473
2019-07-22 02:30:40 +02:00
Henrik Lissner
51d3b1b424
💥 revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.

In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.

  doom*shut-up -> doom-shut-up-a
  doom*recenter -> doom-recenter-a
  +evil*static-reindent -> +evil--static-reindent-a

The rationale behind this change is:

1. Elisp's own formatting/indenting tools would occasionally struggle
   with | and * (particularly pp and cl-prettyprint). They have no
   problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
   github markdown) struggle with it, sometimes refusing to highlight
   code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
   intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
   on haphazardly way back when Doom was simply "my private config".

Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.

Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
  macro. The old pair weren't as useful. The new def-advice! saves on a
  lot of space.
- Removed "stage" assertions to make sure you were using the right
  macros in the right place. Turned out to not be necessary, we'll
  employ better checks later.
2019-07-22 02:27:45 +02:00
Henrik Lissner
57a5137b4b
Remove melpa mirror
It's fairly outdated (7 months) and only adds time to refresh process.
Need to find better mirrors or switch to straight soon.
2019-07-13 13:58:53 +02:00
Henrik Lissner
3b17d767b8
package!: fix the fix fix fix for the :built-in fix
fixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfix
fixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfix
fixfix   fixfixfixfixfixfixfixfixfixfixfixfi    fixfix
fixfi    fixfixfixfixfixfixfixfixfixfixfixf     fixfix
fixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfix
fixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfix
fixfix                                       fixfixfix
fixfixfix       everything is fine        fixfixfixfix
fixfixfixfixfix                     fixfixfixfixfixfix
fixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfix
fixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfixfix
2019-07-05 23:53:56 +02:00
Henrik Lissner
0dab58ef19
package!: fix the fix for :built-in fix
fixfixfix
2019-07-05 23:07:05 +02:00
Henrik Lissner
ecc4e8087c
package!: fix :built-in property 2019-07-05 22:30:24 +02:00
Henrik Lissner
1f644d07e0
package!: accept 'prefer in :built-in property
This tells Doom's package manager to prefer the built-in package, if it
is present, rather than installing the new version from elpa.
2019-07-05 20:03:37 +02:00
Henrik Lissner
d8e7a2003b
Fix custom.el writing to DOOMDIR/init.el too early
This would cause ~/.doom.d/init.el to exist before `doom quickstart` can
copy ~/.emacs.d/init.example.el into it, causing some newcomers to
experience a wrong-type-argument: hash-table-p error at startup (and no
modules being enabled).
2019-07-02 23:17:20 +02:00
Henrik Lissner
9a02bd8ac8
Minor refactors across the board
- when-let* -> when-let
- Fix projectile-locate-dominating-file for connected remote files
2019-06-26 14:31:06 +02:00
Henrik Lissner
6641e26283
Refactor package management API
Sets out to solve a number of issues with the package management
process. Namely:

- To-be-removed packages that are simply being removed are no longer
  incorrectly labeled "quelpa->elpa", but "removed" instead.
- A backend (elpa vs quelpa) column was added to the package listing
  confirmation when running `doom update`.
- Doom now correctly recognizes that packages installed with a psuedonym
  are installed, and will not endlessly attempt to uninstall and
  reinstall them on every `doom refresh`.
- Packages declared with :built-in will no longer lose their built-in
  marking if said package is not actually present in Emacs' site load
  paths. i.e. if you say it's built in, Doom won't question it.
- package!'s :ignore property is now treated as a form whose evaluated
  result will be used as its value.
2019-06-11 08:01:42 +02:00
Henrik Lissner
3ed54e191b
Fix #1322: replace load-env-vars w/ custom loader
I've replaced load-env-var with our own custom parser. load-env-var
expects a well-formatted env file, which neither env nor set produces,
which is what doom env uses to dump the shell environment.

This should fix issues that arise when envvars (like PATH) contain
arbitrary whitespace.
2019-05-17 20:19:35 -04:00
Henrik Lissner
9bc47ca329
Minor refactors
- Don't aggressively load gnu-elpa-keyring-update, it autoloads itself
- Update docstring + comments
- scroll-margin = 1
2019-05-13 19:34:44 -04:00
Henrik Lissner
5e8db5a860
Refactor core-packages + add gnu-elpa-keyring-update
- Adds melpa-mirror, for those lonely days when melpa is down
- Reduce logging spam from package!
- Revise comments & use outline-mode headings
- Prioritize melpa over elpa
2019-05-12 22:09:52 -04:00
Henrik Lissner
388e0def2c
Cheer up the byte-compiler
You deserve better than those warnings.
2019-05-02 21:54:47 -04:00
Henrik Lissner
c399c07694
Add :tools lsp checks for +lsp flag
Also:
- Reorganizes some :lang modules' packages.el file.
- Adds setuptools check in lang/python
- Adds javac check in lang/java
- Removes the depends-on! macro
2019-04-24 18:16:05 -04:00
Henrik Lissner
ff42cf0767
Rewrite require! and change depends-on!
depends-on! was changed to no longer load a specified module's
packages.el, but to preform a module-enabled assertion. It emits an
error if the linked module isn't (or specified flags aren't) enabled.
2019-04-21 19:40:02 -04:00
Henrik Lissner
eb1296387f
Make load-env-vars a core package
Fixes a race condition where the load-env-vars package is used before it
was (or could be) installed.
2019-03-28 13:30:39 -04:00
Henrik Lissner
a443d9ab07
Refactor doom-initialize-packages & package API
- Packages are initialized once, when package.el is first loaded, and
  must be updated manually via doom/reload-packages.
- Package->module association is now stored in the package's PLIST under
  :modules. This is an internal property and cannot be explicitly set
  through `package!'
- Add doom-package-list function
- Rename doom-get-packages to doom-find-packages
- Updated doom-find-packages' docstring
- Added the :core filter to doom-find-packages
- Simplified doom-initialize-packages
- doom/reload calls doom/reload-packages if necessary.
- Fix redundant properties in doom-packages
- Remove tracking of after!, def-package! and def-package-hook! blocks.
  Replaced with doom-package-list being able to see all packages, even
  in disabled modules.
- Add :built-in property to package! for dummy packages. This is
  important so that doom/describe-package can see built-in packages.
2019-03-08 04:25:44 -05:00
Henrik Lissner
b054190820
New doom/describe-packages command
Replaces describe-packages and adds Doom module awareness to package
documentation.
2019-03-04 20:47:25 -05:00
Henrik Lissner
3923760c7c
Adjust compile-time state in package helper macros 2019-01-02 14:11:02 -05:00
Henrik Lissner
9628a74718
Fix disable-packages! macro
Now rolls out package! calls, rather than adjusting state directly.
2019-01-02 13:17:26 -05:00
Henrik Lissner
15991b5639 Refactor quiet! to be less destructive
It's possible for the debugger to be invoked from inside code wrapped in
a (quiet! ...) call. The debugger pauses Emacs in a broken state where
the functions locally rebound by quiet! (e.g. message, load-file,
write-region, etc) are never returned to their original definitions.

This attempts to reduce that probabilityby changing how quiet! silences
code. Rather than silencing them completely, they will be logged
to *Messages* but not displayed in the echo area.

Also, quiet! is now used less, where it isn't strictly needed (or where
inhibit-message is sufficient).
2018-09-28 21:13:27 -04:00
Henrik Lissner
377dbae3fc
Install/compile packages in order of declaration
This should fix an issue where a package A, which uses macros from a
package B, is installed before package B, causing void-function errors.

The currently known and affected packages are neotree, parinfer, and
evil-collection.
2018-09-25 11:00:30 -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
80ddf2122b
Fix doom-initialize-packages messing up load-path
This fixes issues with the doctor not being able to find certain
packages (like evil-collection), and an issue where using the package
management API (which calls doom-initialize-packages) breaks the current
session by breaking the load-path.
2018-06-26 18:58:06 +02:00
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