Sunday, February 5, 2012

Still working on taming Emacs

I find that I often get tripped up by little things when it comes to programming. For example, I was going through that haml tutorial I posted about a couple of days ago, and I wondered exactly how Rails would know to use the haml file instead of the old erb file. After all, I'd already installed the gem and listed it in the Gemfile.

It turns out I didn't have to do anything else. I could have just renamed the .erb file to use a .haml extension. Luckily this didn't take long to figure out, but I've got a history of overlooking things like this that should be fairly obvious.

haml itself is easy enough to understand. Take those dirty div tags for example!

<div class="content">AWESOME CONTENT</div>


Is magically transformed into

.content AWESOME CONTENT


EDIT: Corrected this information, thanks to Joel. In haml, a . signifies a class, whereas a # signifies an id.

There's more to haml than this, but it's an abstraction of XHTML which makes writing code easier and less tedious. I was thinking of taking the time to do a more in-depth tutorial for haml, but instead I'm going to incorporate it into this Twitter Bootstrap for Rails 3.1 tutorial series my buddy Joel sent my way.

I hope you guys like reading about Twitter Bootstrap, because that's absolutely what I'll be blogging about this week.

I've also made some progress with Emacs, and no longer feel lost when trying to do basic things like open recent files. I've definitely got some work to do before I feel really comfortable coding with Emacs, but I don't think it'll take long to get the basics down. I went through the notes I made at Fort Behavior last week and threw them into a .txt file, so I'll just have that open when using Emacs until I don't need it.