Miskatonic University Press

My .emacs.d

emacs

Last week I was in a meeting, sitting beside my fellow librarian Nick Ruest. I was editing something in Emacs. He glanced over and said, "Are you using Solarized?" I said no. "Your color scheme"---he's American so he talks that way---"looks much like it," he said. I was curious, so I investigated and installed the Emacs Solarized theme. The dark version grabbed me right away. That led me into a delightful week of Emacs customizations and configuration which I will summarize here.

My .emacs.d is on GitHub and it has basic instructions on how to install it, if you want to make your Emacs run like mine does. Emacs 24 supports packages, which is very nice and makes it really to share environments and configurations.

Screenshot of me editing this very post in Markdown

Some notes:

  • I broke up a lot of the config into separate setup-something.el files, such as setup-ruby.el and setup-latex.el.
  • When I close Emacs it remembers all of the files I was editing and where I was in each one, and restores my place when I run it again.
  • I figured out how to turn off autopair mode in Ruby, where I use Ruby electric mode to add a add closing quotes, parentheses, brackets, and so on. Before I got that sorted out [ would turn into []].
  • I turned on auto-complete mode, which for me is especially handy in Ruby, where it prompts me by offering completed function and variable names.

Ruby auto-completion

I got some great things working in LaTeX, which I love. I realized there were a lot of features in AUCTex, the Emacs LaTeX mode, that I wasn't using. I learned some new keystrokes and commands that make it much more powerful, and I turned on auto-complete-latex mode.

I also began to use RefTeX. Very powerful. I was working on something that needed a bibliography, so I exported a BibTeX file from Zotero and integrated it with RefTeX. Among other things it does the Emacs equivalent of the Zotero Word plugin: you point it at a bibliography and then while you're writing your paper you hit a keystroke, search your bibliography for something (an author name or title fragment or something), select what you want from whatever matches, and it puts the proper citation into your text. In my case I needed to mention Vernor Vinge's great Rainbows End so I hit "Control-c [" to begin a search) then "vinge RET" (i.e. return) and got this:

Screenshot of RefTeX, part 1

I hit RET to select that result, since it was what I was looking for, and voila, it was added into my file.

Screenshot of RefTeX, part 2

Beautiful. Later when I turned the file into a PDF, the bibliography was formatted perfectly.

I wanted to try zotelo, the Emacs/Zotero integration package, but it doesn't work yet for me because it requires MozRepl in Firefox but I'm running Firefox 20 and MozRepl only works with up to Firefox 19 right now, though a patch is in the works. When it's updated I'll be able to talk to Zotero directly from Emacs when I'm writing. I'm looking forward to trying that out.

The other big new thing for me is org-mode, which is one of those Emacs things that freaks out non-Emacs users---probably some Emacs users too. Wow! I used to use outline-mode for managing my work project files, but I've switched to org-mode and I'll use it for other things too. It's really powerful and does a lot of smart, sensible things. The way it handles tables will be especially useful. And you can embed images! I printed out the beginner's guide and the huge manual and will study them both, and I'll post when I've got it suited to how I work.

There was a lot of fiddling and tweaking and reloading and reading, but now my Emacs is even more inviting and supportive than it was two weeks ago. It's so nice to use now it's drawing me in for writing and hacking and thinking.