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
|
@ -1,5 +1,73 @@
|
|||
;;; ui/popup/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defvar +popup--display-buffer-alist nil)
|
||||
|
||||
;;;###autoload
|
||||
(def-setting! :popup (condition &optional alist parameters)
|
||||
"Register a popup rule.
|
||||
|
||||
CONDITION can be a regexp string or a function. See `display-buffer' for a list
|
||||
of possible entries for ALIST, which tells the display system how to initialize
|
||||
the popup window. PARAMETERS is an alist of window parameters. See
|
||||
`+popup-window-parameters' for a list of custom parameters provided by the popup
|
||||
module.
|
||||
|
||||
ALIST supports one custom parameter: `size', which will resolve to
|
||||
`window-height' or `window-width' depending on `side'."
|
||||
`(progn
|
||||
(+popup-define ,condition ,alist ,parameters)
|
||||
(when (bound-and-true-p +popup-mode)
|
||||
(setq display-buffer-alist +popup--display-buffer-alist))
|
||||
+popup--display-buffer-alist))
|
||||
|
||||
;;;###autoload
|
||||
(def-setting! :popups (&rest rules)
|
||||
"Register multiple popup rules with :popup setting (`doom--set:popup'). For
|
||||
example:
|
||||
|
||||
(set! :popups
|
||||
(\"^ \\*\" '((slot . 1) (vslot . -1) (size . +popup-shrink-to-fit)))
|
||||
(\"^\\*\" '((slot . 1) (vslot . -1)) '((select . t))))"
|
||||
`(progn
|
||||
,@(cl-loop for rule in rules collect `(+popup-define ,@rule))
|
||||
(when (bound-and-true-p +popup-mode)
|
||||
(setq display-buffer-alist +popup--display-buffer-alist))
|
||||
+popup--display-buffer-alist))
|
||||
|
||||
;;;###autoload
|
||||
(defsubst +popup-define (condition &optional alist parameters)
|
||||
"Define a popup rule.
|
||||
|
||||
The buffers of new windows displayed by `pop-to-buffer' and `display-buffer'
|
||||
will be tested against CONDITION, which is either a) a regexp string (which is
|
||||
matched against the buffer's name) or b) a function that takes no arguments and
|
||||
returns a boolean.
|
||||
|
||||
If CONDITION is met, the buffer will be displayed in a popup window with ALIST
|
||||
and window PARAMETERS. See `display-buffer-alist' for details on what ALIST may
|
||||
contain and `+popup-window-parameters' for what window parameters that the popup
|
||||
module supports.
|
||||
|
||||
ALIST also supports the `size' parameter, which will be translated to
|
||||
`window-width' or `window-height' depending on `side'.
|
||||
|
||||
If certain attributes/parameters are omitted, the ones from
|
||||
`+popup-default-alist' and `+popup-default-parameters' will be used."
|
||||
(declare (indent 1))
|
||||
(push (if (eq alist :ignore)
|
||||
(list condition nil)
|
||||
`(,condition
|
||||
(+popup-buffer)
|
||||
,@alist
|
||||
(window-parameters ,@parameters)))
|
||||
+popup--display-buffer-alist))
|
||||
|
||||
|
||||
;;
|
||||
;; Library
|
||||
;;
|
||||
|
||||
(defvar +popup--populate-wparams (not EMACS26+))
|
||||
(defvar +popup--inhibit-transient nil)
|
||||
(defvar +popup--inhibit-select nil)
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
;;; ui/popup/init.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +popup--display-buffer-alist nil)
|
||||
|
||||
(defun +popup-define (condition &optional alist parameters)
|
||||
"Define a popup rule.
|
||||
|
||||
The buffers of new windows displayed by `pop-to-buffer' and `display-buffer'
|
||||
will be tested against CONDITION, which is either a) a regexp string (which is
|
||||
matched against the buffer's name) or b) a function that takes no arguments and
|
||||
returns a boolean.
|
||||
|
||||
If CONDITION is met, the buffer will be displayed in a popup window with ALIST
|
||||
and window PARAMETERS. See `display-buffer-alist' for details on what ALIST may
|
||||
contain and `+popup-window-parameters' for what window parameters that the popup
|
||||
module supports.
|
||||
|
||||
ALIST also supports the `size' parameter, which will be translated to
|
||||
`window-width' or `window-height' depending on `side'.
|
||||
|
||||
If certain attributes/parameters are omitted, the ones from
|
||||
`+popup-default-alist' and `+popup-default-parameters' will be used."
|
||||
(declare (indent 1))
|
||||
(push (if (eq alist :ignore)
|
||||
(list condition nil)
|
||||
`(,condition
|
||||
(+popup-buffer)
|
||||
,@alist
|
||||
(window-parameters ,@parameters)))
|
||||
+popup--display-buffer-alist))
|
||||
|
||||
;;
|
||||
(def-setting! :popup (condition &optional alist parameters)
|
||||
"Register a popup rule.
|
||||
|
||||
CONDITION can be a regexp string or a function. See `display-buffer' for a list
|
||||
of possible entries for ALIST, which tells the display system how to initialize
|
||||
the popup window. PARAMETERS is an alist of window parameters. See
|
||||
`+popup-window-parameters' for a list of custom parameters provided by the popup
|
||||
module.
|
||||
|
||||
ALIST supports one custom parameter: `size', which will resolve to
|
||||
`window-height' or `window-width' depending on `side'."
|
||||
`(progn
|
||||
(+popup-define ,condition ,alist ,parameters)
|
||||
(when (bound-and-true-p +popup-mode)
|
||||
(setq display-buffer-alist +popup--display-buffer-alist))
|
||||
+popup--display-buffer-alist))
|
||||
|
||||
(def-setting! :popups (&rest rules)
|
||||
"Register multiple popup rules with :popup setting (`doom--set:popup'). For
|
||||
example:
|
||||
|
||||
(set! :popups
|
||||
(\"^ \\*\" '((slot . 1) (vslot . -1) (size . +popup-shrink-to-fit)))
|
||||
(\"^\\*\" '((slot . 1) (vslot . -1)) '((select . t))))"
|
||||
`(progn
|
||||
,@(cl-loop for rule in rules collect `(+popup-define ,@rule))
|
||||
(when (bound-and-true-p +popup-mode)
|
||||
(setq display-buffer-alist +popup--display-buffer-alist))
|
||||
+popup--display-buffer-alist))
|
Loading…
Add table
Add a link
Reference in a new issue