RRC|BIOSTATISTICS

Pretty Emacs

One of the toughest things about starting as a new programmer is the learning curve for implementing the most basic things.

Want to see if your new FORTRAN module functions like it should? Just run it. Yup! Just compile it! (Hint: Try gfortran file.f90 -o file.exe). Or even, “Initialize it!” Or my personal favorite, “Just add it to your .emacs file.” My what now? My colleague wrote an excellent introduction to customizing your .emacs file from a newbie’s perspective. Yet when it came to following the very instructions in his post, nothing worked for me. Turns out I was using an old version of Emacs (which you can check in your buffer with M-x emacs-version) on my work station.

Update your emacs

I tried the standard way to update my emacs, with sudo apt-get install emacs24. I was greeted with the error message Could not locate emacs24. Seriously? Here’s the straightforward way: Just friggen download it I know its the Ubuntu Software Center. Don’t worry, its not cheating – you’re still the “hacker” you’ve always wanted to be. Its just not worth the headache.

Get yourself an awesome theme

You can either try Marmalade for all your Elisp-related goodness, or good old Github for a theme of your choice. Or you can save yourself the trouble, type M-x load-theme, hit Enter, then Tab and choose something reliable like “Tango”. If you still want a unique theme, then download a zipfile from Github or Marmalade. The Download Zip button is on the far right hand column with a cloud icon on it. Unzip it directly from the command line into your .emacs.d directory with unzip zenburn-emacs-master.zip -d ~/.emacs.d. Extract the .el file with the mv command. Set up a folder for all the color themes you’re ever going to download with mkdir color-theme while you’re in the .emacs.d folder, then mv zenburn.el ~/.emacs/color-theme. Magically, your .el file is in the right place.

Adding to your .emacs file

Open up your .emacs file with the command emacs .emacs. Add the lines:

1
2
(add-to-list 'custom-theme-load-path "~/.emacs.d/color-theme")  
(load-theme 'monokai t)

Notice that there is no forward slash in the load-path, and that the apostrophes really do count. Check if it works by entering the command M-x load-file After hitting return, then enter .emacs. This load-file will refresh your Emacs from the .emacs file and tell you if something went wrong. For me, the color-theme loaded, and I was filled with joy. Truely. Its the smallest victories that count in grad school.

An Aside.
I discovered that Jason Blevins created the Fortran Wiki, a resource I’ve used quite heavily. He also created a Mersenne Twister in C++ (I used the .f90 version here), and some very intimidating-looking themes for your emacs should the average user pass you by. He even went so far as to create a handy dandy Emacs F90-Mode reference guide. Very exciting! By all means read the Wiki and happily ignore Fortran’s ranking on Hammer Principle.

Comments