Shortens URLs via the bitly.com API (details). If the region is active, `bitly-shorten’ will replace the region with the shortened URL. When there is no active region but `thing-at-point’ finds an URL at the current point, that URL will be shortened. If there is neither an active region nor an URL at the current point, the user will be prompted for an URL that will be shortened and replace the URL at point.
When called `bitly-shorten’ will ask bitly.com to shorten the URL and immediately return. When Bitly returns the shortened URL, it will be put in the buffer at the correct location.
If you bind `bitly-shorten’ to a keybinding or mouse-binding, you can rapidly replace URLs in a buffer without needing to wait for each URL to be shortened.
In the event that there is an error obtaining the shortened URL, the buffer will be left unmodified and you will receive an error.
The elisp file, bitly.el was originally located at http://www.emacswiki.org/emacs/bitly.el (or http://bit.ly/xV9oK5) and referenced by this emacswiki page. After discussions with Vivek, the original author, I am taking over maintenance for the file.
- <2012-05-24 Thu 18:02> Added URL escaping so URLs with funky characters work.
- <2012-03-03 Sat 18:57> Updated to support asynchronous calling of bitly and default URL from the region or `thing-at-point’ if there is no active region.
- <2012-02-29 Wed 19:29> Original version from http://www.emacswiki.org/emacs/bitly.el.