Topic: Work Tools Revamp - emacs server and emacsclient

Topic type:

First installment in a series on sprucing up my text editor, shell, rubies, etc. This covers solving the common emacs gotcha of $EDITOR being called from external programs.

I've been using emacs as my primary text editor for close to a decade and a half. Although I maintain the Aquamacs emacs starter kit, I'm no where near a true emacs expert. I only tweak the default emacs configuration or write elisp when I see a real advantage to my workflow by fixing a pain point or improving things dramatically otherwise I keep chugging along focusing on what I'm really working on.

Since I switched to Aquamacs from vanilla emacs several years ago, one of the biggest pain points has been when some other program, e.g. git, asks for an editor process. Thankfully emacs since 23 has a client and server set up that fixes this with minimal tweaking.

First, I added an automatic start of emacs server somewhere loaded at start up (in my case ~/Library/Preferences/Aquamacs Emacs/Preferences.el):

Then change your EDITOR value in your shell environment to emacsclient:

After that whenever a program requests $EDITOR, you'll be switched over to your running emacs server. In my case, my Aquamacs session. When you kill the buffer, you'll be returned to the calling program as expected.

This small change actually makes a big difference in working with git for me. rebase -i is no longer daunting.


Discuss This Topic

There are 1 comments in this discussion.

Read and join this discussion

join this discussion

Like what you've read? You can check out my latest project at

Got a project of your own that you need help with? Let's talk