Saturday, March 23, 2013

Installing Emacs 24.3.1

Earlier I blogged about a little hurdle that I ran into when I was trying to install Emacs 24.1. Since Emacs 24.3.1 was released recently, I thought I would give it a spin.

After downloading the source code, I unzipped the source code and ran configure command. I got a similar error that I was getting before.

 checking for libXaw... configure: error: No X toolkit could be found.  
 If you are sure you want Emacs compiled without an X toolkit, pass  
 to configure. Otherwise, install the development libraries for the toolkit  
 that you want to use (e.g. Gtk+) and re-run configure.  

I am trying to install Emacs on Mint 14. So to satisfy all the dependencies, I installed the missing packages.
  sudo apt-get update   
  sudo apt-get install libgtk2.0-dev libtiff4-dev libgif-dev libpng12-dev libxpm-dev libncurses-dev libjpeg-dev libjpeg8-dev libjpeg-turbo8-dev   

After installing the dependencies, the usual three step process worked fine.
 sudo make install  

Hope this helps if you run into the same problem.

Wednesday, March 20, 2013

A late realization on embedding the code using gist

Off late I started using gist to embed source code in my blog entries. I was thinking about the consequences of doing this (or any form of embedding text using an external site). I realized the following:

  1. First and foremost the search engines don't get to index the page based on the key words in the embedded source code. For e.g. consider an embedded gist that demonstrates ServerSocket. Unless I mention about ServerSocket in my blog somewhere, the serarch engine will not associate the blog entry with the ServerSocket as that word appears only in the embedded source code.
  2. When peopele search for a specific key word in the embedded source code, they will be taken directly to the gist page, instead of the blog entry. This is bad because the user will not get the context and explanation around the source code.
To understand the depth of the problem, please search for alias-to-jumphosts-alist in Google. You will find that the gist is shown first and then the blog entry. Even in this case the blog entry is shown only because it mentions the function in it.

In future I should try to embed the source code in the blog itself and make use of a source code formatter like SyntaxHighligher.

Thursday, March 14, 2013

Using dirtrack-mode inside shell mode

I usually try to automate the things that I repeatedly perform. One the things that I recently automated was:
  • Create a directory with a prefix and today's date or time as suffix.
  • Chdir to the most recently created directory.
The source code for these utility functions is given below:

When I use these utility functions inside the Emacs' shell-mode, the shell-mode was unable to keep track of the current directory. The issue is that I am changing directories without making use of the cd command.

Then came the dirtrack-mode for the rescue. The idea is very simple: you specify the regular expression where the path appears in your shell prompt. The dirtrack-mode figures out the rest of the stuff.

Now my .emacs file contains the following two lines:

Thats it. Works like a charm. Please note that you might have to modify the regular expression to match where the full path appears in your prompt.