[dump] Move some code to dump-init.el

This commit is contained in:
syl20bnr 2019-07-26 22:44:11 -04:00
parent 009777f6cf
commit 0c39f63c66
3 changed files with 14 additions and 9 deletions

View File

@ -586,8 +586,7 @@ refreshed during the current session."
(configuration-layer//dump-emacs)))
((spacemacs-is-dumping-p)
;; dumping
(configuration-layer//load)
(configuration-layer/message "Dumping Emacs..."))
(configuration-layer//load))
((and (spacemacs/emacs-with-pdumper-set-p)
(spacemacs-run-from-dump-p))
;; dumped

View File

@ -1,2 +1,12 @@
(setq spacemacs-dump-mode 'dumping)
(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)
;; disable undo-tree to prevent from segfaulting when loading the dump
(when (fboundp 'global-undo-tree-mode)
(global-undo-tree-mode -1))
;; (spacemacs/startup-hook)
(configuration-layer/message "Dumping Emacs...")
(setq spacemacs-dump-mode 'dumped)
(garbage-collect)

10
init.el
View File

@ -33,6 +33,7 @@
(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)))
(configuration-layer/load-lock-file)
@ -42,6 +43,7 @@
(spacemacs-buffer/display-startup-note)
(spacemacs/setup-startup-hook)
(spacemacs|unless-dumping
;; these modes need to be re-enabled explicitly
(global-font-lock-mode)
(global-undo-tree-mode t)
(winner-mode t))
@ -51,10 +53,4 @@
(setq server-socket-dir dotspacemacs-server-socket-dir))
(unless (server-running-p)
(message "Starting a server...")
(server-start)))
(spacemacs|when-dumping-strict
(setq load-path-backup load-path)
;; disable undo-tree to prevent from segfaulting when loading the dump
(global-undo-tree-mode -1)
(setq spacemacs-dump-mode 'dumped)
(garbage-collect))))
(server-start)))))