emacs server
I start Emacs in "server-mode" alongside my graphical environment. Whenever I want to use it, everything is already loaded and ready to go. Thanks to that, from my perspective it opens pretty much instantly.
It can be easily set by editing ~/.xinitrc
file.
This file is being used by xinit(1)
to start the X Window System server and a first client program.
# .xinitrc # ... emacs --daemon # ...
According to emacs(1)
the emacs --daemon
command starts Emacs as daemon (o rly?), enables Emacs server and disconnects from the terminal.
With server running in the background, I can connect to it with the emacsclient(1)
command.
% emacsclient -c -a ""
To create a new frame, the flag -c
is used.
This is particularly useful when Emacs is already open but I don't want to reuse the existing frame.
The second flag, -a
, initiates an alternate editor if the Emacs server is not running.
If it is left empty, as in this case, it runs emacs --daemon
and attempts to connect to it.
To make my life easier, I've placed that line in a file named ec
, made it executable, and saved it in a directory within my PATH
(/usr/local/bin/
, to be specific).
Now, I can launch Emacs client just like any other program.