Update: If you’re compiling the latest 23.3 version of Emacs with the GCC from XCode 4, you’re probably getting errors. Follow these steps. Better yet, if you already had a newer version of command line Emacs and Lion gave you a 2007 version, edit your /etc/path so your /usr/local/bin in on top and all should be good again.

Update 02/20/12: The curl URL was invalid on this now, so I went and updated it.

curl -O  http://ftp.gnu.org/gnu/emacs/emacs-24.3.tar.gz // 45.5MB
tar -xvzf emacs-24.3.tar.gz
cd emacs*
./configure -without-x
// see if it works with src/emacs -Q
sudo make install
// replace cur vers of emacs
sudo mv /usr/bin/emacs /usr/bin/emacs.bk
sudo cp /usr/local/bin/emacs /usr/bin/emacs

If you want the X version of emacs – the one with the ugly square UI, don’t use the -without-x flag. I’d recommend just using Carbon Emacs in that case, though. If you do compile with X you may run into some errors. You either need to install those missing packages are disable inline-image support with -with-jpeg=no --with-png=no --with-gif=no --with-tiff=no. For those writing Obj-c I heard --with-ns flag is cool.