Refactor early-init.el
This commit is contained in:
parent
bb67d3f346
commit
bddb2b2a2d
1 changed files with 17 additions and 16 deletions
|
@ -19,22 +19,23 @@
|
||||||
(setq package-enable-at-startup nil)
|
(setq package-enable-at-startup nil)
|
||||||
(fset #'package--ensure-init-file #'ignore) ; DEPRECATED Removed in 28
|
(fset #'package--ensure-init-file #'ignore) ; DEPRECATED Removed in 28
|
||||||
|
|
||||||
;; `file-name-handler-alist' is consulted on every `require', `load' and various
|
(unless (or (daemonp) noninteractive)
|
||||||
;; path/io functions. You get a minor speed up by nooping this. However, this
|
(let ((old-file-name-handler-alist file-name-handler-alist))
|
||||||
;; may cause problems on builds of Emacs where its site lisp files aren't
|
;; `file-name-handler-alist' is consulted on each `require', `load' and
|
||||||
;; byte-compiled and we're forced to load the *.el.gz files (e.g. on Alpine)
|
;; various path/io functions. You get a minor speed up by unsetting this.
|
||||||
(unless (daemonp)
|
;; Some warning, however: this could cause problems on builds of Emacs where
|
||||||
(defvar doom--initial-file-name-handler-alist file-name-handler-alist)
|
;; its site lisp files aren't byte-compiled and we're forced to load the
|
||||||
(setq file-name-handler-alist nil)
|
;; *.el.gz files (e.g. on Alpine).
|
||||||
;; Restore `file-name-handler-alist' later, because it is needed for handling
|
(setq-default file-name-handler-alist nil)
|
||||||
;; encrypted or compressed files, among other things.
|
;; ...but restore `file-name-handler-alist' later, because it is needed for
|
||||||
(defun doom-reset-file-handler-alist-h ()
|
;; handling encrypted or compressed files, among other things.
|
||||||
;; Re-add rather than `setq', because changes to `file-name-handler-alist'
|
(defun doom-reset-file-handler-alist-h ()
|
||||||
;; since startup ought to be preserved.
|
(setq file-name-handler-alist
|
||||||
(dolist (handler file-name-handler-alist)
|
;; Merge instead of overwrite because there may have bene changes to
|
||||||
(add-to-list 'doom--initial-file-name-handler-alist handler))
|
;; `file-name-handler-alist' since startup we want to preserve.
|
||||||
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
|
(delete-dups (append file-name-handler-alist
|
||||||
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
|
old-file-name-handler-alist))))
|
||||||
|
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h)))
|
||||||
|
|
||||||
;; Ensure Doom is running out of this file's directory
|
;; Ensure Doom is running out of this file's directory
|
||||||
(setq user-emacs-directory (file-name-directory load-file-name))
|
(setq user-emacs-directory (file-name-directory load-file-name))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue