diff --git a/lisp/doom.el b/lisp/doom.el index 41f39c7c2..ab1096b26 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -331,19 +331,20 @@ users).") ;; `file-remote-p'). You get a noteable boost to startup time by unsetting ;; or simplifying its value. (let ((old-value (default-toplevel-value 'file-name-handler-alist))) - (setq file-name-handler-alist - ;; HACK: If the bundled elisp for this Emacs install isn't - ;; byte-compiled (but is compressed), then leave the gzip file - ;; handler there so Emacs won't forget how to read read them. - ;; - ;; calc-loaddefs.el is our heuristic for this because it is built-in - ;; to all supported versions of Emacs, and calc.el explicitly loads - ;; it uncompiled. This ensures that the only other, possible - ;; fallback would be calc-loaddefs.el.gz. - (if (eval-when-compile - (locate-file-internal "calc-loaddefs.el" load-path)) - nil - (list (rassq 'jka-compr-handler old-value)))) + (set-default-toplevel-value + 'file-name-handler-alist + ;; HACK: If the bundled elisp for this Emacs install isn't byte-compiled + ;; (but is compressed), then leave the gzip file handler there so Emacs + ;; won't forget how to read read them. + ;; + ;; calc-loaddefs.el is our heuristic for this because it is built-in to + ;; all supported versions of Emacs, and calc.el explicitly loads it + ;; uncompiled. This ensures that the only other, possible fallback would + ;; be calc-loaddefs.el.gz. + (if (eval-when-compile + (locate-file-internal "calc-loaddefs.el" load-path)) + nil + (list (rassq 'jka-compr-handler old-value)))) ;; Make sure the new value survives any current let-binding. (set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist) ;; Remember it so it can be reset where needed. @@ -352,10 +353,11 @@ users).") ;; needed for handling encrypted or compressed files, among other things. (add-hook! 'emacs-startup-hook :depth 101 (defun doom--reset-file-handler-alist-h () - (setq file-name-handler-alist - ;; Merge instead of overwrite because there may have been changes to - ;; `file-name-handler-alist' since startup we want to preserve. - (delete-dups (append file-name-handler-alist old-value)))))) + (set-default-toplevel-value + 'file-name-handler-alist + ;; Merge instead of overwrite because there may have been changes to + ;; `file-name-handler-alist' since startup we want to preserve. + (delete-dups (append file-name-handler-alist old-value)))))) (unless noninteractive ;; PERF: Resizing the Emacs frame (to accommodate fonts that are smaller or