mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
feat(lib): profiles: more portable load-path/Info-directory-list
The Emacs appimage generates a new mountpoint on each invokation, but Doom's profiles assume that the Emacs directories don't move. To make Doom's profiles a little more profile, it will no longer set `load-path` and simply add the new paths to the existing one. Same for Info-directory-list. Consequently, this also seems to speed up startup times for ~8% in my tests. Neat.
This commit is contained in:
@@ -317,9 +317,22 @@ caches them in `doom--profiles'. If RELOAD? is non-nil, refresh the cache."
|
|||||||
|
|
||||||
(defun doom-profile--generate-vars ()
|
(defun doom-profile--generate-vars ()
|
||||||
`((defun doom--startup-vars ()
|
`((defun doom--startup-vars ()
|
||||||
,@(cl-loop for var in doom-autoloads-cached-vars
|
(when (doom-context-p 'reload)
|
||||||
if (boundp var)
|
(set-default-toplevel-value 'load-path (get 'load-path 'initial-value)))
|
||||||
collect `(set-default ',var ',(symbol-value var)))
|
,@(cl-loop for var in '(auto-mode-alist
|
||||||
|
interpreter-mode-alist
|
||||||
|
magic-mode-alist
|
||||||
|
magic-fallback-mode-alist)
|
||||||
|
collect `(set-default-toplevel-value ',var ',(symbol-value var)))
|
||||||
|
,@(cl-loop with site-run-dir =
|
||||||
|
(ignore-errors
|
||||||
|
(directory-file-name (file-name-directory
|
||||||
|
(locate-library site-run-file))))
|
||||||
|
for path in load-path
|
||||||
|
unless (and site-run-dir (file-in-directory-p path site-run-dir))
|
||||||
|
unless (file-in-directory-p path data-directory)
|
||||||
|
unless (file-equal-p path doom-core-dir)
|
||||||
|
collect `(add-to-list 'load-path ,path))
|
||||||
,@(cl-loop with v = (version-to-list doom-version)
|
,@(cl-loop with v = (version-to-list doom-version)
|
||||||
with ref = (doom-call-process "git" "-C" (doom-path doom-emacs-dir) "rev-parse" "HEAD")
|
with ref = (doom-call-process "git" "-C" (doom-path doom-emacs-dir) "rev-parse" "HEAD")
|
||||||
with branch = (doom-call-process "git" "-C" (doom-path doom-emacs-dir) "branch" "--show-current")
|
with branch = (doom-call-process "git" "-C" (doom-path doom-emacs-dir) "branch" "--show-current")
|
||||||
@@ -431,15 +444,13 @@ caches them in `doom--profiles'. If RELOAD? is non-nil, refresh the cache."
|
|||||||
doom-autoloads-excluded-files
|
doom-autoloads-excluded-files
|
||||||
'literal))
|
'literal))
|
||||||
,@(when-let* ((info-dirs
|
,@(when-let* ((info-dirs
|
||||||
(cl-loop for key in (hash-table-keys straight--build-cache)
|
(cl-loop for dir in load-path
|
||||||
for dir = (straight--build-dir key)
|
if (file-exists-p (doom-path dir "dir"))
|
||||||
for file = (straight--build-file dir "dir")
|
|
||||||
if (file-exists-p file)
|
|
||||||
collect dir)))
|
collect dir)))
|
||||||
`((require 'info)
|
`((with-eval-after-load 'info
|
||||||
(info-initialize)
|
(info-initialize)
|
||||||
(setq Info-directory-list
|
(dolist (path ',(delete-dups info-dirs))
|
||||||
(append ',info-dirs Info-directory-list)))))))
|
(add-to-list 'Info-directory-list path))))))))
|
||||||
|
|
||||||
(provide 'doom-lib '(profiles))
|
(provide 'doom-lib '(profiles))
|
||||||
;;; profiles.el ends here
|
;;; profiles.el ends here
|
||||||
|
Reference in New Issue
Block a user