mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-03-07 14:21:47 -08:00
refactor(lib): advise setopt
The `setq!` macro was created to solve my issue with `setopt` (that it can eagerly load packages; imposing more side-effects than necessary). Instead of having a separate, wrapper macro to fix the matter, I now advise `setopt` directly to fix the problem, so that users don't have another macro to keep track of. `setq!` will eventually be deprecated, then removed in v3.
This commit is contained in:
parent
3ad1ef4f96
commit
fad44ca228
1 changed files with 11 additions and 1 deletions
12
lisp/doom.el
12
lisp/doom.el
|
|
@ -542,7 +542,17 @@ uses a straight or package.el command directly).")
|
|||
(unless doom--system-macos-p
|
||||
(setq command-line-ns-option-alist nil))
|
||||
(unless (memq initial-window-system '(x pgtk))
|
||||
(setq command-line-x-option-alist nil))))
|
||||
(setq command-line-x-option-alist nil))
|
||||
|
||||
;; PERF: `setopt' can eagerly load symbol dependencies to preform immediate
|
||||
;; type checking, which can cause unexpected load order issues and impact
|
||||
;; startup time drastically. Type checks are already performed when the
|
||||
;; variable is defined, anyway, so this advice prevents early loading, but
|
||||
;; no-ops if debug mode is on (where immediate feedback > performance).
|
||||
(define-advice setopt--set (:around (fn &rest args) inhibit-load-symbol -90)
|
||||
(let ((custom-load-symbol
|
||||
(if (or init-file-debug debug-on-error) custom-load-symbol t)))
|
||||
(apply fn args)))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue