emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111749: Improve previous patch to al


From: Tassilo Horn
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111749: Improve previous patch to allow for multiple simultaneous ODF->PDF
Date: Tue, 12 Feb 2013 12:53:34 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111749
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Tue 2013-02-12 12:53:34 +0100
message:
  Improve previous patch to allow for multiple simultaneous ODF->PDF
  conversions.
modified:
  lisp/doc-view.el
=== modified file 'lisp/doc-view.el'
--- a/lisp/doc-view.el  2013-02-12 10:52:47 +0000
+++ b/lisp/doc-view.el  2013-02-12 11:53:34 +0000
@@ -939,22 +939,21 @@
   "Convert ODF to PDF asynchronously and call CALLBACK when finished.
 The converted PDF is put into the current cache directory, and it
 is named like ODF with the extension turned to pdf."
-  (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
-                         (list
-                          ;; FIXME: soffice doesn't work when there's
-                          ;; another running LibreOffice instance, in
-                          ;; which case it returns success without
-                          ;; actually doing anything.  See
-                          ;; LibreOffice bug
-                          ;; 
https://bugs.freedesktop.org/show_bug.cgi?id=37531.
-                          ;; A workaround is to start soffice with a
-                          ;; separate UserInstallation directory.
-                          (concat "-env:UserInstallation=file://"
-                                  (expand-file-name (format 
"libreoffice-docview%d" (user-uid))
-                                                    temporary-file-directory))
-                          "--headless" "--convert-to" "pdf"
-                          "--outdir" (doc-view-current-cache-dir) odf)
-                         callback))
+  ;; FIXME: soffice doesn't work when there's another running
+  ;; LibreOffice instance, in which case it returns success without
+  ;; actually doing anything.  See LibreOffice bug
+  ;; https://bugs.freedesktop.org/show_bug.cgi?id=37531.  A workaround
+  ;; is to start soffice with a separate UserInstallation directory.
+  (let ((tmp-user-install-dir (make-temp-file "libreoffice-docview" t)))
+    (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
+                           (list
+                            (concat "-env:UserInstallation=file://"
+                                    tmp-user-install-dir)
+                            "--headless" "--convert-to" "pdf"
+                            "--outdir" (doc-view-current-cache-dir) odf)
+                           (lambda ()
+                             (delete-directory tmp-user-install-dir t)
+                             (funcall callback)))))
 
 (defun doc-view-pdf/ps->png (pdf-ps png)
   ;; FIXME: Fix name and docstring to account for djvu&tiff.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]