Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
557 lines (442 sloc) 19.7 KB

Emacs Starter Kit

Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish.

– Neal Stephenson, “In the Beginning was the Command Line”


This should provide a saner set of defaults than you get normally with Emacs. It’s intended for beginners, but provides a good elisp initialization structure for all levels of users.

The main advantage of this Emacs Starter Kit are

  • better default settings
  • inclusion of many useful libraries
  • “literate” customization embedded in Org-mode files
  • an organizational directory structure
  • git provides for version control, backup, and sharing

The latest version is at


This won’t teach you Emacs, but it’ll make it easier to get comfortable. To access the tutorial, press control-h followed by t.

The Emacs Wiki is also very handy.


  1. Install Emacs (at least version 22) Use your package manager if you have one. Otherwise, Mac users should get it from Apple, or install it directly from from source following the instructions in nextstep/INSTALL. Windows users can get it from GNU.
  2. Checkout a version of the starter kit using git – if you’re new to git checkout this git-tutorial, also we’d highly recommend that you try out magit the Emacs mode for git interaction which comes bundled in the starter kit.
    git clone
  3. Move the resulting directory to ~/.emacs.d [1]
  4. Install the Org-mode submodules with the following
    cd ~/.emacs.d/
    git submodule init
    git submodule update
  5. build Org-mode
    cd src/org/
  6. build auctex – for instilllation help see the auctex instillation instructions, auctex requires a working TeX installation
    cd src/auctex
    ./configure && make
  7. Launch Emacs!

After setup you may need to restart Emacs a couple of times while it downloads packages from ELPA – errors parsing html from ** can generally be safely ignored.

If you are missing some autoloads after an update (should manifest itself as “void function: foobar” errors) try M-x regen-autoloads.

If you want to keep your regular ~/.emacs.d in place and just launch a single instance using the starter kit, try the following invocation:

emacs -q -l ~/src/emacs-starter-kit/init.el

Note that having a ~/.emacs file might override the starter kit loading, so if you’ve having trouble loading it, make sure that file is not present.


The init.el file is where everything begins. It’s the first file to get loaded. Additional customization embedded in this file provides what I consider to be better defaults, both for different programming languages and for built-in Emacs features like bindings or registers.

Files that are pending submission to ELPA are bundled with the starter kit under the directory elpa-to-submit/. The understanding is that these are bundled just because nobody’s gotten around to turning them into packages, and the bundling of them is temporary. For these libraries, autoloads will be generated and kept in the loaddefs.el file. This allows them to be loaded on demand rather than at startup. Additionally any emacs-lisp packages located under the src/ directory will be added to the load-path.

There are also a few files that are meant for code that doesn’t belong in the Starter Kit, they are described below in Customization.


The many defaults built into the starter kit are only the beginning of most users customization of Emacs to suite their needs. The starter kit provides a number of places for additional user and system specific customization. These are designed in such a way that it will be easy for you to continue tracking your own personal customization inside the starter-kit while retaining your ability to pull down general starter-kit updates without conflict.

git branch
The first step to user-specific customization is (like in any git project) to MAKE A BRANCH FOR YOUR LOCAL CHANGES. Save the master branch for pulling down new versions of the starter kit, and save all of your personal information in a personal branch. That way you never have to worry about accidentally git push‘ing up a patch with all of your gnus email passwords.
User specific config
Your personal configuration information can be stored in a user-specific-config file. This is the file named after your user with the extensions .el or .org [2]. If you’re unsure of your user name evaluate the following code block to find out.
echo $USER

If your configuration starts to feel cramped in a single file (although with the nested headlines of an Org-mode file, that could take a while) and you want to stretch your config’s legs, you can also create a directory named after your system user name. If a such a directory exists, it will be added to the load-path, and any elisp or org-mode w/embedded elisp files in it will be loaded.

System specific config
Finally, you may want to configure different settings for different machines. The Starter Kit will look for a file named after the current hostname ending in .el or .org which will allow host-specific configuration. If you’re unsure of your hostname the following can be executed to find out.
Installing more elisp libraries
While the starter kit include many useful Emacs lisp libraries, you are bound to find more that you will want to install. The easiest way to install new libraries is through the Emacs Lisp Package Archive (see ELPA). When a library is not available through ELPA you can grab it’s source and place it directly in the src directory. Any packages found there will automatically be added to your load-path when Emacs starts up, and are guaranteed not to conflict with future starter-kit updates.

