Wouldn’t it be cool to be able to invoke a Google search from the comfort of your beloved text editor? Here’s a couple of use-cases. You may wish to Google the selected region or to be prompted to enter a query manually. Apart from cool it’s also pretty simple to add such a feature to Emacs.
(defun er-google () "Google the selected region if any, display a query prompt otherwise." (interactive) (browse-url (concat "http://www.google.com/search?ie=utf-8&oe=utf-8&q=" (url-hexify-string (if mark-active (buffer-substring (region-beginning) (region-end)) (read-string "Google: "))))))
This command will display the query results in your default browser.
I’d suggest binding the command to
C-c g if you plan to use it regularly.
(global-set-key (kbd "C-c g") #'er-google)
er-google is available in
Prelude (but with a