Emacs Server
People often claim that Emacs is slower compared to other editors, particularly when using multiple external packages. Personally, I start Emacs in "server-mode" alongside my graphical environment, allowing me to quickly connect to that server later on.
It can be easily done 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, we 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 you 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's left empty, as in this case, it runs emacs --daemon
and attempts to connect to it.
To make my life easier, I have placed that line in a file named ec
, made it executable, and saved it in a directory within my PATH
(in my case, it is /usr/local/bin/
).
Now, I can launch the Emacs client just like any other program.