Ads by Google

Saturday, July 4, 2009

Quickly looking up words in Google through Emacs

Here is a post by Joe Fineman that outlines how to quickly look up something in Emacs.  You need to have w3m installed for it to work.  And it is indeed easier than switching to the browser and looking it up.

(defun google (what)
"Use google to search for WHAT."
(interactive "sSearch: ")
(save-window-excursion
(delete-other-windows)
(let ((dir default-directory))
(w3m-browse-url (concat "http://www.google.com/search?q="
(w3m-url-encode-string what)))
(cd dir)
(recursive-edit))))

(global-set-key "\C-Cg" 'google)