spacemacs/EXPERIMENTAL.org

148 lines
5.3 KiB
Org Mode
Raw Normal View History

#+TITLE: Spacemacs experimental features
* Table of contents :TOC_4_gh:noexport:
- [[#spacemacs-dumps-using-the-portable-dumper][Spacemacs dumps using the portable dumper]]
2018-05-06 16:13:58 +00:00
- [[#setup][Setup]]
- [[#clone-emacs][Clone Emacs]]
- [[#simple-patch-of-emacs-source-code][Simple patch of Emacs source code]]
2018-05-06 16:13:58 +00:00
- [[#compile-emacs-from-source][Compile Emacs from source]]
- [[#macos][MacOS]]
- [[#update-your-dotfile][Update your dotfile]]
- [[#test][Test]]
- [[#report-issues][Report issues]]
- [[#usage][Usage]]
* Spacemacs dumps using the portable dumper
The portable dumper is a feature that may be availabe with Emacs 27.1, for now
its code is in the =pdumper= branch of the Emacs Git repository, it has not been
merged to master yet.
This should theoretically work on all the three major OSes: GNU/Linux, MacOS and
Windows.
2018-05-06 16:13:58 +00:00
** Setup
To test the portable dumper with Spacemacs, follow these steps:
2018-05-06 16:13:58 +00:00
*** Clone Emacs
Clone Emacs from [[https://git.savannah.gnu.org/git/emacs.git]]:
#+BEGIN_SRC shell
git clone https://git.savannah.gnu.org/git/emacs.git
cd emacs
git checkout pdumper
#+END_SRC
*** Simple patch of Emacs source code
We need to increase the number of =remember_data= slots in =src/pdumper.c=, we
double the number of slots by replacing 32 with 64:
#+BEGIN_SRC c
static struct
{
void *mem;
int sz;
} remembered_data[64];
#+END_SRC
2018-05-06 16:13:58 +00:00
*** Compile Emacs from source
This step depends on your OS (please create a PR to add the instructions for
your OS).
2018-05-06 16:13:58 +00:00
**** MacOS
In the root directory of your freshly cloned Emacs repository and with the
=pdumper= branch as the current branch:
#+BEGIN_SRC shell
./autogen.sh
./configure --with-ns --with-dbus --with-gnutls --with-imagemagick --with-rsvg --with-mailutils --with-xml2 --with-modules
#+END_SRC
2018-05-06 16:13:58 +00:00
*** Update your dotfile
In the function =dotspacemacs/init= add the following variables if you have
not them already and intialize them:
#+BEGIN_SRC emacs-lisp
(defun dotspacemacs/init ()
"Initialization:
This function is called at the very beginning of Spacemacs startup,
before layer configuration.
It should only modify the values of 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
;; EXPERIMENTAL.org at to root of the git repository.
;; (default nil)
dotspacemacs-enable-emacs-pdumper t
;; File path pointing to emacs 27.1 executable compiled with support
;; for the portable dumper (this is currently the branch pdumper).
;; (default "emacs")
dotspacemacs-emacs-pdumper-executable-file "/path/to/emacs27"
;; Name of the Spacemacs dump file. This is the file will be created by the
;; portable dumper in the cache directory under dumps sub-directory.
;; 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=~/.emacs.d/.cache/dumps/spacemacs.pdmp
;; (default spacemacs.pdmp)
dotspacemacs-emacs-dumper-dump-file "spacemacs.pdmp"))
#+END_SRC
A new user dotfile function has been added which is called before doing the
dump. The function name is =dotspacemacs/user-load=. You can require additional
libraries before the dump so they won't need to be lazy loaded.
Add this to your dotfile if you don't have it already.
#+BEGIN_SRC emacs-lisp
(defun dotspacemacs/user-load ()
"Library to load while dumping.
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."
)
#+END_SRC
2018-05-08 05:38:30 +00:00
*** Test
Restart Emacs. Each time Emacs starts, Spacemacs will check if the list of your
layers has changed, if it has changed then Emacs will be automatically dumped
for you in an asynchronous process. The buffer for the output of the process is
named =*spacemacs dumper*=.
If you have no error during the dump you can test it out!
To actually start Spacemacs with the compiled Emacs 27.1 and the Spacemacs dump,
on the command line in the =src= directory of the cloned Emacs source:
#+BEGIN_SRC shell
./emacs --dump-file=/Users/sylvain/.emacs.d/.cache/dumps/spacemacs.pdmp &
#+END_SRC
2018-05-06 16:13:58 +00:00
*** Report issues
If you want to report an issue regarding this new feature please use the label
=Portable Dumper=.
All the related issues can be found with [[https://github.com/syl20bnr/spacemacs/labels/Portable%20Dumper][this link]].
2018-05-06 16:13:58 +00:00
** Usage
Once =dotspacemacs-enable-emacs-pdumper= is set to =t= and
=dotspacemacs-emacs-pdumper-executable-file= is set to a valid file path to an
Emacs 27.1 executable, Emacs will be redumped automatically each time the layer
list changes or the =--force-dump= parameter is passed on the command line.
2018-05-06 16:13:58 +00:00
To use the created dump file, open a shell in the =src= directory of the cloned
Emacs source and type:
#+BEGIN_SRC shell
./emacs --dump-file=/Users/sylvain/.emacs.d/.cache/dumps/spacemacs.pdmp &
2018-05-06 16:13:58 +00:00
#+END_SRC
2018-05-08 05:38:30 +00:00
=spacemacs.pdmp= corresponds to the value of the variable
2018-05-06 16:13:58 +00:00
=dotspacemacs-emacs-dumper-dump-file=.
2018-05-08 05:38:30 +00:00
A forced dump is executed whenever the configuration is reloaded with
~SPC f e R~. If a dump is already running then it is cancelled and a new on is
started. Check the buffer =*spacemacs-dumper*= to see the progress of the
dumping.