fixed bug in linking urls.

the regexp approach was too hard to get right, especially urls at the end of a sentence. This reuses code in Emacs, even though it is a little clunky to me.
changed function link