Subject: bug#18986: #18986 Design bug in browse-url.el: browse-url-can-use-xdg-open's logic uses overly strict assumption

From: Pierre Neidhardt <[email-masked]>
Date: Fri, 16 Feb 2018 01:42:03 +0100

Actually the design issue is a bit deeper than that: As of now (even
with my suggested change) there is no proper way of retrieving the
browser name.

This can be problematic especially when it comes to managing processes
and frames (e.g. with EXWM).

So I suggest the following refactoring:

- Remove `browse-url-generic'.

- `browse-url-browser-function' should return a browser name (the function
might need a new name).

- `browse-url-default-browser' should obey the change and return a browser
name, with the first check being on `browse-url-generic-program`, second
check on the environment variable, third check on xdg-open, and the rest
as usual.

Everything gets simple, both the code and the user configuration, plus
it's more flexible.