Some additional miscellaneous configuration and getting started suggestions

  • First off see the Customization node in the Emacs manual. Available online or through the info command (run with C-h i).
  • grep‘ing through the starter-kit-* files in this directory can provide useful examples for how to do things like install major modes, define keybindings, etc..
  • read the following Key-Binding-Conventions before defining too many personal key bindings
  • The starter-kit comes pre-bundled with a variety of color themes. See Color Themes for instructions on how to change the colors used by Emacs.

Emacs Lisp Package Archive

Libraries from ELPA are preferred when available since dependencies are handled automatically, and the burden to update them is removed from the user. In the long term, ideally everything would be installed via ELPA, and only package.el would need to be distributed with the starter kit. (Or better yet, package.el would come with Emacs…) See <a href=”* Starter Kit ELPA”>Starter Kit ELPA for a list of libraries that are pending submission to ELPA. Packages get installed in the elpa/ directory.

There’s no vendor/ directory in the starter kit because if an external library is useful enough to be bundled with the starter kit, it should be useful enough to submit to ELPA so that everyone can use it, not just users of the starter kit. However any packages included in the src/ directory will be added to the load-path, for tracking bleeding edge packages.

Sometimes packages are removed from the Starter Kit as they get added to ELPA itself. This has occasionally caused problems with certain packages. If you run into problems with such a package, try removing everything from inside the elpa/ directory and invoking M-x starter-kit-elpa-install in a fresh instance.


If you know your way around Emacs, please try out the starter kit as a replacement for your regular dotfiles for a while. If there’s anything you just can’t live without, add it or let me know so I can add it. Take a look at what happens in init.el to get started.

Also: see the Tasks section in this document. Helping submit new libraries to ELPA is the easiest way to help out. There are two ways you can do this: either take new libraries and make them ready for ELPA, dropping them in the elpa-to-submit directory or take files that are already in elpa-to-submit, ensuring all their dependencies are correctly loaded into ELPA, and sending them to the ELPA maintainer. There are details at for how ELPA submission works. Grep the project for TODO for other things.

Files are licensed under the same license as Emacs unless otherwise specified. See the file COPYING for details.

The latest version is at

On Unix, /home/$USER/.emacs.d, on windows Documents and Settings/%your user name%/Application Data


This section contains all code implementing the Emacs Starter Kit.

Starter kit basics

Load path etc.

(setq dotfiles-dir (file-name-directory
                    (or (buffer-file-name) load-file-name)))

