New emacs setupΒΆ

Tags: python

I edit all my code with emacs. Since 1996 or so. And all blog entries. And all...

So my emacs settings are “quite important” to me. When I installed the new laptop I’m typing this on, my settings stopped working: I just deleted my ~/.emacs.d/ directory because I wanted to upgrade my setup.

Since a couple of years I used the emacs starter kit version 2. The link goes to my slightly modified copy of the original version 2 starter kit.

The setup change I wanted to make was to update to the version 3 of the emacs starter kit. That link goes to the real starter kit, which in version 3 is... just a text document!

Which is a good thing. You don’t need to clone a git repo just to get a bunch of settings. You use emacs’ package tool to download the better-defaults package, which contains most/all of the settings changes that made the original emacs starter git such a joy to use.

And on top of that, it suggests a couple of handy packages to use also. I’m using all of the suggested ones (apart from ‘scpaste’, which I don’t use).

And it provides a template for an almost-empty init.el main config file. I’ve copy/pasted a couple of lines from the version 2 starter kit at the end:

;; Standard emacs starter kit (version 3) startup code.
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)

;; List of packages that I use.
(defvar my-packages '(better-defaults paredit idle-highlight-mode ido-ubiquitous
                                      find-file-in-project magit smex)
  "A list of packages to ensure are installed at launch.")

;; Commands suggested by the Emacs starter kit to keep its packages up
;; to date.
(when (not package-archive-contents)
  (package-refresh-contents))
(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

;; Load system specific init (read: "run only on osx").
;; Also load my username's config (read: my customizations are in 'reinout.el')
(setq dotfiles-dir (file-name-directory
                    (or (buffer-file-name) load-file-name)))
(setq system-specific-config (concat dotfiles-dir system-name ".el")
      user-specific-config (concat dotfiles-dir user-login-name ".el"))
(if (file-exists-p system-specific-config) (load system-specific-config))
(if (file-exists-p user-specific-config) (load user-specific-config))

Those last few of lines make sure that on my laptop, it finds the hostname-named nens-lt-148.local.el which starts emacs as a server. And it loads my username-named reinout.el with my personal customizations.

Anyway... Now my emacs config is just a few config files in my git-stored dotfiles directory (see for instance this article where I mention Dotfiles). Instead of a separate git clone. Nice and tidy!

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):