From: Jambunathan K <kjambunathan@gmail.com>
To: 13622@debbugs.gnu.org
Subject: bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter
Date: Mon, 04 Feb 2013 00:31:47 +0530 [thread overview]
Message-ID: <87ip69b4ro.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 50 bytes --]
I am attaching a patch. Please apply to trunk.
[-- Attachment #2: doc-view.diff --]
[-- Type: text/plain, Size: 3626 bytes --]
=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el 2013-01-24 03:34:20 +0000
+++ lisp/doc-view.el 2013-02-03 18:47:45 +0000
@@ -231,14 +231,36 @@ If this and `doc-view-dvipdfm-program' a
:type 'file
:group 'doc-view)
-(defcustom doc-view-unoconv-program "unoconv"
+(define-obsolete-variable-alias 'doc-view-unoconv-program
+ 'doc-view-odf->pdf-converter-program
+ "24.4")
+
+(defcustom doc-view-odf->pdf-converter-program
+ (cond
+ ((executable-find "soffice") "soffice")
+ ((executable-find "unoconv") "unoconv"))
"Program to convert any file type readable by OpenOffice.org to PDF.
Needed for viewing OpenOffice.org (and MS Office) files."
- :version "24.1"
+ :version "24.4"
:type 'file
:group 'doc-view)
+(defcustom doc-view-odf->pdf-converter-function
+ (cond
+ ((string-match "unoconv\\'" doc-view-odf->pdf-converter-program)
+ #'doc-view-odf->pdf-converter-unoconv)
+ ((string-match "soffice\\'" doc-view-odf->pdf-converter-program)
+ #'doc-view-odf->pdf-converter-soffice))
+ "Function to call to convert a ODF file into a PDF file."
+ :type '(radio
+ (function-item doc-view-odf->pdf-converter-unoconv
+ :doc "Use unoconv")
+ (function-item doc-view-odf->pdf-converter-soffice
+ :doc "Use LibreOffice")
+ function)
+ :version "24.4")
+
(defcustom doc-view-ps2pdf-program "ps2pdf"
"Program to convert PS files to PDF.
@@ -700,8 +722,8 @@ OpenDocument format)."
(and doc-view-ghostscript-program
(executable-find doc-view-ghostscript-program)))
((eq type 'odf)
- (and doc-view-unoconv-program
- (executable-find doc-view-unoconv-program)
+ (and doc-view-odf->pdf-converter-program
+ (executable-find doc-view-odf->pdf-converter-program)
(doc-view-mode-p 'pdf)))
((eq type 'djvu)
(executable-find "ddjvu"))
@@ -903,14 +925,23 @@ If PAGE is nil, convert the whole docume
,@(if page `(,(format "%d" page))))
callback))
-(defun doc-view-odf->pdf (odf callback)
+(defun doc-view-odf->pdf-converter-unoconv (odf callback)
"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-unoconv-program
+ (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
(list "-f" "pdf" "-o" (doc-view-current-cache-dir) odf)
callback))
+(defun doc-view-odf->pdf-converter-soffice (odf callback)
+ "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 "--headless" "--convert-to" "pdf"
+ "--outdir" (doc-view-current-cache-dir) odf)
+ callback))
+
(defun doc-view-pdf/ps->png (pdf-ps png)
;; FIXME: Fix name and docstring to account for djvu&tiff.
"Convert PDF-PS to PNG asynchronously."
@@ -1058,7 +1089,7 @@ Those files are saved in the directory g
;; The unoconv tool only supports an output directory, but no
;; file name. It's named like the input file with the
;; extension replaced by pdf.
- (doc-view-odf->pdf doc-view-buffer-file-name
+ (funcall doc-view-odf->pdf-converter-function doc-view-buffer-file-name
(lambda ()
;; Rename to doc.pdf
(rename-file opdf pdf)
[-- Attachment #3: Type: text/plain, Size: 299 bytes --]
In GNU Emacs 24.3.50.8 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2013-02-02 on debian-6.05
Bzr revision: 111663 eliz@gnu.org-20130202171424-zeijhu9wq1tstzt0
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description: Debian GNU/Linux 6.0.5 (squeeze)
next reply other threads:[~2013-02-03 19:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-03 19:01 Jambunathan K [this message]
2013-02-05 8:04 ` bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter Glenn Morris
2013-02-05 10:53 ` Jambunathan K
2013-02-05 11:50 ` Jambunathan K
2013-02-09 5:29 ` Chong Yidong
2013-02-09 10:03 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ip69b4ro.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=13622@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.