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
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
93 changed files with 644 additions and 846 deletions

View file

@ -4,10 +4,7 @@
;; Plugins
;;
(def-package! go-mode
:mode "\\.go$"
:interpreter "go"
:config
(after! go-mode
(set! :env "GOPATH" "GOROOT")
(set! :repl 'go-mode #'gorepl-run)
(set! :lookup 'go-mode
@ -15,11 +12,12 @@
:references #'go-guru-referrers
:documentation #'godoc-at-point)
(when (executable-find "goimports")
(setq gofmt-command "goimports"))
(when-let* ((goimports (executable-find "goimports")))
(setq gofmt-command goimports))
(setq gofmt-show-errors nil) ; Leave it to flycheck
(add-hook 'go-mode-hook #'flycheck-mode)
(add-hook! 'go-mode-hook #'(flycheck-mode go-eldoc-setup))
(add-hook! go-mode
(add-hook 'before-save-hook #'gofmt-before-save nil t))
@ -70,25 +68,13 @@
:v "r" #'go-play-region))
(def-package! go-eldoc
:hook (go-mode . go-eldoc-setup))
(def-package! go-guru
:commands (go-guru-describe go-guru-freevars go-guru-implements go-guru-peers
go-guru-referrers go-guru-definition go-guru-pointsto
go-guru-callstack go-guru-whicherrs go-guru-callers go-guru-callees
go-guru-expand-region))
(def-package! gorepl-mode
:commands (gorepl-run gorepl-run-load-current-file))
:commands gorepl-run-load-current-file)
(def-package! company-go
:when (featurep! :completion company)
:init (setq command-go-gocode-command "gocode")
:after go-mode
:config
(setq company-go-show-annotation t)
(set! :company-backend 'go-mode '(company-go)))
(set! :company-backend 'go-mode 'company-go)
(setq company-go-show-annotation t))