Dealing With The Thing At Point

A few weeks ago I mentioned that Sacha Chua is tremendously organized and gave an example of that organization. That example was about how she automated organizing tasks based on her calendar. Now she provides us with another example.

This time, she provides a shortcut for dealing with the thing at point. Someone asked her for a way of either opening the URL at point or searching for the word or region if the point wasn’t on a URL. Chua, of course, not only ran with that but expanded it to be even more useful. She presents code that deals with whatever the point is on in the following way:

  • Unless there is an active region, assume that the thing at point is a URL, word, an email address, or a filename. If it is a region, just add the text for processing as below
  • If there are links, open them
  • If there are email addresses open an email compose buffer with those addresses populating the “TO:” header
  • If it’s a filename, open it
  • Otherwise do a Web search on the word or text from the region

Chua also describes some nice customizations. You can specify what function to call for searching. This is more than just picking your browser of choice. See Chua’s post for the details. This can even be fine grained. You might want to use different “browsing functions” depending on what kind of link it is. Again, see the post for details.

There’s not really enough code involved to make it into a package but if you’re interested, it would be easy to just add Chua’s code to your init.el.

This entry was posted in General and tagged . Bookmark the permalink.