forked from mirrors/org-mode
org-odt.el: Make LibreOffice the default converter
* lisp/org-lparse.el (org-lparse-do-convert): Replace `call-process' with `shell-command-to-string'. * lisp/org-odt.el (org-export-odt-convert-processes): Add a new converter which depends solely on LibreOffice and nothing else. (org-export-odt-convert-process): Make the above native converter the default. Thanks to Giles for introducing the "--convert-to" option of soffice.exe. The option seems to be a fairly recent development. http://imperfectsoftware.blogspot.in/2012/01/one-of-my-less-enjoyable-tasks-is-to.html With this change, one can export to pdf via odt by a simple (setq org-export-odt-preferred-output-format "pdf") There is no need to install additional converters.
This commit is contained in:
parent
e30e13b8c7
commit
9b820def5b
|
@ -493,28 +493,29 @@ This is a helper routine for interactive use."
|
|||
(out-dir (file-name-directory in-file))
|
||||
(arglist (mapcar (lambda (arg)
|
||||
(format-spec
|
||||
arg `((?i . ,in-file)
|
||||
arg `((?i . ,(shell-quote-argument in-file))
|
||||
(?I . ,(browse-url-file-url in-file))
|
||||
(?f . ,out-fmt)
|
||||
(?o . ,out-file)
|
||||
(?O . ,(browse-url-file-url out-file))
|
||||
(?d . ,out-dir)
|
||||
(?d . , (shell-quote-argument out-dir))
|
||||
(?D . ,(browse-url-file-url out-dir)))))
|
||||
(cdr convert-process))))
|
||||
convert-process))
|
||||
(cmd (mapconcat 'identity arglist " ")))
|
||||
(when (file-exists-p out-file)
|
||||
(delete-file out-file))
|
||||
|
||||
(message "Executing %s %s" program (mapconcat 'identity arglist " "))
|
||||
(apply 'call-process program nil nil nil arglist)
|
||||
(message "Executing %s" cmd)
|
||||
(let ((cmd-output (shell-command-to-string cmd)))
|
||||
(message "%s" cmd-output))
|
||||
|
||||
(cond
|
||||
((file-exists-p out-file)
|
||||
(message "Exported to %s using %s" out-file program)
|
||||
(when prefix-arg
|
||||
(message "Opening %s..." out-file)
|
||||
(org-open-file out-file))
|
||||
out-file
|
||||
;; (set-buffer (find-file-noselect out-file))
|
||||
)
|
||||
out-file)
|
||||
(t
|
||||
(message "Export to %s failed" out-file)
|
||||
nil))))
|
||||
|
|
|
@ -2402,8 +2402,10 @@ visually."
|
|||
(replace-match ""))))
|
||||
|
||||
(defcustom org-export-odt-convert-processes
|
||||
'(("BasicODConverter"
|
||||
("soffice" "-norestore" "-invisible" "-headless"
|
||||
'(("LibreOffice"
|
||||
("soffice" "--headless" "--convert-to %f" "--outdir %d" "%i"))
|
||||
("BasicODConverter"
|
||||
("soffice" "--headless"
|
||||
"\"macro:///BasicODConverter.Main.Convert(%I,%f,%O)\""))
|
||||
("unoconv"
|
||||
("unoconv" "-f" "%f" "-o" "%d" "%i")))
|
||||
|
@ -2436,7 +2438,7 @@ they are interpreted as below:
|
|||
:value-type (group (cons (string :tag "Executable")
|
||||
(repeat (string :tag "Command line args")))))))
|
||||
|
||||
(defcustom org-export-odt-convert-process nil
|
||||
(defcustom org-export-odt-convert-process "LibreOffice"
|
||||
"Use this converter to convert from \"odt\" format to other formats.
|
||||
During customization, the list of converter names are populated
|
||||
from `org-export-odt-convert-processes'."
|
||||
|
|
Loading…
Reference in a new issue