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:28:01 +0100

OK, I'm running Emacs 26 now, and it the xdg-open is indeed solved as per #25778.

Still one rough edge left:  if xdg-open is missing but BROWSER is set,
Emacs will not run the browser configured by the user but the first one
it found in the list.

I think the patch I suggested above would be good enough, or maybe even better:

	(defun browse-url-default-browser (url &rest args)
	...
	  (apply
	   (cond
	   ...
	+   ((and (getenv "BROWSER") (executable-find (getenv "BROWSER")))
  +    (executable-find (getenv "BROWSER")))
	    ((memq system-type '(windows-nt ms-dos cygwin))
	     'browse-url-default-windows-browser)