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.bugs Subject: 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__26513.1629807458$1416054750$gmane$org@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: 8bit X-Trace: ger.gmane.org 1416054750 10981 80.91.229.3 (15 Nov 2014 12:32:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 12:32:30 +0000 (UTC) Cc: dbh@doc.ic.ac.uk, 18986-done@debbugs.gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 15 13:32:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1XpcWb-0008Ov-JW for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 13:32:21 +0100 Original-Received: from localhost ([::1]:40047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpcWb-0000aP-7U for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 07:32:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpcWR-0000Tv-Ak for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 07:32:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpcWI-0000XK-PL for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 07:32:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpcWI-0000Wy-NC for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 07:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpcWI-0002KP-6W for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 07:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: florian@fsavigny.de (Florian v. Savigny) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Nov 2014 12:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18986 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug wontfix Original-Received: via spool by 18986-done@debbugs.gnu.org id=D18986.14160547058927 (code D ref 18986); Sat, 15 Nov 2014 12:32:02 +0000 Original-Received: (at 18986-done) by debbugs.gnu.org; 15 Nov 2014 12:31:45 +0000 Original-Received: from localhost ([127.0.0.1]:33307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpcW0-0002Ju-D7 for submit@debbugs.gnu.org; Sat, 15 Nov 2014 07:31:44 -0500 Original-Received: from srv4.ns-domain-hosting.de ([178.63.89.203]:52635) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpcVx-0002Jl-V2 for 18986-done@debbugs.gnu.org; Sat, 15 Nov 2014 07:31:43 -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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96057 > From: Stefan Monnier > Date: Sat, 08 Nov 2014 13:05:54 -0500 > > 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, -- Florian von Savigny Melanchthonstr. 41 33615 Bielefeld