all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: florian@fsavigny.de (Florian v. Savigny)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: dbh@doc.ic.ac.uk, jan.h.d@swipnet.se, 18986-done@debbugs.gnu.org,
	emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87egt4k5lg.fsf@bertrandrussell.Speedport_W_723V_1_36_000> (raw)
In-Reply-To: <jwva941k1rm.fsf-monnier+emacsbugs@gnu.org> (message from Stefan Monnier on Sat, 08 Nov 2014 13:05:54 -0500)




  > From: Stefan Monnier <monnier@iro.umontreal.ca>
  > 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



  parent reply	other threads:[~2014-11-15 12:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07 11:04 Design bug in browse-url.el: browse-url-can-use-xdg-open's logic uses overly strict assumption Florian v. Savigny
2014-11-08 17:19 ` bug#18986: " Jan D.
2014-11-08 18:05   ` Stefan Monnier
2014-11-15 12:31     ` Florian v. Savigny
2014-11-15 12:31     ` Florian v. Savigny [this message]
2014-11-08 17:19 ` Jan D.
2018-02-12 16:23 ` bug#18986: #18986 " Pierre Neidhardt
2018-02-12 17:47   ` Eli Zaretskii
2018-02-12 17:51     ` Pierre Neidhardt
2018-02-12 18:42       ` Eli Zaretskii
2018-02-14 21:46         ` Pierre Neidhardt
2018-02-15  2:14           ` Noam Postavsky
2018-02-16  0:28             ` Pierre Neidhardt
2018-02-16  0:42               ` Pierre Neidhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87egt4k5lg.fsf@bertrandrussell.Speedport_W_723V_1_36_000 \
    --to=florian@fsavigny.de \
    --cc=18986-done@debbugs.gnu.org \
    --cc=dbh@doc.ic.ac.uk \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.