10

Org-mode can export as HTML and open on a browser with C-c C-e h o (org-export-dispatch), but the problem is that the generated html file opens in a buffer inside emacs. There is no error in the message buffer, either. How can I make it work?

When I click a link inside org-mode, the browser opens correctly.

I'm running org-mode 8.2.10, emacs 24.3.1 on manjaro linux 0.8.10. I checked preferred applications in KDE and it points web browsing to firefox.

El Diego Efe
  • 1,601
  • 1
  • 19
  • 24

5 Answers5

5

I experienced the same problem after a new installation of ArchLinux with XFCE.

Although I didn't manage to understand the problem, a workaround was to configure 'org-file-apps' as described in the FAQ :

http://orgmode.org/worg/org-faq.html#external-application-launched-to-open-file-link

in my .emacs.d/init.el, I have now :

 '(org-file-apps
    (quote
      ((auto-mode . emacs)
      ("\\.mm\\'" . default)
      ("\\.x?html?\\'" . "/usr/bin/firefox %s")
      ("\\.pdf\\'" . default))))
skizo
  • 265
  • 2
  • 8
1
(setq browse-url-generic-program
      (cond
       ((eq window-system 'mac) "open") ; mac
       ((or (eq system-type 'gnu/linux) (eq system-type 'linux)) ; linux
        (executable-find "firefox"))
       ))
chen bin
  • 4,781
  • 18
  • 36
0
emacs --version 
GNU Emacs 25.1.1

It works for me:

(setq org-file-apps
    (quote
        ((auto-mode . emacs)
        ("\\.mm\\'" . default)
        ("\\.x?html?\\'" . "/usr/bin/firefox %s")
        ("\\.pdf\\'" . default))))

REF from answer of @skizo

Big Shield
  • 183
  • 6
0

As documented on Worg (and mentioned in other answers), org-mode usesorg-file-apps to determine how to open files. Moreover, org-file-apps can call emacs functions instead of specifying external applications. Especially for opening stuff in the web-browser, emacs ships with the browse-url package. This package provides a lot of functions to call a lot of different browsers (most of them are not really used anymore), and M-x customize-group Enter browse-url can help to give an overview. When browse-url is configured correctly, then the function browse-url will open a new browser (or a tab in an already running browser). This can be leveraged in org-file-apps:

(setq org-file-apps
    (quote
        (
          ("\\.x?html?\\'" . browse-url)
        )
    )
)

This configuration is more portable then specifying exact paths, and it also allows to have a different entry in the .mailcap, which org-mode normally uses if nothing is defined in org-file-apps.

Christian Herenz
  • 365
  • 2
  • 14
-1

I suspect that you have a mixed installation of org-mode. See the FAQ here:

http://orgmode.org/worg/org-faq.html#mixed-install

When this has happened to me what I have done is (assuming you install via ELPA):

  1. uninstall org-mode
  2. quit emacs
  3. restart emacs using emacs -q
  4. manually add ("org" . "http://orgmode.org/elpa/") to package-archives and run (package-initialize) `
  5. install org-mode
  6. restart emacs

Hope that helps.

Erik Hetzner
  • 765
  • 3
  • 6
  • It didn't work. I also erased my .emacs folder and started from scratch (like emacs -q, I guess), only installing org-mode (which appears to be today's version) as you suggest, and the file keeps opening in a buffer. `org-version` gives good result (as in your link). Bad luck. – El Diego Efe Oct 21 '14 at 01:36
  • Now, if I try @King suggestion: `org-export-as-html-and-open`, the answer is `No match`, so it seems that function is not well installed. – El Diego Efe Oct 21 '14 at 01:38
  • 2
    Export and open uses `org-open-file`, which uses the variable `org-file-apps`. Perhaps you have something strange in that variable. `org-export-as-html-and-open` is not a function in recent org mode versions. – Erik Hetzner Oct 21 '14 at 04:34