Intelligent browse-url11 Oct 2014, by Artur Malabarba.
When you have more than one browser installed, you must choose which one's the default. The OS will then proceed to open all URLs in the default browser, even if it happens to be closed while another one happens to be running.
At least in Emacs we can fix that behavior. The following code configures Emacs to use whatever browser happens to be open right now, instead of always defaulting to the same one.
Here we configure our preferences through the endless/browser-list variable. Its value is a list of cons cells, each representing a browser. The car is a regexp to match the name of the browser's process (used to determine whether the browser is running), and the cdr is the name of the executable.
And this is the function responsible for checking the running processes and finding a browser in there.
I've tested it on Windows and a couple of Linux distros. Could a Mac user test it for me as well?