From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: florian@fsavigny.de (Florian v. Savigny) Newsgroups: gmane.emacs.devel Subject: Re: bug#18986: Design bug in browse-url.el: browse-url-can-use-xdg-open's logic uses overly strict assumption Date: Sat, 15 Nov 2014 13:31:39 +0100 Message-ID: <87egt4k5lg.fsf@bertrandrussell.Speedport_W_723V_1_36_000> References: <85lhnnw9t7.fsf@bertrandrussell.Speedport_W_723V_1_36_000> NNTP-Posting-Host: plane.gmane.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1416054736 10874 80.91.229.3 (15 Nov 2014 12:32:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 12:32:16 +0000 (UTC) Cc: dbh@doc.ic.ac.uk, jan.h.d@swipnet.se, 18986-done@debbugs.gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 15 13:32:09 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XpcWN-0008IW-7S for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2014 13:32:07 +0100 Original-Received: from localhost ([::1]:40045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpcWM-0000Ac-Sd for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2014 07:32:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpcW4-0000AL-U6 for emacs-devel@gnu.org; Sat, 15 Nov 2014 07:31:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpcVy-0000UE-S8 for emacs-devel@gnu.org; Sat, 15 Nov 2014 07:31:48 -0500 Original-Received: from srv4.ns-domain-hosting.de ([178.63.89.203]:52879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpcVy-0000U0-Ie for emacs-devel@gnu.org; Sat, 15 Nov 2014 07:31:42 -0500 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Original-Received: from bertrandrussell.Speedport_W_723V_1_36_000 (p548BE8C7.dip0.t-ipconnect.de [84.139.232.199]) by srv4.ns-domain-hosting.de (Postfix) with ESMTPSA id 566DD186420; Sat, 15 Nov 2014 13:31:41 +0100 (CET) In-reply-to: (message from Stefan Monnier on Sat, 08 Nov 2014 13:05:54 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 178.63.89.203 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:177174 Archived-At: > From: Stefan Monnier > Date: Sat, 08 Nov 2014 13:05:54 -0500 >=20 > The problem was specifically that just having xdg-open installed > doesn't guarantee that the user has configured it. The code > currently approximates "is it configured" by checking the desktop > environment in use. It's clearly a gross hack (or a crude > approximation), so if you know a better way, we'd like to hear it. Thank you very much for your feedback! It would seem to me that checking if xdg-mime query default text/html or, in a more general way, perhaps xdg-mime query default `xdg-mime query filetype URL/FILE` returns SOMETHING should be sufficient. I am absolutely NOT sure, I have to admit, because I have found the documentation for the xdg system not very accessible if you are interested in manual configuration, and lack the time to study it hard. I have found that what the above command returns is not necessarily what xdg-open will actually run (i.e. it does not seem to reflect user reconfiguration - which is probably why the query is called "default"), but it would seem to me that if it returns SOMETHING, there is a guarantee that there is a default, which in turn guarantees that xdg-open will start SOMETHING. This line of thought assumes that /usr/share/applications/*.desktop files for any given application will ONLY be there if the application itself is also installed, i.e. that they both come with the same package. I think that this is the case for any distribution I have used so far. Even if this assumption is unsafe, I think one could check if the return value of xdg-open is 3 or 4, which could then lead to a message such as "Please configure your xdg system properly; see man xdg-mime or your desktop environment's configuration tool" and/or to some fallback action (which browse-url is already capable of). Of course, this last measure could not be implemented within the browse-url-can-use-xdg-open function. An alternative approach (which would however not be mutually exclusive with the above) might be to make the hardcoded browser list in browse-url-default-browser customisable, which currently forces an order of preference on the user as follows: browse-url-gnome-moz-program browse-url-mozilla-program browse-url-firefox-program browse-url-chromium-program browse-url-galeon-program browse-url-kde-program browse-url-netscape-program browse-url-mosaic-program browse-url-xterm-program The reason why I am somehow uncomfortable with browse-url's logic of determining a browser to start is that I find it effectively (if most probably not intentionally) patronising, and this is, in my view, unusual for Emacs - out of character, as it were. I would like to apologise if my suggestions are not sufficiently substantial. Best regards, --=20 Florian von Savigny Melanchthonstr. 41 33615 Bielefeld