On IRC, someone asked for help configuring Emacs
to have a keyboard shortcut that would either open
the URL at point or search the web for the region
or the word at point. I thought this was a great
idea that I would find pretty handy too.
Let's write the interactive function that
I'll call from my keyboard shortcut.
First, let's check if there's an active region.
If there isn't, let's assume we're looking at
the thing at point (could be a URL, an e-mail
address, a filename, or a word).
If there are links, open them.
Otherwise, if there are e-mail addresses,
compose a message with all those email addresses
in the "To" header.
Are we at a filename? Let's open that.
Otherwise, do a web search. Let's make that
configurable. Most people will want to use a web
browser to search their favo…
( 3
min )