Mike Zamansky has another video in his Using Emacs series up. This time it’s about emacsclient. All Emacs users tend to obsess over the editor’s load time. We are always looking for ways to speed it up or to avoid having to load it in the first place.
For many of us that means leaving Emacs running all the time. Some folks even arrange for it to be loaded by systemd as part of the boot process. Leaving Emacs up all the time has the downside of accumulating buffers. I used to fret about that myself but I finally realized that Emacs can handle hundreds of buffers without difficulty so I stopped worrying about it. I restart Emacs often enough—due to things like updating packages such as yasnippet
that really want to be restarted when they’re updated—that I never accumulate more than a couple hundred buffers anyway.
One nice way of handling this strategy is to run Emacs in server mode and pop up a new frame when needed with emacsclient
. The way to do that is to call it as
emacsclient -a "" -c
The -a ""
will try to start the Emacs server if it’s not already running. If you want to start it in a terminal, the spell for that is
emacsclient -a "" -t
The terminal version is really useful for when you ssh
into a remote machine and need to bring up Emacs on the remote. I have this captured in a bash script named et so that I can call it easily.
Zamansky demonstrates all this and shows how he binds the magic spells to keyboard shortcuts so that he can instantly launch an Emacs frame in the desktop or in a terminal window when he needs it. This weeks video is really short—less than 5 minutes—so you can watch it while you’re waiting for your coffee to cool enough to sip.