Major refactor & optimization of how modules load their packages

Now that we are loading package autoloads files (as part of the
generated doom-package-autoload-file when running make autoloads), many
:commands properties are redundant. In fact, many def-package! blocks
are redundant.

In some cases, we can do without a config.el file entirely, and can move
into the autoloads file or rely entirely on package autoloads.

Also, many settings have been moved in their module's autoloads files,
which makes them available ASAP; their use no longer depends on module
load order.

This gained me a modest ~10% boost in startup speed.
This commit is contained in:
Henrik Lissner
2018-05-25 00:46:11 +02:00
parent 6a140209b8
commit 09cb4f6716
93 changed files with 644 additions and 846 deletions

View File

@ -1,21 +1,18 @@
;;; lang/elixir/config.el -*- lexical-binding: t; -*-
(def-package! elixir-mode
:mode "\\.exs?\\'"
:mode "\\.elixir2\\'"
:init
;; sp's default elixir rules are obnoxious, so disable them
(provide 'smartparens-elixir)
:defer t
:config
;; ...and only complete the basics
(sp-with-modes 'elixir-mode
(sp-local-pair "do" "end"
:when '(("RET" "<evil-ret>"))
:unless '(sp-in-comment-p sp-in-string-p)
:skip-match 'sp-elixir-skip-def-p
:post-handlers '("||\n[i]"))
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))))
(after! smartparens
(sp-with-modes 'elixir-mode
(sp-local-pair "do" "end"
:when '(("RET" "<evil-ret>"))
:unless '(sp-in-comment-p sp-in-string-p)
:skip-match 'sp-elixir-skip-def-p
:post-handlers '("||\n[i]"))
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p)))))
(def-package! alchemist
@ -30,13 +27,13 @@
(def-package! alchemist-company
:when (featurep! :completion company)
:after elixir-mode
:commands alchemist-company
:init
(set! :company-backend 'elixir-mode '(alchemist-company company-yasnippet))
:config
;; Alchemist doesn't use hook symbols to add these backends, so we have to use
;; the entire closure to get rid of it.
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
(remove-hook 'alchemist-mode-hook fn)
(remove-hook 'alchemist-iex-mode-hook fn))
(set! :company-backend 'elixir-mode '(alchemist-company company-yasnippet)))
(remove-hook 'alchemist-iex-mode-hook fn)))