mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-06 15:13:33 -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:
@@ -1,6 +1,21 @@
|
||||
;; feature/evil/autoload/evil.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :feature evil)
|
||||
|
||||
;;;###autoload
|
||||
(def-setting! :evil-state (modes state)
|
||||
"Set the initialize STATE of MODE using `evil-set-initial-state'."
|
||||
(let ((unquoted-modes (doom-unquote modes)))
|
||||
(if (listp unquoted-modes)
|
||||
`(progn
|
||||
,@(cl-loop for mode in unquoted-modes
|
||||
collect `(evil-set-initial-state ',mode ,state)))
|
||||
`(evil-set-initial-state ,modes ,state))))
|
||||
|
||||
|
||||
;;
|
||||
;; Commands
|
||||
;;
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/visual-indent ()
|
||||
"vnoremap < <gv"
|
||||
@@ -80,6 +95,11 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
||||
;;;###autoload
|
||||
(defun +evil/window-move-down () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'down))
|
||||
|
||||
|
||||
;;
|
||||
;; Evil commands/operators
|
||||
;;
|
||||
|
||||
;;;###autoload (autoload '+evil:apply-macro "feature/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:apply-macro (beg end)
|
||||
"Apply macro to each line."
|
||||
|
@@ -3,27 +3,10 @@
|
||||
;; I'm a vimmer at heart. Its modal philosophy suits me better, and this module
|
||||
;; strives to make Emacs a much better vim than vim was.
|
||||
|
||||
(def-setting! :evil-state (modes state)
|
||||
"Set the initialize STATE of MODE using `evil-set-initial-state'."
|
||||
(let ((unquoted-modes (doom-unquote modes)))
|
||||
(if (listp unquoted-modes)
|
||||
`(progn
|
||||
,@(cl-loop for mode in unquoted-modes
|
||||
collect `(evil-set-initial-state ',mode ,state)))
|
||||
`(evil-set-initial-state ,modes ,state))))
|
||||
|
||||
|
||||
;;
|
||||
;; evil-mode
|
||||
;;
|
||||
|
||||
(autoload 'goto-last-change "goto-chg")
|
||||
(autoload 'goto-last-change-reverse "goto-chg")
|
||||
|
||||
|
||||
(def-package! evil-collection
|
||||
:when (featurep! +everywhere)
|
||||
:defer pre-command-hook
|
||||
:defer 1
|
||||
:after-call post-command-hook
|
||||
:preface
|
||||
;; must be set before evil/evil-collcetion is loaded
|
||||
(setq evil-want-integration nil
|
||||
@@ -235,7 +218,7 @@
|
||||
evil-escape-excluded-major-modes '(neotree-mode)
|
||||
evil-escape-key-sequence "jk"
|
||||
evil-escape-delay 0.25)
|
||||
(add-hook 'pre-command-hook 'evil-escape-pre-command-hook)
|
||||
(add-hook 'pre-command-hook #'evil-escape-pre-command-hook)
|
||||
(map! :irvo "C-g" #'evil-escape)
|
||||
:config
|
||||
;; no `evil-escape' in minibuffer
|
||||
@@ -325,7 +308,7 @@ the new algorithm is confusing, like in python or ruby."
|
||||
(def-package! evil-snipe
|
||||
:commands (evil-snipe-mode evil-snipe-override-mode
|
||||
evil-snipe-local-mode evil-snipe-override-local-mode)
|
||||
:defer pre-command-hook
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
(setq evil-snipe-smart-case t
|
||||
evil-snipe-scope 'line
|
||||
@@ -385,19 +368,6 @@ the new algorithm is confusing, like in python or ruby."
|
||||
(push ">" evil-args-closers)))
|
||||
|
||||
|
||||
(def-package! evil-indent-plus
|
||||
:commands (evil-indent-plus-i-indent
|
||||
evil-indent-plus-a-indent
|
||||
evil-indent-plus-i-indent-up
|
||||
evil-indent-plus-a-indent-up
|
||||
evil-indent-plus-i-indent-up-down
|
||||
evil-indent-plus-a-indent-up-down))
|
||||
|
||||
|
||||
(def-package! evil-textobj-anyblock
|
||||
:commands (evil-textobj-anyblock-inner-block evil-textobj-anyblock-a-block))
|
||||
|
||||
|
||||
;;
|
||||
;; Multiple cursors compatibility (for the plugins that use it)
|
||||
;;
|
||||
|
Reference in New Issue
Block a user