New emacs

Ahh the joy of shared hosting, and its supremely out of date packages:

$ emacs –version
GNU Emacs 23.1.1
Copyright (C) 2009 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Eyeballing the official archive site (http://ftp.gnu.org/gnu/emacs/), it’s pretty clear just how old 23.1 is:

emacs-23.1.tar.bz2                  29-Jul-2009 21:56   33M  
emacs-23.1.tar.bz2.sig              29-Jul-2009 21:56   72   
emacs-23.1.tar.gz                   29-Jul-2009 21:37   41M  
emacs-23.1.tar.gz.sig               29-Jul-2009 21:41   72   
[...]
emacs-24.3.tar.gz                   10-Mar-2013 22:31   50M  
emacs-24.3.tar.gz.sig               10-Mar-2013 22:31  490   
emacs-24.3.tar.xz                   10-Mar-2013 22:15   34M  
emacs-24.3.tar.xz.sig               10-Mar-2013 22:15  490   

So I decided to build a new version of emacs, 24.3, so I can get my hands on js2-mode:

./configure –prefix=$HOME/emacs –without-x-toolkit –without-gif –without-x –without-xpm –without-jpeg –without-tiff –without-png –without-imagemagick –without-xft –without-freetype

I have to admit, when ‘cat /proc/cpuinfo’ reveals 8 cores of this:

Intel(R) Xeon(R) CPU E3-1270 V2 @ 3.50GHz

I’m a pretty happy camper! (Wish I had one at home, though haven’t got a clue what I’d do with it.)

time make -j
real    0m23.641s
user    1m27.747s
sys     0m9.778s

Update: September 1, 2013

I built a copy of emacs 24.3 on a different system, and removed even more cruft from the configuration:

$ ./configure –prefix=$HOME –without-pop –without-xpm –without-jpeg –without-tiff –without-gif –without-png –without-rsvg –without-imagemagick –without-xft –without-libotf –without-toolkit-scroll-bars –without-xaw3d –without-xim –without-dbus –without-gconf –without-gsettings –with-x-toolkit=no –without-sound –without-x

Which gives a configuration like this, which is clean, and good, since I’ll be using it primarily via an ssh terminal:

Configured for `x86_64-unknown-linux-gnu'.

  Where should the build process find the source code?    downloads/emacs-24.3
  What compiler should emacs be built with?               gcc -std=gnu99 -g3 -O2
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    none
  What toolkit should Emacs use?                          none
  Where do we find X Windows header files?                NONE
  Where do we find X Windows libraries?                   NONE
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   no
  Does Emacs use -ljpeg?                                  no
  Does Emacs use -ltiff?                                  no
  Does Emacs use a gif library?                           no 
  Does Emacs use -lpng?                                   no
  Does Emacs use -lrsvg-2?                                no
  Does Emacs use imagemagick?                             no
  Does Emacs use -lgpm?                                   no
  Does Emacs use -ldbus?                                  no
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               no
  Does Emacs use -lselinux?                               yes
  Does Emacs use -lgnutls?                                no
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              no
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   no
  Does Emacs use toolkit scroll bars?                     no

Then, I add a few emacs package repositories (from here):

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

Setting up the various emacs packages goes something like:

M-x package-list-packages

And then just mark/delete the desired packages with ‘i’ / ‘d’ and press ‘x’ to execute the actions.

Damn You, Emacs Autoinsert

Emacs can also be annoying when it autoinserts text without checking to see if it’s already there. Case in point, gettext .po files under Emacs 23.1. For whatever reason, my copy kept inserting this header whenever I opened a translation file:

If this header sneaks into a .po file, when you try to compile the file with Django’s compilemessages command, you get the following error:

What seems to happen is that this header is only inserted when you use C-x C-f to open a file. When opening a file directly from the command line, this corruption does not seem to occur.

If you look at the PO Group configuration options, this text is listed there as the default PO file header. I haven’t validated this as a solution, but you should be able to switch this value to be the comment character “#”, and that should take care of the problem.

Also, why the hell does the PO major mode not allow you to destroy entire msgid’s and their translations? This is really annoying. Yes, it’s nice sometimes when programs limit your options, but in this case, Emacs was messing up by inserting the bad header, then refusing me the option of removing it.

emacs Settings

emacs is incredibly powerful, but configuration can be a royal pain sometime.

Here’s me trying to set the indentation levels when editing HTML. (Because it’s not obvious at all.)

Go to Nxml Child Indent, set that to what you want. In my case, I use 4 spaces per TAB.

These are the settings in my .emacs (you can see that I’m really trying to just set 4 spaces per TAB for all the modes):

Emacs can be annoying in the sheer number of uncorrelated variables it uses for the various modes.