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:
parent
6a140209b8
commit
09cb4f6716
93 changed files with 644 additions and 846 deletions
40
modules/feature/lookup/autoload/docsets.el
Normal file
40
modules/feature/lookup/autoload/docsets.el
Normal file
|
@ -0,0 +1,40 @@
|
|||
;;; feature/lookup/autoload/docsets.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! +docsets)
|
||||
|
||||
;;;###autoload
|
||||
(def-setting! :docset (modes &rest docsets)
|
||||
"Registers a list of DOCSETS (strings) for MODES (either one major mode
|
||||
symbol or a list of them).
|
||||
|
||||
If MODES is a minor mode, you can use :add or :remove as the first element of
|
||||
DOCSETS, to instruct it to append (or remove) those from the docsets already set
|
||||
by a major-mode, if any.
|
||||
|
||||
Used by `+lookup/in-docsets' and `+lookup/documentation'."
|
||||
(let* ((modes (doom-unquote modes))
|
||||
(ivy-p (featurep! :completion ivy))
|
||||
(hook-sym (intern (format "+lookup|%s-docsets--%s"
|
||||
(cond ((eq ',(car docsets) :add) 'add)
|
||||
((eq ',(car docsets) :remove) 'remove)
|
||||
('set))
|
||||
(string-join docsets "-"))))
|
||||
(var-sym (if ivy-p 'counsel-dash-docsets 'helm-dash-docsets)))
|
||||
`(progn
|
||||
(defun ,hook-sym ()
|
||||
(make-variable-buffer-local ',var-sym)
|
||||
,(cond ((eq ',(car docsets) :add)
|
||||
`(setq ,var-sym (append ,var-sym (list ,@(cdr docsets)))))
|
||||
((eq ',(car docsets) :remove)
|
||||
`(setq ,var-sym
|
||||
(cl-loop with to-delete = (list ,@(cdr docsets))
|
||||
for docset in ,var-sym
|
||||
unless (member docset to-delete)
|
||||
collect docset)))
|
||||
(`(setq ,var-sym (list ,@docsets)))))
|
||||
(add-hook! ,modes #',hook-sym))))
|
||||
|
||||
;;;###autoload
|
||||
(autoload 'helm-dash-installed-docsets "helm-dash")
|
||||
|
||||
;;;###autoload
|
||||
(autoload 'helm-dash-docset-installed-p "helm-dash")
|
Loading…
Add table
Add a link
Reference in a new issue