Nicolas Martyanoff has a really interesting post on Controlling link opening in Emacs. One of the things I like about Org mode is that you can put the point on a URL, type Ctrl+c Ctrl+o and Org will follow the link. You can also use Meta+o to choose any visible link in the buffer in an Avy-like way.
Sadly, this behavior is specific to Org and not implemented in other modes. Some modes do have a way of following links but there’s no standard method. But this is Emacs so Martyanoff decided to fix that.
It’s not as hard as you might think because all the methods end up calling browse-url
so mostly what you have to do is set things up for the particular mode you’re in and call browse-url
. Martyanoff shows how to do this for several modes as well as providing a way to choose between EWW and Firefox. He has several Firefox profiles so his code also provides a way to choose which profile to use for a given link.
He’s got all the code in his post so head other there if you’re interested. Even if you’re not interested in replicating his code, it’s worth remembering that you can always just put the point on the URL and call browse-url-at-point
directly.