Discuss This Topic
There are 1 comments in this discussion.
Read and join this discussion
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.
Walter McGinnis
said Aquamacs and emacsclient
See the pertinent section of the Aquamacs FAQ. You may have to install the Aquamacs command line tools (adds
aquamacs
and Aquatics awareemacsclient
CLI commands).After you have installed them, you should be able to find emacsclient under /usr/bin/emacsclient. Adjust the above accordingly.
Tags: emacs, tips, tricks, emacsclient, Aquatics, aquamacs-starter-kit