diff options
| author | Tassilo Horn | 2013-02-12 12:53:34 +0100 |
|---|---|---|
| committer | Tassilo Horn | 2013-02-12 12:53:34 +0100 |
| commit | 957a6f2652fc543c58d74aca237041cd6e0fe2fa (patch) | |
| tree | 551814371313ec31f1330c3ff5a13c26408f7160 | |
| parent | 283c7aed6e9418730d2f997021e2b2640f45dca7 (diff) | |
| download | emacs-957a6f2652fc543c58d74aca237041cd6e0fe2fa.tar.gz emacs-957a6f2652fc543c58d74aca237041cd6e0fe2fa.zip | |
Improve previous patch to allow for multiple simultaneous ODF->PDF
conversions.
| -rw-r--r-- | lisp/doc-view.el | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index da0b728ce91..dcc28a52322 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -939,22 +939,21 @@ is named like ODF with the extension turned to pdf." | |||
| 939 | "Convert ODF to PDF asynchronously and call CALLBACK when finished. | 939 | "Convert ODF to PDF asynchronously and call CALLBACK when finished. |
| 940 | The converted PDF is put into the current cache directory, and it | 940 | The converted PDF is put into the current cache directory, and it |
| 941 | is named like ODF with the extension turned to pdf." | 941 | is named like ODF with the extension turned to pdf." |
| 942 | (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program | 942 | ;; FIXME: soffice doesn't work when there's another running |
| 943 | (list | 943 | ;; LibreOffice instance, in which case it returns success without |
| 944 | ;; FIXME: soffice doesn't work when there's | 944 | ;; actually doing anything. See LibreOffice bug |
| 945 | ;; another running LibreOffice instance, in | 945 | ;; https://bugs.freedesktop.org/show_bug.cgi?id=37531. A workaround |
| 946 | ;; which case it returns success without | 946 | ;; is to start soffice with a separate UserInstallation directory. |
| 947 | ;; actually doing anything. See | 947 | (let ((tmp-user-install-dir (make-temp-file "libreoffice-docview" t))) |
| 948 | ;; LibreOffice bug | 948 | (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program |
| 949 | ;; https://bugs.freedesktop.org/show_bug.cgi?id=37531. | 949 | (list |
| 950 | ;; A workaround is to start soffice with a | 950 | (concat "-env:UserInstallation=file://" |
| 951 | ;; separate UserInstallation directory. | 951 | tmp-user-install-dir) |
| 952 | (concat "-env:UserInstallation=file://" | 952 | "--headless" "--convert-to" "pdf" |
| 953 | (expand-file-name (format "libreoffice-docview%d" (user-uid)) | 953 | "--outdir" (doc-view-current-cache-dir) odf) |
| 954 | temporary-file-directory)) | 954 | (lambda () |
| 955 | "--headless" "--convert-to" "pdf" | 955 | (delete-directory tmp-user-install-dir t) |
| 956 | "--outdir" (doc-view-current-cache-dir) odf) | 956 | (funcall callback))))) |
| 957 | callback)) | ||
| 958 | 957 | ||
| 959 | (defun doc-view-pdf/ps->png (pdf-ps png) | 958 | (defun doc-view-pdf/ps->png (pdf-ps png) |
| 960 | ;; FIXME: Fix name and docstring to account for djvu&tiff. | 959 | ;; FIXME: Fix name and docstring to account for djvu&tiff. |