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.

7
  • Have you tried C-c C-e b? Oct 20, 2014 at 20:57
  • There is no option b after C-c C-e. It gives Invalid key Oct 20, 2014 at 21:05
  • I apologize. How aboutM-x org-export-as-html-and-open? Oct 20, 2014 at 21:15
  • The message after that command is: org-html-do-expand: Symbol's value as variable is void: org-export-html-special-string-regexps Oct 20, 2014 at 21:20
  • Okay, that is really weird. The last thing I can tell you to try is: C-c C-e h h But, I am not 100% sure that will work. Oct 20, 2014 at 21:25

5 Answers 5

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))))
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"))
       ))
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

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.

-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.

3
  • 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. Oct 21, 2014 at 1: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. Oct 21, 2014 at 1: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. Oct 21, 2014 at 4:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.