diff --git a/EXPERIMENTAL.org b/EXPERIMENTAL.org index a1de269b1..e7b4fcd44 100644 --- a/EXPERIMENTAL.org +++ b/EXPERIMENTAL.org @@ -23,6 +23,10 @@ The portable dumper is a feature that will be available with Emacs 27. This new dumper should theoretically work on all the three major OSes: GNU/Linux, macOS and Windows. +WARNING: pdumper does not work with Native Compilation, so if you get an error +like: =emacs: Trying to load incoherent dumped eln file=, make sure you disable +this. + ** Setup To test the portable dumper with Spacemacs, follow these steps: diff --git a/core/core-dumper.el b/core/core-dumper.el index dafbe086e..06ff690d3 100644 --- a/core/core-dumper.el +++ b/core/core-dumper.el @@ -104,17 +104,26 @@ the end of the loading of the dump file." (declare (indent defun)) (if (eq 'dumping spacemacs-dump-mode) (let ((funcname2 (intern (format "spacemacs//after-dump-%S" funcname)))) - `(progn - (defun ,funcname2 nil ,@body) - (add-to-list 'spacemacs-dump-delayed-functions ',funcname2))) + `(progn + (defun ,funcname2 nil ,@body) + (add-to-list 'spacemacs-dump-delayed-functions ',funcname2))) `(progn ,@body))) (defun spacemacs/emacs-with-pdumper-set-p () - "Return non-nil if a portable dumper capable emacs executable is set." + "Return non-nil if a portable dumper capable Emacs executable is set and +native compilation is not in effect." (and dotspacemacs-enable-emacs-pdumper (file-exists-p (locate-file (or dotspacemacs-emacs-pdumper-executable-file "emacs") - exec-path exec-suffixes 'file-executable-p)))) + exec-path exec-suffixes 'file-executable-p)) + (not (spacemacs/emacs-with-native-compilation-enabled-p)))) + +(defun spacemacs/emacs-with-native-compilation-enabled-p () + "Return non-nill if native compilation is enabled." + (and (featurep 'native-compile) + (fboundp 'native-compile-available-p) + (native-compile-available-p) + (not (eql comp-speed -1)))) (defun spacemacs/dump-modes (modes) "Load given MODES in order to be dumped." diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index 4efa397c8..4e258f50a 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -89,9 +89,13 @@ It should only modify the values of Spacemacs settings." ;; This setq-default sexp is an exhaustive list of all the supported ;; spacemacs settings. (setq-default - ;; If non-nil then enable support for the portable dumper. You'll need - ;; to compile Emacs 27 from source following the instructions in file + ;; If non-nil then enable support for the portable dumper. You'll need to + ;; compile Emacs 27 from source following the instructions in file ;; EXPERIMENTAL.org at to root of the git repository. + ;; + ;; WARNING: pdumper does not work with Native Compilation, so it's disabled + ;; regardless of the following setting when native compilation is in effect. + ;; ;; (default nil) dotspacemacs-enable-emacs-pdumper nil