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
|
@ -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")
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
;;
|
||||
|
||||
(def-package! helm-mode
|
||||
:defer (pre-command-hook . 1)
|
||||
:defer 1
|
||||
:after-call pre-command-hook
|
||||
:config
|
||||
(helm-mode +1)
|
||||
;; helm is too heavy for find-file-at-point
|
||||
|
|
|
@ -116,9 +116,9 @@ If ARG (universal argument), open selection in other-window."
|
|||
"\\):?\\s-*\\(.+\\)")
|
||||
x)
|
||||
(error
|
||||
(message! (red "Error matching task in file: (%s) %s"
|
||||
(error-message-string ex)
|
||||
(car (split-string x ":"))))
|
||||
(print! (red "Error matching task in file: (%s) %s"
|
||||
(error-message-string ex)
|
||||
(car (split-string x ":"))))
|
||||
nil))
|
||||
collect `((type . ,(match-string 3 x))
|
||||
(desc . ,(match-string 4 x))
|
||||
|
|
|
@ -24,7 +24,8 @@ immediately runs it on the current candidate (ending the ivy session)."
|
|||
;;
|
||||
|
||||
(def-package! ivy
|
||||
:defer (pre-command-hook . 1)
|
||||
:defer 1
|
||||
:after-call pre-command-hook
|
||||
:config
|
||||
(setq ivy-height 12
|
||||
ivy-do-completion-in-region nil
|
||||
|
@ -184,7 +185,7 @@ immediately runs it on the current candidate (ending the ivy session)."
|
|||
|
||||
|
||||
(def-package! wgrep
|
||||
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
||||
:commands wgrep-change-to-wgrep-mode
|
||||
:config (setq wgrep-auto-save-buffer t))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue