2018-05-06 04:38:31 +00:00
|
|
|
|
#+TITLE: Spacemacs experimental features
|
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
|
* Table of Contents :TOC_4_gh:noexport:
|
2018-05-06 04:38:31 +00:00
|
|
|
|
- [[#spacemacs-dumps-using-the-portable-dumper][Spacemacs dumps using the portable dumper]]
|
2018-05-06 16:13:58 +00:00
|
|
|
|
- [[#setup][Setup]]
|
2018-05-29 04:53:11 +00:00
|
|
|
|
- [[#emacs-plus-users][=emacs-plus= users]]
|
2018-05-06 16:13:58 +00:00
|
|
|
|
- [[#clone-emacs][Clone Emacs]]
|
2018-05-07 00:52:09 +00:00
|
|
|
|
- [[#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]]
|
2018-05-23 03:17:54 +00:00
|
|
|
|
- [[#ubuntu][Ubuntu]]
|
2018-06-07 04:59:37 +00:00
|
|
|
|
- [[#windows][Windows]]
|
2018-05-23 03:17:54 +00:00
|
|
|
|
- [[#install-emacs][Install Emacs]]
|
2018-06-07 04:59:37 +00:00
|
|
|
|
- [[#windows-1][Windows]]
|
2018-05-06 16:13:58 +00:00
|
|
|
|
- [[#update-your-dotfile][Update your dotfile]]
|
|
|
|
|
- [[#test][Test]]
|
|
|
|
|
- [[#report-issues][Report issues]]
|
|
|
|
|
- [[#usage][Usage]]
|
2018-05-06 04:38:31 +00:00
|
|
|
|
|
|
|
|
|
* Spacemacs dumps using the portable dumper
|
2018-05-24 02:12:30 +00:00
|
|
|
|
The portable dumper is a feature that may be available with Emacs 27.1, for now
|
2018-05-06 04:38:31 +00:00
|
|
|
|
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
|
2018-05-06 04:38:31 +00:00
|
|
|
|
To test the portable dumper with Spacemacs, follow these steps:
|
|
|
|
|
|
2018-05-29 04:53:11 +00:00
|
|
|
|
*** =emacs-plus= users
|
|
|
|
|
In case you are using =d12frosted/emacs-plus= on macOS, you can skip manual
|
|
|
|
|
Emacs installation instructions and just use =--with-pdumper= option passed to
|
|
|
|
|
=brew=.
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
2018-05-30 22:06:31 +00:00
|
|
|
|
brew install emacs-plus --HEAD --with-pdumper
|
2018-05-29 04:53:11 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-05-06 16:13:58 +00:00
|
|
|
|
*** Clone Emacs
|
2018-05-06 04:38:31 +00:00
|
|
|
|
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
|
|
|
|
|
|
2018-10-09 04:51:40 +00:00
|
|
|
|
Note: On windows make sure that autocrlf is disabled in git before cloning or
|
|
|
|
|
else the =autoconf.sh= script will fail later on:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
git config --global core.autocrlf false
|
|
|
|
|
#+END_SRC
|
2018-10-03 20:12:06 +00:00
|
|
|
|
|
2018-05-07 00:52:09 +00:00
|
|
|
|
*** Simple patch of Emacs source code
|
2018-05-20 16:28:28 +00:00
|
|
|
|
We need to increase the number of =remembered_data= slots in =src/pdumper.c=, we
|
2018-05-07 00:52:09 +00:00
|
|
|
|
double the number of slots by replacing 32 with 64:
|
|
|
|
|
|
2018-05-23 03:17:54 +00:00
|
|
|
|
#+BEGIN_SRC C
|
2018-09-19 03:54:47 +00:00
|
|
|
|
static struct
|
|
|
|
|
{
|
|
|
|
|
void *mem;
|
|
|
|
|
int sz;
|
|
|
|
|
} remembered_data[64];
|
2018-05-07 00:52:09 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-05-06 16:13:58 +00:00
|
|
|
|
*** Compile Emacs from source
|
2018-05-06 04:38:31 +00:00
|
|
|
|
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
|
2018-05-06 04:38:31 +00:00
|
|
|
|
In the root directory of your freshly cloned Emacs repository and with the
|
|
|
|
|
=pdumper= branch as the current branch:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
2018-05-07 00:52:09 +00:00
|
|
|
|
./autogen.sh
|
2018-05-06 04:38:31 +00:00
|
|
|
|
./configure --with-ns --with-dbus --with-gnutls --with-imagemagick --with-rsvg --with-mailutils --with-xml2 --with-modules
|
2018-05-23 03:19:38 +00:00
|
|
|
|
make
|
2018-05-06 04:38:31 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-05-23 03:17:54 +00:00
|
|
|
|
**** Ubuntu
|
|
|
|
|
/Note: This is tested on Ubuntu 17.10./
|
|
|
|
|
|
|
|
|
|
In the root directory of your freshly cloned Emacs repository and with the
|
|
|
|
|
=pdumper= branch as the current branch:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
./autogen.sh
|
|
|
|
|
# Pick one. The first one will install Emacs locally and the second one will install it globally.
|
|
|
|
|
./configure --with-dbus --with-gnutls --with-imagemagick --with-rsvg --with-mailutils --with-xml2 --with-modules --prefix="$HOME/.local"
|
|
|
|
|
./configure --with-dbus --with-gnutls --with-imagemagick --with-rsvg --with-mailutils --with-xml2 --with-modules
|
2018-05-23 03:19:38 +00:00
|
|
|
|
make
|
2018-05-23 03:17:54 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-06-13 22:45:36 +00:00
|
|
|
|
If you have never compiled Emacs from source on your machine then you probably
|
2018-05-23 03:17:54 +00:00
|
|
|
|
need to install the following packages:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
2018-09-19 03:54:47 +00:00
|
|
|
|
sudo apt-get install build-essential automake texinfo libjpeg-dev libncurses5-dev
|
|
|
|
|
sudo apt-get install libtiff5-dev libgif-dev libpng-dev libxpm-dev libgtk-3-dev libgnutls28-dev
|
2018-05-23 03:17:54 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-06-07 04:40:55 +00:00
|
|
|
|
**** Windows
|
|
|
|
|
/Note: This is tested on Windows 10/
|
|
|
|
|
|
|
|
|
|
Install MSYS2 x86_64 from [[http://repo.msys2.org/distrib/x86_64/][here]].
|
|
|
|
|
|
|
|
|
|
Run msys2_shell.bat and in the msys2 prompt run:
|
2018-07-10 10:57:25 +00:00
|
|
|
|
|
2018-06-07 04:40:55 +00:00
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
pacman -S base-devel mingw-w64-x86_64-toolchain \
|
|
|
|
|
mingw-w64-x86_64-xpm-nox mingw-w64-x86_64-libtiff \
|
|
|
|
|
mingw-w64-x86_64-giflib mingw-w64-x86_64-jbigkit \
|
|
|
|
|
mingw-w64-x86_64-libpng mingw-w64-x86_64-libjpeg-turbo \
|
|
|
|
|
mingw-w64-x86_64-librsvg mingw-w64-x86_64-libxml2 \
|
|
|
|
|
mingw-w64-x86_64-gnutls
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-10-09 04:51:40 +00:00
|
|
|
|
Quit the msys2 shell and run mingw64.exe in the msys64 install directory. In the
|
|
|
|
|
mingw prompt navigate to the emacs source checkout (=cd /c/= will get you to the
|
|
|
|
|
root of the c drive) and run:
|
2018-06-07 04:40:55 +00:00
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
./autogen.sh
|
|
|
|
|
./configure --without-ns --without-dbus --with-gnutls --with-imagemagick --with-rsvg --with-mailutils --with-xml2 --with-modules
|
|
|
|
|
make
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
Instructions from [[https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/][here]].
|
|
|
|
|
|
2018-05-23 03:17:54 +00:00
|
|
|
|
*** Install Emacs
|
2018-05-23 03:19:38 +00:00
|
|
|
|
After the compiliation finished successfully, you may need to install Emacs.
|
2018-05-23 03:17:54 +00:00
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
make install # if you configure Emacs to install locally
|
|
|
|
|
sudo make install # if globally
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-06-07 04:40:55 +00:00
|
|
|
|
**** Windows
|
|
|
|
|
In the mingw shell run:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
make install prefix=/c/emacs
|
|
|
|
|
cp /mingw64/bin/{libwinpthread-*.dll,libXpm-noX*.dll,libdbus-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libgomp-*.dll,libgcc_s_seh-*.dll,libglib-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libintl-*.dll,libiconv-*.dll,libgobject-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libffi-*.dll,libgdk_pixbuf-*.dll,libgio-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libgmodule-*.dll,zlib*.dll,librsvg-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libcairo-*.dll,libcroco-*.dll,libpango-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libpangocairo-*.dll,libxml2-*.dll,libfontconfig-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libfreetype-*.dll,libpixman-*.dll,libpng*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libpangoft*.dll,libpangowin32-*.dll,liblzma-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libexpat-*.dll,libharfbuzz-*.dll,libgnutls-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libgnutlsxx-*.dll,libtiff-*.dll,libtiffxx-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libjpeg-*.dll,libgif-*.dll,libbz2-*.dll,libjbig-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libgmp-*.dll,libhogweed-*.dll,libnettle-*.dll} /c/emacs/bin
|
|
|
|
|
cp /mingw64/bin/{libp11-kit-*.dll,libtasn1-*.dll} /c/emacs/bin
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-05-06 16:13:58 +00:00
|
|
|
|
*** Update your dotfile
|
2018-09-19 03:54:47 +00:00
|
|
|
|
In the function =dotspacemacs/init= add the following variables if you don’t
|
2018-05-24 02:12:30 +00:00
|
|
|
|
have them already and initialize them:
|
2018-05-06 04:38:31 +00:00
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-09-19 03:54:47 +00:00
|
|
|
|
(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"))
|
2018-05-06 04:38:31 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-05-20 08:35:30 +00:00
|
|
|
|
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
|
2018-09-19 03:54:47 +00:00
|
|
|
|
libraries before the dump so they won’t need to be lazy loaded.
|
2018-05-20 08:35:30 +00:00
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
|
Add this to your dotfile if you don’t have it already.
|
2018-05-06 04:38:31 +00:00
|
|
|
|
|
2018-05-20 08:35:30 +00:00
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-09-19 03:54:47 +00:00
|
|
|
|
(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."
|
|
|
|
|
)
|
2018-05-20 08:35:30 +00:00
|
|
|
|
#+END_SRC
|
2018-05-08 05:38:30 +00:00
|
|
|
|
|
2018-05-23 03:17:54 +00:00
|
|
|
|
*Friendly suggestions:* If you have a lot of personal configuration in =user-init= and
|
|
|
|
|
=user-config=, you can try to move them into =user-load= as this can reduce the
|
|
|
|
|
time to load those customized configurations.
|
|
|
|
|
|
2018-05-20 08:35: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*=.
|
2018-05-06 04:38:31 +00:00
|
|
|
|
|
|
|
|
|
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
|
2018-05-08 04:58:12 +00:00
|
|
|
|
./emacs --dump-file=/Users/sylvain/.emacs.d/.cache/dumps/spacemacs.pdmp &
|
2018-05-06 04:38:31 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2018-05-06 16:13:58 +00:00
|
|
|
|
*** Report issues
|
2018-05-06 04:38:31 +00:00
|
|
|
|
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
|
2018-05-20 08:35:30 +00:00
|
|
|
|
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
|
2018-05-08 04:58:12 +00:00
|
|
|
|
./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
|
2018-05-24 02:12:30 +00:00
|
|
|
|
~SPC f e R~. If a dump is already running then it is cancelled and a new one is
|
2018-05-08 05:38:30 +00:00
|
|
|
|
started. Check the buffer =*spacemacs-dumper*= to see the progress of the
|
|
|
|
|
dumping.
|
2018-05-23 03:17:54 +00:00
|
|
|
|
|
|
|
|
|
After you can generate a portable dumper of your Emacs and you can start that
|
|
|
|
|
pdumper file successfully, you can alias the way you usually start Emacs to the
|
|
|
|
|
command:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
|
./emacs --dump-file=/Users/sylvain/.emacs.d/.cache/dumps/spacemacs.pdmp &
|
|
|
|
|
#+END_SRC
|