问题
The intuitive use for the orgmode option to export and view and odt file should be to view it in an libre/open office. However, I've so far had no luck in getting it to work; it always opens as a compressed archive in emacs. By inserting into my .emacs
(add-to-list 'org-file-apps '("\\.odt\\'" . "xdg-open %s"))
I open them properly when accessing links to files in org files, but it doesn't seem to effect the export-and-view option. I've looked into changing org-odt-export-as-odf-and-open
but have not been able to see it make a difference. Any help would be appreciated. Once again, I want org-odt-export-as-odf-and-open
to open the odf with xdg-open or libreoffice, not Emacs.
Thanks!
回答1:
The function you are calling is for exporting OpenDocument formulas (.odf
files), not OpenDocument text documents (.odt
files):
Export LaTeX fragment as OpenDocument formula and immediately open it. Use `org-odt-export-as-odf' to read LaTeX fragment and OpenDocument formula file.
Since the exported file doesn't have a .odt
extension your addition to org-file-apps
doesn't affect it.
I don't see any built-in function to export Org mode documents to LibreOffice Writer files and open them, but it is trivial to write:
(defun my-org-export-to-odt-and-open ()
(interactive)
(org-open-file (org-odt-export-to-odt)))
回答2:
EDIT A more graceful solution was given on the org-mode list that doesn't require editing any of your packaged org files. Simply add the following to your .emacs to rebind what 'system is doing:
(setcdr (assq 'system org-file-apps-defaults-gnu ) "xdg-open %s")
回答3:
I've tried the solution of WorldsEndless but it doesn't work for me, instead I use this variation
(setcdr (assq 'system org-file-apps-defaults-gnu ) '(call-process "xdg-open" nil 0 nil file))
来源:https://stackoverflow.com/questions/24434854/emacs-org-odt-export-as-odf-and-open-odt-outside-emacs