You can achieve this "fast load, slow load" using the server/client functionality of emacs, which works like this:
Emacs can be started as a server. This can either be done as a stand-alone, running a server in the background. Or, if you want to, say, run a main GUI instance of emacs, the GUI and server can be started at the same time.
Once the server is started, it can be connected to using the emacsclient
application, which will connect to the presently running emacs server. This is vastly faster to activate than starting emacs from scratch.
To do this:
- To start emacs as a server, in the background, in your terminal, issue
emacs --daemon
.
- To start the emacs server while you load emacs -- for instance, if you're using the emacs GUI, add
(server-start)
to your init.el
(or init.el equivalent).
- To connect to the server, use
emacsclient
. To force emacsclient
to open the file in question in the terminal, use the -t
argument. E.g.: emacsclient -t foo.txt
.
If you run Emacs as a server, you might also appreciate having a command to stop running it: emacsclient -e '(kill-emacs)'
.