tl;dr
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get purge emacs-snapshot-common emacs-snapshot-bin-common emacs-snapshot emacs-snapshot-el emacs-snapshot-gtk emacs23 emacs23-bin-common emacs23-common emacs23-el emacs23-nox emacs23-lucid auctex emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg
sudo apt-get install emacs24 emacs24-el emacs24-common-non-dfsg
sudo rm /etc/apt/sources.list.d/cassou-emacs-precise.list
# ~/.emacs.d/init.el:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
# in emacs
M-x list-packages
# press [ENTER] on slim-mode
# move to buffer and press [ENTER] on [Install]
Part 1: Install emacs 24.
The docs for slim-mode talk about having Emacs 24 or package.el. As of this writing, the version of emacs available in Ubuntu 12.04 is 23.3.1 :(. We don't want to build things up on old software versions, now do we? Of course, it's more complicated than it should be, otherwise there would be no point in blogging about it.
The recommended way to get Emacs 24 on Ubuntu 12.04 appears to be by using Damien Cassou's PPA for Emacs. To do that, we need to add the PPA to apt-get:
sudo add-apt-repository ppa:cassou/emacs
which gives us the error:
sudo: add-apt-repository: command not found
Here's a great write-up about how to fix that error, as well as some additional info about using a magical apt-file tool. Let me like to the error message again for some extra link juice to that page: sudo: add-apt-repository: command not found.
So then we proceed with
sudo apt-get install python-software-properties
then
sudo add-apt-repository ppa:cassou/emacs
This writes to /etc/apt/sources.list.d/cassou-emacs-precise.list.
Then I did a
sudo apt-get update
and
sudo apt-get upgrade emacs
which appeared to be replacing Emacs 23 with 24.1, but after it finished, I still got Emacs 23.3.1 from emacs --version. :(
So let's try the instructions from Damien.
sudo apt-get purge emacs-snapshot-common emacs-snapshot-bin-common emacs-snapshot emacs-snapshot-el emacs-snapshot-gtk emacs23 emacs23-bin-common emacs23-common emacs23-el emacs23-nox emacs23-lucid auctex emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg
sudo apt-get install emacs24 emacs24-el emacs24-common-non-dfsg
And now,
emacs --version
gives me Emacs 24.3.1. Success!
Now, just to be paranoid, I'm going to remove the PPA from my system, as I probably don't need it anymore.
sudo rm /etc/apt/sources.list.d/cassou-emacs-precise.list
Part 2: Install slim-mode.
Now that we've got Emacs 24 installed, we go back to the slim-mode documentation. Various installation options are listed there: Manual, Marmalade, MELPA, Emacs Prelude. I tried using Emacs Prelude, but it's really rather beefy. It slowed down my emacs launching substantially, and tried to change the way I like things too much (cursor/arrow keys disabled by default, hard-to-see colors in my putty terminal, ...).
From what I can tell, MELPA is more active than Marmalade (which could have the more "stable" versions), so let's use that. To install MELPA, we add the following to ~/.emacs.d/init.el:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
The (require 'package) fixes the initialization errors about "Symbol's value as variable is void: package-archives" when you start emacs.
Alternatively, you can open emacs, run M-x package-initialize [ENTER], then M-x cusomize-variable [ENTER] package-archives [ENTER], and use the UI to insert a new value after the gnu archive - Archive name: melpa, URL: http://melpa.milkbox.net/packages/. Then save this for future sessions (via the [ State ] control), and it will write this to ~/.emacs for you.
So now, inside of emacs, run M-x list-packages, find slim-mode, and press [ENTER] on it, and [ENTER] on the [Install] option in the buffer that loads. This will install files in ~/.emacs.d/elpa/, and your slim-mode should be ready to roll! (I get some warnings when installing slim-mode, but it seems to work anyway).
Success!