dump: add dotspacemacs variables to control the dump

* new dotvariable dotspacemacs-emacs-pdumper-executable-file
* new dotvariable dotspacemacs-emacs-dumper-dump-file
* dump emacs if dotspacemacs-emacs-pdumper-executable-file is non nil
This commit is contained in:
syl20bnr 2018-05-06 00:02:44 -04:00
parent d7a5137c56
commit 89035d837b
4 changed files with 41 additions and 5 deletions

View File

@ -609,7 +609,9 @@ To prevent package from being installed or uninstalled set the variable
(configuration-layer//load-layers-files configuration-layer--used-layers
'("keybindings.el"))
(dotspacemacs|call-func dotspacemacs/user-load "Calling dotfile user-load...")
(spacemacs|unless-dumping (spacemacs/dump-emacs)))
(when (and dotspacemacs-emacs-pdumper-executable-file
(file-exists-p dotspacemacs-emacs-pdumper-executable-file))
(spacemacs|unless-dumping (spacemacs/dump-emacs))))
(run-hooks 'configuration-layer-post-load-hook))
(defun configuration-layer/load-auto-layer-file ()

View File

@ -55,6 +55,19 @@ exists. Otherwise, fallback to ~/.spacemacs"))
`+distributions'. For now available distributions are `spacemacs-base'
or `spacemacs'.")
(defvar dotspacemacs-emacs-pdumper-executable-file nil
"Absolute file path pointing to emacs 27.1 executable compiled with support
for the portable dumper (this is currently the branch pdumper).
If nil then automatic dump of emacs is disabled.")
(defvar dotspacemacs-emacs-dumper-dump-file "spacemacs.pdmp"
"File path of Spacemacs dump file. This is the file created by the portable
dumper. To load it when starting Emacs add the parameter `--dump-file'
when invoking Emacs 27.1 executable on the command line, for instance:
./emacs --dump-file=spacedump.pdump
If the file path is relative, it will be relative to the directory pointed
by `dotspacemacs-emacs-pdumper-executable-file'.")
(defvar dotspacemacs-gc-cons '(100000000 0.1)
"Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
This is an advanced option and should not be changed unless you suspect

View File

@ -47,11 +47,17 @@ You should not used this function, it is reserved for some specific process."
(defun spacemacs/dump-emacs ()
"Dump emacs in a subprocess."
(let ((default-directory "~/dev/emacs/src"))
(let ((default-directory (file-name-directory
dotspacemacs-emacs-pdumper-executable-file)))
(make-process
:name "spacemacs-dump"
:name "spacemacs-dumper"
:buffer "*spacemacs-dumper*"
:command (list "~/dev/emacs/src/emacs" "--batch" "-l" "~/.emacs.d/dump-init.el" "-eval" "(dump-emacs-portable \"spacedump.pdmp\")"))))
:command (list dotspacemacs-emacs-pdumper-executable-file
"--batch"
"-l" "~/.emacs.d/dump-init.el"
"-eval" (concat "(dump-emacs-portable \""
dotspacemacs-emacs-dumper-dump-file
"\")")))))
;; ;; Brute-force load all .el files in ELPA packages
;; (dolist (d (directory-files package-user-dir t nil 'nosort))

View File

@ -441,7 +441,22 @@ If you are unsure, try setting them in `dotspacemacs/user-config' first."
This function is called while dumping Spacemacs configuration. You can
`require' or `load' the libraries of your choice that will be included
in the dump."
)
(setq-default
;; Absolute file path pointing to emacs 27.1 executable compiled with support
;; for the portable dumper (this is currently the branch pdumper)
;; If nil then automatic Emacs dump is disabled.
;; (default nil)
dotspacemacs-emacs-pdumper-executable-file nil
;; File path of Spacemacs dump file. This is the file created by the portable
;; dumper. To load it when starting Emacs add the parameter `--dump-file'
;; when invoking Emacs 27.1 executable on the command line, for instance:
;; ./emacs --dump-file=spacedump.pdump
;; If the file path is relative, it will be relative to the directory pointed
;; by `dotspacemacs-emacs-pdumper-executable-file'.
;; (default spacedump.pdmp)
dotspacemacs-emacs-dumper-dump-file "spacemacs.pdmp"))
(defun dotspacemacs/user-config ()
"Configuration for user code: