Install Emacs24 Snapshot on Debian, Ubuntu and Windows 7

I just can't wait for Emacs24 to be released! (I know, it's in beta and it'll be officially released Real Soon Now, but my catalyst is Technomancy's ESK2 which is such an improvement over ESK1, and it needs Emacs 24).

In my last post I had steps to build emacs from source-code. This is worth following for hacker cred, but it soon gets tedious if you have a lot of systems to put emacs on. As pointed out by a few readers, there are some snapshot builds available for different platforms. This post lists steps for installing the pre-built snapshots, for the three operating systems that I use.

Debian

As pointed out earlier, you can get emacs-snapshot builds for Debian from Julien Danjou (of awesome fame). That page does have instructions, but I'll list them here anyway:

  1. Import the key:
    $ wget -q -O - http://emacs.naquadah.org/key.gpg | sudo apt-key add -
    
  2. Add the snapshot repository to your /etc/apt/sources.list (by hand). Here's Julien's "stable" snapshot:
    deb http://emacs.naquadah.org/ stable/
    deb-src http://emacs.naquadah.org/ stable/
    
  3. Update your package database
    $ sudo aptitude update
    
  4. Install emacs-snapshot
    $ sudo aptitude install emacs-snapshot
    

Ubuntu

I'm running Ubuntu 11.10 in a VirtualBox on work's Windows 7 machine. As mentioned at Julien Danjou's page,

Damien Cassou makes a version of the same emacs-snapshot for Ubuntu, which is hosted at Launchpad. You add it and install simalarly:

  1. Add the PPA (Personal Package Archive). This also imports the key:
    $ sudo add-apt-repository ppa:cassou/emacs
    
  2. Update your package database
    $ sudo apt-get update
    
  3. Install emacs-snapshot
    $ sudo apt-get install emacs-snapshot
    

Windows

It's handy to have a native Windows emacs as well as the one in the VM. Of course being Windows, it's more complicated to install and configure... This has been tested on Windows 7:

  1. Download the latest PKZIP-ed binary from Google Code
  2. Unpack the ZIP (Windows Explorer can open ZIP files -- but 7zip is mich nicer). I like to unpack emacs in c:\Applications\emacs<version> so I can maintain several different versions at once
  3. (optional) Put a windows symlink to the version of emacs you want to use. This assumes your C: drive is formatted with NTFS, which on most Windows systems it is. The symlink can then be used for your %PATH% later and you won't have to edit the variable again to change versions, which for some odd reason is a convoluted operation in Windows... Type the following in a CMD.EXE prompt:
    C:\> CD C:\Applications
    C:\Applications\> MKLINK /D emacs emacs<version>
    
  4. Create an Environment Variable called %HOME% that refers to your Windows home directory (C:\Users\<username>). This is so that you can put your .emacs.d in your home directory, and Emacs will find it:
    1. Open Windows Explorer
    2. Right-click on "My Computer", choose "Properties"
    3. Choose "Advance system settings" (Really? what's so advanced about an environment variable?)
    4. Make sure the "Advanced" tab of the System Properties dialog is selected, then press the "Environment Variables..." button
    5. Press the top "New..." button (to add a personal variable, rather than system variable)
    6. in the "Variable name:" field, enter HOME. In the "Variable value:" field, put %USERPROFILE%, press "OK" button
    7. Press the other "OK" button to dismiss the Environment Varables dialog
    8. Press yet another "OK" button to dismiss the System Properties dialog
  5. Put emacs in your %PATH%. Use the same steps above to edit the Sytem variable PATH and add the path to Emacs (;C:\Applications\emacs\bin if you put a symlink in step 3)

Personal Emacs settings

You can now put your emacs settings into ~/.emacs.d (that's %HOME%\.emacs.d for Windows). I highly recommend Technomancy's Emacs Starter Kit (version 2).

My own ~/.emacs.d/init.el is set up to bootstrap ESK2 and a few favourite packages, just as Technomancy describes.

One package I'd like to mention here is "ergoemacs-keybindings" which gives more modern/ergonomic key bindings to emacs. Together with cua-mode, it makes Emacs behave very nicely. Currently though I notice there's a problem loading the package (maybe it's autoloads aren't right yet?) So I have to hack it as described in the package's README, (with a hard-coded path to the package directory, that'll break if I update it in the future because it has the package version) but I hope to fix it and send a patch for Xah Real Soon Now... In the mean-time, here's a snippet:

;;;; egroemacs keybindings

(setenv "ERGOEMACS_KEYBOARD_LAYOUT" "dv") ; US Dvorak (Ergonomic)

;; FIX: for some reason the library isn't loading from the package? 
;;      Have to put full path to the load file, which is brittle

(when (package-installed-p 'ergoemacs-keybindings)
  (load-file "~/.emacs.d/elpa/ergoemacs-keybindings-5.3.9/ergoemacs-keybindings.el")
  (ergoemacs-mode 1)
  (cua-mode 1))