Friday, February 5, 2010

Learning Emacs Part 1

As I mentioned in my last post, January and February were to be devoted to getting to know Emacs better.

After reading "Tip 22: Use a Single Editor Well. Choose an editor, know it thoroughly, and use it for all editing tasks" in The Pragmatic Programmer: From Journeyman to Master, I decided that I would go ahead with Emacs because I have used it some in the past and it would be available in both Linux and Windows, so I really could use it for all of my editing tasks. Also, I am a supporter of GNU and the FSF, so I figured I would give Emacs the first shot at being my all-purpose editor.

The first thing I learned about Emacs is that there is most likely nothing you can't do in Emacs! The second thing I learned is that with great power comes great complexity. Using Emacs is not something that I would call intuitive or even user friendly. I also don't think that it was designed to be so. It is really the single most powerful tool I have ever come across in my computing career.

Since I was using Ubuntu 9.04, the installation couldn't have been easier. I went to the terminal and typed:
sudo apt-get install emacs23
After the download/installation completed, I just typed (also in the terminal) :
This brought up the main screen for Emacs. Installation successful! I also wanted to have it available to me for when I had to boot to my Windows partition as well, so I rebooted and began the download for Windows. After I downloaded the .zip file, I unpacked it and in the /bin directory is emacs.exe.

Using Emacs
When you first load Emacs and are greeted with the main screen, there are two links. The first is the Emacs Tutorial and the second is the guided tour. I went through the tutorial and learned quite a few keyboard shortcuts. I really enjoy not having to take my hands off of the keyboard in order to use a mouse to move around. The most useful shortcut is M-f and M-b (M stands for the ALT key, so M-f means hold down the ALT key while pressing f). This moves the cursor either forward (f) one word or backward (b) one word. I have been using Emacs now for just over a month and I can tell you that I now hate all editors that don't do this!!! In fact, I installed Emacs on my work machine as well (Windows based, unfortunately). I can no longer bare to use a mouse or hold down the arrow keys just to move a cursor around!

I will admit that I still find myself looking at the refcard for certain key combinations and that the learning curve is steep, I have already noticed a significant increase in productivity. I just recently discovered Org-mode (M-x org-mode). Which lets you do all sorts of amazing things and gives me more reasons to use Emacs. I have also started looking into Emcaspeak, which apparently lets you tweet from Emacs on top of other things. There is also a Blogger add-on that will let me write and post my posts from Emacs! Hopefully my next post will be written in and posted through Emacs.