Fullscreen Cocoa Emacs on OS X 10.6

by Hunter Haugen

The age old battle of editors rages on, but I have a feeling that it’s largely due to misunderstandings of purpose and ignorance of the opposing party. I have been a vi/vim user for 10+ years and found myself strongly advocating vim’s qualities of being lighter and more prevalence than emacs without having so much of an idea of how to quit emacs other than with pkill. Then I found myself with 3 months of free evenings and a slow-to-nonexistent internet connection and decided to fill some of that time and try emacs.

Long story short, I really like emacs for some tasks, and I really like vim for others. I love hacking on my .emacsrc but had been mostly constrained to running it in the terminal over ssh connections until I got a Mac. Now Macs are funny in that they are very GUI-gooey, but they manage to pull it off in a way that doesn’t make me, a hardcore terminal-only tiling-window-manager user, want to take a hammer to it.

Subsequently, I have been using the gui version of Emacs more and more, and it’s really something special on OS X. One feature I feel it’s lacking is fullscreen support. When working with vim, I toggle to fullscreen terminals when I really want to focus, so Emacs should allow me to do the same thing.

Shamelessly adapted from citizen428’s guide, guide, here is the step-by-step way to get fullscreen support written by typester on OS X vanilla emacs without having to rely on someone else’s compiled Emacs.app:

# Get the official Emacs repo:
git clone git://repo.or.cz/emacs.git

# Add typester as a remote and fetch his branches
git remote add typester git://github.com/typester/emacs.git
git fetch typester

# From a3585f6c2a to typester/feature/fullscreen are the 14
# commits we want to apply to our tree. Create a patch and apply to
# HEAD for the most cutting-edge Emacs
git checkout origin/master
git diff a3585f6c2a typester/feature/fullscreen | patch -p1

# Create a commit so you can just maintain your git tree for later
git commit -a -m "Typester's fullscreen patch" && git clean -d -f

# Alternatively, you could cherry pick all of typester's commits
# and not have to commit anything.
git cherry-pick 329d3eeab6e1997eed97e1fe40e5489a4c68edae \
                592a51bc2938e7c40a3c60b5a5301ea1510a0e74 \
                b9ff1ae683cf453da0415f5c83e329bbff35b9fa \
                000208df01f5c3af7d6f584304bc1a898701f87b \
                d8cf14d0243e5046f77051d05af31af77125d583 \
                df1e25370854fc04e4c217c214e9c02084c1ddae \
                41a9a1d946061c87ab6a6faf484a5b2e5812229f \
                c586de33d8e9ed6c94887526e9891de1788ba3f8 \
                663de471ea537083a86832c46984eab08407be90 \
                d1e183b01bd9f4608203aec5ae06518c37932a98 \
                b549c85507a1f52230c16ace217fe4e66308fc97 \
                5f2a5f555f475d570e6db2ffea4b259f0a90c302 \
                94512b4fd984146a62cde7d9c925058d0ebd0be3 \
                65343cea007dc56fa6c9e79ecd78f6fe538374e8

# Done with typester's remote
git remote rm typester

# build emacs
./configure --with-ns
make && make install
mv nextstep/Emacs.app /Applications/

# Later, to update emacs and keep fullscreen just do:
git pull origin master

I then bound “M-RET” to ns-toggle-fullscreen in my .emacsrc.