Kyle’s Emacs Configuration
This git repository is my personal Emacs configuration and set up. It is set up so that you can base your configuration off of it, with your own customizations, and still keep the base configuration up to date. I have attempted to make it as easy to set up and use as I can, though it can always be improved. If you have suggestions, recommendations or feedback I’d be very happy to hear from you.
Kyle Burton <firstname.lastname@example.org>
I’ve tried to make installation as simple as possible. Once you’ve cloned the git repository, symlink (or copy if you can’t symlink) the
.emacs file from the git repository to your
$HOME directory. This is typically accomplished on a unix platform with commands like the following:
kyle@indigo64 ~$ mkdir -p personal/configuration kyle@indigo64 ~$ cd personal/configuration kyle@indigo64 ~/personal/configuration$ git clone git://github.com/kyleburton/krbemacs.git kyle@indigo64 ~/personal/configuration$ cd krbemacs kyle@indigo64 ~/personal/configuration/krbemacs$ ln -s `pwd`/.emacs ~
The only software that you need installed should be Emacs. I have only been using recent versions of emacs (22.3) and do not know if it works with older versions of Emacs at this time.
At this time I’m doing most of my active software development in Ruby (Rails) and Clojure, so those are the two best represented languages in this configuration. For other modes or libraries that did not come with the base install of Emacs, I have included them in this git repository so that they do not need to be installed or tested outside of what you get with this project.
The configuration includes
ruby-mode which should activate when you open a
Rakefile or a
yasnippet is included in this configuration. It is an easily customizable snippet (expansion) library. You can find the actual snippets in
M-x means press the ‘Meta’ (typically the Alt) key and the ‘x’ at the same time.
M-X means press the ‘Meta’ (typically the Alt) key, the Shift and the ‘x’ at the same time – ‘alt and capital X’.
Emacs supports the ‘Esc’ key as an alternate to the Meta key – though you don’t hold it down, you press ‘Esc’ and release it and then the second character. So
Esc x will achieve the same thing in Emacs. The reason I’m telling you this is that one day you may find yourself on a system that for some reason has re-mapped the Alt/Meta key to something else or that you’ve ssh’d into and for some reason Meta/Alt isn’t working. Knowing about Esc can at least get you by in these situations.
C-x means press the ‘Control’ key and the ‘x’ at the same time.
In these keystroke examples, the hyphen ‘-’ means to press the keys at the same time, a space indicates that you should let go of the previous key before pressing the next one.
C-c r C-t means “press ‘control-c’ (at the same time), release them, press and release ‘r’, and press ‘control-t’ and release it”.
Emacs supports so many features that there are not enough single key key bindings (hotkeys, keyboard accelerators) to access all of its features. This is why there are so many multi-key and multi-sequence key bindings. Once you learn a bit about how to customize Emacs, you can rebind the features and keybindings to you liking – later on in this guide I’ll show you how to do that with your own configuration.
Running a Function without a Keybinding
Emacs allows you to run arbitrary internal functions. There are two ways to do this. There are two classes of functions in Emacs, one class is declared as being invokable directly by the user, these are called ‘interactive’, the other are just internal functions which you can’t call directly (meaning from a keybinding or via
If a function doesn’t have a keybinding, and you know it’s name, you can invoke it directly by pressing
M-x and then typing the name of the function. For instance, to see the version of the Emacs you’re running, you can run the ‘version’ function directly by typing:
M-x version and then pressing enter.
‘Forcing’ a Mode in a File
Emacs supports you setting the mode of a file from a comment at the top of the file. This is useful in cases where the regular expression pattern matching used based on the file name extension doesn’t recognized the type of the file and put it into the mode you want. In some cases you may also wish to force Emacs into an alternate mode for a file that would otherwise be set to a specific mode.
You can change the mode of a file with a comment (in the syntax of the langugae of the file) at the top with the form:
#!/bin/bash # -*- zsh-mode -* ...