Skip to content
My emacs.d directory
Emacs Lisp Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
emacs-rails-reloaded @ 0b95b63
inf-ruby @ a6daf44


Francis’ emacs config readme

This contains everything you need to get going with Ruby/Rails/Cucumber/Rspec/Textile/RestructuredText/Git/…

I have built it on the shoulders of the giants who wrote things like rails and rspec modes, have a look on the files/subrepos for who they are. I don’t want to take credit for their work, just use it and acknowledge their excellent contributions.

It also understands subversion and git (ack to the guys who wrote those modes too, of course).

If you want to use the Emacs Code Browser (this is probably an old version but it works for me) then you can get there from the tools menu and start it up.

I’ve just added support for file sets into the dotemacs.


Clone the repo into your home directory

git clone .emacs.d
cd .emacs.d
git submodule init
git submodule update
cd ..
ln -s .emacs .emacs.d/dotemacs

That’s it. Of course, if you already have a .emacs and a .emacs.d then move them out the way.

Obviously, if you don’t want my customisations and ECB setttings then copy the .emacs file and edit it instead.

My customisations (as far as I can remember)

Meta down : pick buffer
Meta up : pick file
Meta left/right : pop to last edit mark (can’t remember what this called in proper emacs speak)

Because we’re using the extensions that will search for stuff just starting to type a file name will search through the directory tree if you wait a little. meta-p (prev) and meta-n (next) will look for similarly named files in other places. This doesn’t always work, but seems to if you launch emacs from, say, a Rails home directory.

ctrl-o : Open a new line below the current one

ctrl-meta-o : Open a new line above

The new line will be properly indented. In Ruby def fred(arg1,argg^o) will put you in the body of the function with a helpful end and the correct indentation straight away. Because I’ve turned on the bracket completion ^E (end-line) is your friend, unless you use ^O like I do.

I have hacked some of the erb html abbreviations because when you were trying to type things like %form in ERB it would pop up an abbrev for the html

tag. This got old very quickly. The abbreviations are still there but have a ! on the end.

Look in the emacs-rails/rails-snippets-feature.el file for these. I use ff, if, %for a lot. % on its owb creates a < -%> tag, %% creates a %= tag.

Mark a block and press meta-/ – this will comment the lines in the block, not just Ruby but most langauges

ctrl-shift-backspace – delete line

Deleting a lot of lines sequentially puts them all in the yank buffer together. I didn’t add this in, it’s a very underused feature of the standard GUI emacs and is a bit like using dd a lot in Vim.

Also, mark a block and press ctrl-meta-\ – this will indent according to the rules

Tab indents the current line accorting to the rules

I added ctrl-tab to just insert spaces to the tab mark.

My other favourite underused feature is align-regexp (get there from meta-X)


Select it and do align-regexp with the argument => this will give you

biff     =>1
jim_xxxx =>2

Shell extensions

This setup runs emacs server and it’s useful if you have some shortcuts that run the emacs client:

alias ec='emacsclient -n'

In your bash_aliases file.

So then you can just type ec ’’file’’ and the file will be loaded into your running emacs session

function emacs
  /Applications/ $@ &

On a Mac this will run the GUI emacs from the shell in the background FWIW. I have similar shortcuts in my cygwin and linux setups but usually just have one emacs session running in the foreground.

Something went wrong with that request. Please try again.