Skip to content
Emacs Config Files
Emacs Lisp
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
defuns
lang
machines
os
vendor
.gitignore
COPYING
LAST-SYNCH
README.markdown
TODO
appearance.el
bindings.el
custom.el
desktop-config.el
dominating-file.el
el-get-config.el
eshell-alias
eshell-utils.el
git-config.el
helpers.el
ibuffer-config.el
ido-config.el
init.el
misc.el
registers.el
shell-utils.el
w3m-config.el

README.markdown

This configuration is no longer used actively. Instead, I've switched to a configuration based on prelude.

Emacs Configuration

This is a configuration for Emacs. It focuses mainly on programming, with settings for many languages. It also allows custom settings for each OS/Machine.

This configuration started in Jan 2010, derived from the Emacs Starter Kit.

Installation

  1. Grab GNU Emacs (24.* version!), use apt or another package manager for linux. For Mac OS X, use some prebuilt binaries (I dislike both Carbon- and Aquamacs). Windows users can get it directly from GNU.

  2. Link the directory with ln -s ~/{emacs_dir} ~/.emacs.d.

  3. Map the CAPS key to control. It is very easy to do in Mac OS X and Linux, you'll need some registry files for windows.

  4. Install el-get as described below.

Byte Compiling

This config tries very hard to avoid loading packages or other resources until they are required, which should keep the startup time to a minimum. That said, it can useful to byte-compile some packages. The command to do that is:

C-u 0 M-x byte-recompile-directory

The vendor folder is automatically compiled at start time, as well as el-get-packages, as they are already compiled. Don't apply this to the common settings, like bindings, misc, or the lang folder. If you change the .el file, the .elc might get outdated and emacs will be using the wrong file.

Structure

The init.el file is where everything begins. It's the first file to get loaded. Other relevant files are:

  • helpers.el: Functions and settings used during intialization.

  • defuns.el: Some useful functions for editing and configuration.

  • bindings.el: Some changes to the default keybindings, plus new ones for our custom functions.

  • misc.el: Visual settings, colors, UTF-8 for everything, and some other settings.

  • registers.el: Registers config.

  • (e)shell-utils.el: Settings to use shells inside emacs. Not very much used as I've been using the shell directly.

Configuration for specific packages

  • desktop-config.el: Automatically save/restore the session when restarting emacs.

  • git-config.el: Git related configuration.

  • ibuffer-config.el: Customize the ibuffer window.

  • mode-line-config.el: Customize the status bar.

  • w3m-config: Configuration to use the w3m browser inside emacs.

User/Machine/OS Specific settings

It is possible to add extra configuration, by creating files that are run depending on where emacs is running.

First, a specific configuration is loaded based on the OS that emacs is running in. The files are located in the os folder. One example is configuring the special keys for Mac OS X.

A file based on the hostname of the machine is also loaded. Here I usually set up the size of the emacs window, the font and some specific environment variables.

Lastly, it is also possible to run a configuration file based on the user name. This is currently not used.

Language settings

As this config is oriented towards programming, languages have usually their own config file. They are found in the lang folder. They are centered around setting the correct mode, specific bindings, syntax error highlight and autocomplete facilities. Some of the modes need extra packages or external programs. These are not included in the distribution to avoid bloat. However, each mode has detailed instructions in its header about how to install them. Usually, the config auto-detects the availability, so that it is not necessary to set extra variables, or comment/uncomment things.

Spell correction

Flyspell is used to provide spell correction for text-mode and comments in source files. Depending on the system it might be necessary to install aspell and aspell-dict-en.

el-get

It is intended as a replacement of ELPA. To use it, clone it inside the emacs folder with:

git clone git@github.com:sirech/el-get.git

Keep in mind that the el-get repository is just a fork, and has to be synchronized with the original occasionally.

Downloading packages

Packages defined in el-get-config.el get downloaded automatically inside el-get-packages.

It is assumed that a connection to the internet is available. git (>= 1.7) and svn are also required and have to be reachable from emacs.

This process tends to fail a lot the first time it tries to download every package. Just keep trying, specially if errors like End Of Buffer come up.

Some tips to install some packages can be found in the el-get-config.el file itself.

Proxies

If you are behind a proxy, git might not work. To solve this, depending on the protocol used:

  • http: Set your proxy via

    (setq url-using-proxy t) (setq url-proxy-services '(("http" . (concat host ":" port))))

  • git: You need to define the environment variable GIT_PROXY_COMMAND, and set it to a script that does the redirecting

    (setenv "GIT_PROXY_COMMAND" "git-proxy-cmd")

Where the command can be something like:

nc -x$PROXY_HOST:1080 -X5 $*

The command has to be in a directory added to the PATH in emacs (like ~/bin).

Test

This configuration is used almost daily under Mac OS X, frequently under Linux (Ubuntu), and occasionally under Windows (with help of cygwin), for general text editing, and for programming. In case of problems, running the last version of everything usually helps.

Resources for Emacs

Some interesting places to learn more about emacs:

Something went wrong with that request. Please try again.