Sunday, 22 February 2009

My .emacs

I have been delaying this post for quite a while. I've been waiting until my .emacs file is "complete". Today, I realised it is never going to be complete. So here's a few notes regarding my emacs configuration and how you can use it.


I must confess, a few weeks back my emacs configuration consisted of one HUGE file and a few emacs lisp files scattered in a directory. Also, half of the tools and modes I used were installed in a system wide manner via the OS's packaging system. ...A mess.
I decided to put some order (beauty?) to it. So now my .emacs file is 9 non-comment non-whitespace lines and the rest of the configuration is well distributed several different in appropriately named files and directories. With all tools included it is 535149 LOC.

Mobility (sort of)

I love working in emacs so much that I consider most other editing options a pain. I've even considered implementing emacs-lisp in javascript so I can turn every textarea into a fully functional emacs buffer (this is way down in my list of personal-projects-i-will-do-someday due to its complexity and my lack of free time)[1].

Being a little more realistic, I decided just to put my .emacs in a git repo that I could access everywhere and which included all the things I normally use when developing (or writting in general). This way I could have all my tools everywhere customized the way I want them.
With this approach installing new tools (like JDEE) becomes a little more complicated because they are commonly packaged to be installed in a system wide manner. Also, I cannot use my OS packaging system. But the upside of having everything in one places pays off.

So, why does it say "sort of" in the title? Well, some of the tools (the ones that need non-emacs-lisp components) are compiled for my system (A 64-bit Arch Linux box). So you might have problems with them if you just clone my emacs repo in a different system.
What can go wrong? Mostly there might be problems with JDEE and AucTex. But besides that I don't see much that could go wrong in a unix system.


There are not many new and amazing things. So here's a non-exhaustive list of stuff I use every day:
* Color themes
* git support
* Auctex
* word-to-emacs (open .doc files in emacs)
* some modes: (java, haskell, erlang, javascript, etc)
* some key-bindings:
* C-x p: go to matching paren
* f9: cross highlight (line and column)
* f11: fullscreen
* f10: remove scrollbar (combined with f11 it makes a great fullscreen experience =) )
* M-/ M-: move line up/down
* f8: make frame on display
* f5: go-to-line
* enhanced clipboard interaction
* in place annotations (I'd like to make this one better)
* automatic backups
* tramp
* everything else that I forgot

What's missing

Currently I am missing:
* Slime (I haven't used Lisp in quite a while, but I'd like to start using it again. Wait for my Clojure exploration)
* Better Python support. The default mode is very good. But I'd love to have more advanced stuff like Ropemacs.
* Bookmarks. A personal project I might add soon.
* Probably some stuff I'm forgetting


I very often get asked by firends for my .emacs file (or updates from older ones). So here's a way anyone can go and use my emacs configuration:
Go to github and get a copy of my emacs repo:

> git clone git:// ~/elisp
> ln -s ~/elisp/.emacs ~/.emacs

It doesn't go without a disclaimer: This is, and will always be, an incomplete project. Though it probably is portable, it is made for my personal use and there is no guarantee it will work in different non-linux setups.

Now, I'd love to make this even more portable and add different tools to it. So if anyone have a problem or suggestion I'd love to hear it. I would, of course, like it better if the suggestions come with a link to a fork of the project where the problems are fixed and I can just pull it ;)


So, Whats the emacs feature you like the most? Which one amazes you the most? anything you couldn't live without? What do you miss from other text editors when working in emacs?


[1] The folks at Mozilla labs have done a very nice contribution to the online editing world with Bespin. I hope they keep on the good work and turn to project into something emacs-like for the web.


  1. Hey Nicolas...
    great blog...
    I will contribute with some ideas from my .emacs

    * tabbar mode: the older I get, the "mouser" I get... and tabs on top to remind me of open buffers is great. Had to change the horrible default colors though...

    * uniquify: I have many buffers with the same name. I don't want to mess it up.

    * cedet/ecb: difficult to configure... helps a bit on my c++ programming. It is not eclipse. It will never be. They are different. Move on.

    * linum-mode: Programming is easier for me with a line number on the side... Needs latest emacs version (23)... BTW... it's just great how emacs got better when Stallman went away. I hate his chavist ass.

    * yasnipplet: huge time saver. templates. templates. templates! It took me some hours to create my own templates, but I have saved days with them

    I don't think there is anything else...
    Good emacs-ing!

  2. Thanks David,

    I've heard of yasnippet, but never get around to create the templates. Care to share? =)

    I'll check tabbar mode out. I'm still hooked on the keyboard, but I can give it a try.

    I laughed like hell at "I hate his chavist ass", hahaha, I hate all chavist asses; but yes, emacs 23 is an awesome improvement!

    I have some emacs related posts comming soon, so stay tuned =)

    (P.S.: It's wierd to speak in English with people you normally speak in spanish

  3. Hahha... yes I totally agree we sound stupid in English... or just plain snob...

    Well regarding yasnipplets, there are already a lot of templates ready-to-go... I personally like "once" "class" and so on for C++ programming...

    Python templates are even more interesting as they put docs and use some lisp programming behind the curtain