(add-to-list 'load-path dotfiles-dir)
(add-to-list 'load-path (concat dotfiles-dir "/elpa-to-submit"))
(add-to-list 'load-path (concat dotfiles-dir "/elpa-to-submit/jabber"))

(setq autoload-file (concat dotfiles-dir "loaddefs.el"))
(setq package-user-dir (concat dotfiles-dir "elpa"))
(setq custom-file (concat dotfiles-dir "custom.el"))

Ubiquitous Packages

These should be loaded on startup rather than autoloaded on demand since they are likely to be used in every session

(require 'cl)
(require 'saveplace)
(require 'ffap)
(require 'uniquify)
(require 'ansi-color)
(require 'recentf)

Emacs 22 Backport

backport some functionality to Emacs 22 if needed

(require 'dominating-file)

Function for loading starter-kit-*

(defun starter-kit-load (file)
  "This function is to be used to load starter-kit-*.org files."
  (org-babel-load-file (expand-file-name file

Starter Kit aspell

aspell workaround in starter-kit-aspell

(starter-kit-load "")

ELPA (Emacs Lisp Package Manager)

Load up ELPA, the Emacs Lisp package manager

(require 'package)
(starter-kit-load "")

Starter Kit Customizations

Load up starter kit customizations

(load custom-file 'noerror)

Work around OS X bug

Work around a bug on OS X where system-name is FQDN

(if (eq system-type 'darwin)
    (setq system-name (car (split-string system-name "\\."))))

System/User specific customizations

You can keep system- or user-specific customizations here in either raw emacs-lisp files or as embedded elisp in org-mode files (as done in this document).

(setq system-specific-config (concat dotfiles-dir system-name ".el")
      system-specific-literate-config (concat dotfiles-dir system-name ".org")
      user-specific-config (concat dotfiles-dir user-login-name ".el")
      user-specific-literate-config (concat dotfiles-dir user-login-name ".org")
      user-specific-dir (concat dotfiles-dir user-login-name))
(add-to-list 'load-path user-specific-dir)

You can keep elisp source in the src directory. Packages loaded from here will override those installed by ELPA. This is useful if you want to track the development versions of a project, or if a project is not in elpa.

(setq elisp-source-dir (concat dotfiles-dir "src"))
(add-to-list 'load-path elisp-source-dir)

Load the rest of the starter kit core

The following files contain the remainder of the core of the Emacs Starter Kit. All of the code in this section should be loaded by everyone using the starter kit.

Starter kit defuns

Starter kit function definitions in starter-kit-defuns

(starter-kit-load "")

Starter kit misc

Miscellaneous settings in starter-kit-misc

(starter-kit-load "")

Starter kit bindings

Key Bindings in starter-kit-bindings and more in starter-kit-windows-bindings

;; (starter-kit-load "")
(starter-kit-load "")
(starter-kit-load "")

Starter kit Viper

Viper/Vimpulse support in starter-kit-viper

(starter-kit-load "")

Starter kit registers

Registers for jumping to commonly used files in starter-kit-registers

(starter-kit-load "")

Starter kit predictive

Autoload Predictive

(starter-kit-load "")

Language/Mode Specific Files

These sections pertain to specific languages or modes. Feel free to turn off these sections if you don’t plan on using the related mode or language.

Starter kit yasnippet

yasnippet is yet another snippet expansion system for Emacs. It is inspired by TextMate’s templating syntax.

load the yasnippet bundle

(add-to-list 'load-path
             (expand-file-name  "yasnippet"
                                (expand-file-name "src"
(require 'yasnippet)

load the snippets defined in the ./snippets/ directory

(yas/load-directory (expand-file-name "snippets" dotfiles-dir))

Starter Kit Version Control

Located in starter-kit-version-control

(starter-kit-load "")

Starter kit Org-mode

Located in starter-kit-org

(starter-kit-load "")

Starter kit eshell

Located in starter-kit-eshell

(starter-kit-load "")

Starter kit lisp

Located in starter-kit-lisp

(starter-kit-load "")

Starter kit Haskell

Located in starter-kit-haskell

(starter-kit-load "")

Starter kit ruby

Located in starter-kit-ruby

(starter-kit-load "")

Starter kit JS

Located in starter-kit-js

(starter-kit-load "")

Starter Kit Perl

Located in starter-kit-perl

(starter-kit-load "")

Starter Kit Latex

Located in starter-kit-latex

(starter-kit-load "")

Load User/System Specific Files

After we’ve loaded all the Starter Kit defaults, lets load the User’s stuff.

(if (file-exists-p elisp-source-dir)
    (let ((default-directory elisp-source-dir))
(if (file-exists-p system-specific-config) (load system-specific-config))
(if (file-exists-p system-specific-literate-config)
    (org-babel-load-file system-specific-literate-config))
(if (file-exists-p user-specific-config) (load user-specific-config))
(if (file-exists-p user-specific-literate-config)
    (org-babel-load-file user-specific-literate-config))
(when (file-exists-p user-specific-dir)
  (let ((default-directory user-specific-dir))
    (mapc #'load (directory-files user-specific-dir nil ".*el$"))
    (mapc #'org-babel-load-file (directory-files user-specific-dir nil ".*org$"))))


Tasks [1/10]

setup electric for ruby

set up ri for ruby

Submit the packages in starter-kit-elpa.el to ELPA.

Greg Newman is working on Python helpers.

submit ruby fixes to flymake

which-func-mode in ruby?

all bindings to kbd invocations

should yasnippet be included in rinari?

No, rinari has no dependency on yasnippet, and yasnippet has many applications outside of rinari.

flymake for perl

electric bugaloo for perl

Bugs [0/1]

get jabber.el to automatically disconnect when suspending/hibernating (via dbus)


[1] If you already have a directory at ~/.emacs.d move it out of the way and put this there instead.

[2] The emacs starter kit uses org-babel to load embedded elisp code directly from Org Mode documents.