Thursday, August 14, 2008

In Praise Of The Google Search AJAX API

In Praise Of The Google AJAX Search API

Emacspeak has always provided Google Search with a single keystroke from anywhere on the audio desktop. But with the coming of the Google AJAX Search API it becomes possible to integrate Google Search at a far deeper level into your fingertips! The AJAX API demonstrates the true speed of Google Search, since you dont need to wait for an HTML page to download and render --- results are served as a light-weight JSON data structure.

What You Can Now Do

Module gsearch (part of the g-client package) provides an interactive command gsearch-google-at-point --- I have this bound to key hyper-/ in Emacs. Executing this command from anywhere inside Emacs does the following:

  • Grabs word under point, and prompts in the minibuffer for a search-term --- with the word we just grabbed as the default.
  • Fetches other relevant search terms in the background via Google Suggest, and makes these available via Emacs' minibuffer history mechanism. Use keys M-n and M-p to cycle through these if needed.
  • Hitting ENTER performs a Google Search using the AJAX API, and displays the title and content snippet for the first search result.
  • Executing command gsearch-google-at-point subsequently at the same location opens the first search result.

Search And Enjoy!