[dump] Add functions to save and restore load-path
This commit is contained in:
parent
32f6f07f95
commit
b7266b38b5
|
@ -18,11 +18,24 @@
|
|||
(defvar spacemacs-dump-delayed-functions '()
|
||||
"List of function to execute once the dump file has been loaded.")
|
||||
|
||||
(defvar spacemacs-dump-load-path nil
|
||||
"Variable to backup the `load-path' variable built during the dump creation.")
|
||||
|
||||
(defconst spacemacs-dump-directory
|
||||
(concat spacemacs-cache-directory "dumps/"))
|
||||
|
||||
(defconst spacemacs-dump-buffer-name "*spacemacs-dumper*")
|
||||
|
||||
(defun spacemacs/dump-save-load-path ()
|
||||
"Save `load-path' variable."
|
||||
(setq spacemacs-dump-load-path load-path))
|
||||
|
||||
(defun spacemacs/dump-restore-load-path ()
|
||||
"Restore the `load-path' variable from the dump. "
|
||||
(spacemacs|unless-dumping
|
||||
(when (not (null spacemacs-dump-load-path))
|
||||
(setq load-path spacemacs-dump-load-path))))
|
||||
|
||||
(defun spacemacs/defer (&optional idle-time)
|
||||
"Return t or IDLE-TIME when Spacemacs is not running from a dump."
|
||||
(when (eq 'not-dumped spacemacs-dump-mode)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(setq spacemacs-dump-mode 'dumping)
|
||||
;; load init.el
|
||||
(load (concat (file-name-directory load-file-name) "init.el"))
|
||||
;; we need to backup the load-path in order to restore them
|
||||
;; when we use the dump file
|
||||
(setq load-path-backup load-path)
|
||||
;; prepare the dump
|
||||
(spacemacs/dump-save-load-path)
|
||||
;; disable undo-tree to prevent from segfaulting when loading the dump
|
||||
(when (fboundp 'global-undo-tree-mode)
|
||||
(global-undo-tree-mode -1))
|
||||
|
|
5
init.el
5
init.el
|
@ -32,10 +32,7 @@
|
|||
;; Disable file-name-handlers for a speed boost during init
|
||||
(let ((file-name-handler-alist nil))
|
||||
(require 'core-spacemacs)
|
||||
(spacemacs|unless-dumping
|
||||
;; Retoring load-path from dump file
|
||||
(when (boundp 'load-path-backup)
|
||||
(setq load-path load-path-backup)))
|
||||
(spacemacs/dump-restore-load-path)
|
||||
(configuration-layer/load-lock-file)
|
||||
(spacemacs/init)
|
||||
(configuration-layer/stable-elpa-download-tarball)
|
||||
|
|
Loading…
Reference in New Issue