4

I'm working under org-mode.

When I click on a [http://example.com] link, it opens a tab in Firefox as expected. The .emacs config is: '(browse-url-browser-function (quote browse-url-firefox))

However, for links in the form file:///localdir/myfile.html it depicts the message running /usr/bin/sensible-browser and starts Opera.

Why would emacs do that? Why does it not use Firefox or defaults to my system default browser?

Quora Feans
  • 515
  • 3
  • 11

3 Answers3

4

Well, in a sense sensible-browser is a system default browser:-)

I believe that you need to use the update-alternatives system to set that system default.

As to why Org mode is using sensible-browser instead of the browse-URL functionality, I suspect it's because for file URLs it tries to be clever.

Bob Uhl
  • 146
  • 3
2

/usr/bin/sensible-browser is a shell script. /usr/bin/gnome-www-browser has a high priority.

File sensible-browser:

if test -n "$DISPLAY"; then
    if test -n "$GNOME_DESKTOP_SESSION_ID"; then
        if test -x /usr/bin/gnome-www-browser; then
          ....
        elif test -x /usr/bin/x-www-browser; then
           ....
        elif test -x /usr/bin/gnome-terminal && test -x /usr/bin/www-browser; 
           ......

So you can use

sudo update-alternatives --config gnome-www-browser 

or

sudo update-alternatives --config x-www-browser 

to select the default browser that org mode uses.

Drew
  • 75,699
  • 9
  • 109
  • 225
hohosd44
  • 21
  • 2
1

There are lots of good reasons why it might not be useful to open a given file: URL in a web browser, so org has a distinct mechanism for handling them and deciding what to do with them.

M-x customize-option RET org-file-apps RET

But in practice, Bob Uhl's answer is probably what you want? If Firefox is your preferred browser, then you should probably have it set as your system default, rather than customizing multiple independent Emacs settings to override the system default in the same way. (Caveat: I don't know how sensible-browser makes its decision, so the situation might not be as simplistic as I've assumed.)

phils
  • 48,657
  • 3
  • 76
  • 115