mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -24,8 +24,7 @@ MODES should be one major-mode symbol or a list of them."
|
||||
;;
|
||||
|
||||
(def-package! company
|
||||
:commands (company-mode global-company-mode company-complete
|
||||
company-complete-common company-manual-begin company-grab-line)
|
||||
:commands (company-complete-common company-manual-begin company-grab-line)
|
||||
:init
|
||||
(setq company-idle-delay nil
|
||||
company-tooltip-limit 14
|
||||
@ -48,7 +47,8 @@ MODES should be one major-mode symbol or a list of them."
|
||||
|
||||
(def-package! company
|
||||
:when (featurep! +auto)
|
||||
:defer pre-command-hook
|
||||
:defer 2
|
||||
:after-call pre-command-hook
|
||||
:config (setq company-idle-delay 0.2))
|
||||
|
||||
|
||||
@ -73,27 +73,12 @@ MODES should be one major-mode symbol or a list of them."
|
||||
|
||||
|
||||
(def-package! company-dict
|
||||
:commands company-dict
|
||||
:defer t
|
||||
:config
|
||||
(defun +company|enable-project-dicts (mode &rest _)
|
||||
"Enable per-project dictionaries."
|
||||
(if (symbol-value mode)
|
||||
(cl-pushnew mode company-dict-minor-mode-list :test #'eq)
|
||||
(add-to-list 'company-dict-minor-mode-list mode #'eq)
|
||||
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))
|
||||
(add-hook 'doom-project-hook #'+company|enable-project-dicts))
|
||||
|
||||
|
||||
;;
|
||||
;; Included with company.el
|
||||
;;
|
||||
|
||||
(autoload 'company-capf "company-capf")
|
||||
(autoload 'company-dabbrev "company-dabbrev")
|
||||
(autoload 'company-dabbrev-code "company-dabbrev-code")
|
||||
(autoload 'company-elisp "company-elisp")
|
||||
(autoload 'company-etags "company-etags")
|
||||
(autoload 'company-files "company-files")
|
||||
(autoload 'company-gtags "company-gtags")
|
||||
(autoload 'company-ispell "company-ispell")
|
||||
(autoload 'company-yasnippet "company-yasnippet")
|
||||
|
||||
|
Reference in New Issue
Block a user