From unknown Sat Sep 13 13:15:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Feb 2013 19:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13622@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.135991819332598 (code B ref -1); Sun, 03 Feb 2013 19:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Feb 2013 19:03:13 +0000 Received: from localhost ([127.0.0.1]:34554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U24qO-0008Ti-Ey for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:03:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58345) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U24qM-0008TZ-DP for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:03:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U24pM-0006lI-K2 for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:02:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:45954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24pM-0006lE-GV for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:02:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24pK-00085c-U5 for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:02:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U24pJ-0006ks-Eh for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:02:06 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:38309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24pJ-0006kc-5r for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:02:05 -0500 Received: by mail-pa0-f50.google.com with SMTP id fa11so393273pad.23 for ; Sun, 03 Feb 2013 11:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:mime-version :content-type; bh=YFx3eiAcY/6acw8QMD5p7liOQVYDrALOQJS3X+v7eys=; b=c1bOoGeVapn9SeB+09+LlPEyv4F4uxvASSjQzqkyACXPGm2sxRV2HFV+zaxjv1aI3x yqGgSUs7UoF/aZZnS5G4UnVw+PS3UKck2xXeB9Zv3xhDqsIR5tgYXYWQllfCzVai50Rv rItEJuvILBPON/n+f1hAeYj8LzKjldy0TomviCKq0Aohqx/dlcEIL7ue++V7rpU4IeKy FyULZpjOG0qrrQ4gUPGRHUtUsv3k9oA6/PRbGSmV6yo8vPP4Q5gddnsDUBxszyA8mWX4 HSkGIfbJBfGz/Vw6H9P4sLsZHrz2+3hFtpscNEvLiiyZtXhg+ecGaOZFJ7/2P1M+gklh Fx1Q== X-Received: by 10.66.78.1 with SMTP id x1mr46021848paw.2.1359918123931; Sun, 03 Feb 2013 11:02:03 -0800 (PST) Received: from debian-6.05 ([115.242.158.117]) by mx.google.com with ESMTPS id wh4sm15390224pbc.18.2013.02.03.11.02.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 03 Feb 2013 11:02:02 -0800 (PST) From: Jambunathan K Date: Mon, 04 Feb 2013 00:31:47 +0530 Message-ID: <87ip69b4ro.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --=-=-= Content-Type: text/plain I am attaching a patch. Please apply to trunk. --=-=-= Content-Type: text/plain Content-Disposition: inline Content-Description: doc-view.diff === 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) --=-=-= Content-Type: text/plain 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) --=-=-=-- From unknown Sat Sep 13 13:15:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Feb 2013 08:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jambunathan K Cc: 13622@debbugs.gnu.org Received: via spool by 13622-submit@debbugs.gnu.org id=B13622.136005152531680 (code B ref 13622); Tue, 05 Feb 2013 08:06:01 +0000 Received: (at 13622) by debbugs.gnu.org; 5 Feb 2013 08:05:25 +0000 Received: from localhost ([127.0.0.1]:36958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U2dWu-0008Eu-Di for submit@debbugs.gnu.org; Tue, 05 Feb 2013 03:05:24 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:50396) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U2dWs-0008Eo-R7 for 13622@debbugs.gnu.org; Tue, 05 Feb 2013 03:05:23 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U2dVl-0003Nu-4Z; Tue, 05 Feb 2013 03:04:13 -0500 From: Glenn Morris References: <87ip69b4ro.fsf@gmail.com> X-Spook: Delta Force S Key UOP Hamas Croatian AUTODIN Kh-11 freedom X-Ran: UHraP$1^"PA@d]m$V/7?~?o9R!-$Ge2Y54X5ufQXivyh]W9Xxy?)a{p8.R+JjX3Q|]YQVP X-Hue: cyan X-Attribution: GM Date: Tue, 05 Feb 2013 03:04:13 -0500 In-Reply-To: <87ip69b4ro.fsf@gmail.com> (Jambunathan K.'s message of "Mon, 04 Feb 2013 00:31:47 +0530") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) Jambunathan K wrote: > I am attaching a patch. Please apply to trunk. Some explanation as to why would be nice. > +(defcustom doc-view-odf->pdf-converter-program > + (cond > + ((executable-find "soffice") "soffice") > + ((executable-find "unoconv") "unoconv")) This could end up being nil, which would give a type mismatch with 'file. > :type 'file > > +(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") Why do you need this, as opposed to a single function which calls -program with a customizable -program-options argument? From unknown Sat Sep 13 13:15:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Feb 2013 10:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 13622@debbugs.gnu.org Received: via spool by 13622-submit@debbugs.gnu.org id=B13622.136006173414362 (code B ref 13622); Tue, 05 Feb 2013 10:56:01 +0000 Received: (at 13622) by debbugs.gnu.org; 5 Feb 2013 10:55:34 +0000 Received: from localhost ([127.0.0.1]:37170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U2gBa-0003ja-0v for submit@debbugs.gnu.org; Tue, 05 Feb 2013 05:55:34 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:42781) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U2gBY-0003jR-Hv for 13622@debbugs.gnu.org; Tue, 05 Feb 2013 05:55:33 -0500 Received: by mail-pa0-f44.google.com with SMTP id kp1so73233pab.31 for <13622@debbugs.gnu.org>; Tue, 05 Feb 2013 02:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=O9XVfSAqsqkt/P+UZfxKP18uIdjvmM9qSAPMT0AZ7tU=; b=uz9lQkg1Wul1Dc/qA6bGb0q0OJ+7pPI8mVnapxBZw9meTV6HjElze5b55u/aDdMX/q jk9eshVl4ImKhJoFn7RK6xkCYsDAfR+edZMcpt6+gjQPdeJA/cjEXRAQMTD84tvN/3jq KkLbz9zfcX2WdYzdZY83Ckjkws9PkPuW3XNIRby8Xg9xq5kWqbA17b2YO0qiUoyZJ1fx B6XZzq23kftN46yuJDD3dzfcvQPl2g15B7Zbr2hjGp9aTff6Wf4wv4fZ4L3oSS278+us VnDq+EajULLlaAS23Q19E+vYxWLWRufcyfJMET5ntsiYijnybESDabjgjmLFlgMAUD4n KPTg== X-Received: by 10.66.83.6 with SMTP id m6mr63121626pay.52.1360061661609; Tue, 05 Feb 2013 02:54:21 -0800 (PST) Received: from debian-6.05 ([101.63.225.166]) by mx.google.com with ESMTPS id t7sm24935341pax.17.2013.02.05.02.54.18 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 05 Feb 2013 02:54:20 -0800 (PST) From: Jambunathan K References: <87ip69b4ro.fsf@gmail.com> Date: Tue, 05 Feb 2013 16:23:56 +0530 In-Reply-To: (Glenn Morris's message of "Tue, 05 Feb 2013 03:04:13 -0500") Message-ID: <874nhr820r.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Glenn Morris writes: > Jambunathan K wrote: > >> I am attaching a patch. Please apply to trunk. > > Some explanation as to why would be nice. One is likely to have LibreOffice installed rather than unoconv. Getting unoconv on non-Linux platforms could be cumbersome. > >> +(defcustom doc-view-odf->pdf-converter-program >> + (cond >> + ((executable-find "soffice") "soffice") >> + ((executable-find "unoconv") "unoconv")) > > This could end up being nil, which would give a type mismatch with 'file. > >> :type 'file What would you suggest? Use `choice'? >> >> +(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") > > Why do you need this, as opposed to a single function which calls > -program with a customizable -program-options argument? I am mimicing what is done for recent mupdf changes. ,---- | (defcustom doc-view-pdf->png-converter-function | (if (executable-find doc-view-pdfdraw-program) | #'doc-view-pdf->png-converter-mupdf | #'doc-view-pdf->png-converter-ghostscript) | "Function to call to convert a PDF file into a PNG file." | :type '(radio | (function-item doc-view-pdf->png-converter-ghostscript | :doc "Use ghostscript") | (function-item doc-view-pdf->png-converter-mupdf | :doc "Use mupdf") | function) | :version "24.4") `---- From unknown Sat Sep 13 13:15:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Feb 2013 11:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 13622@debbugs.gnu.org Received: via spool by 13622-submit@debbugs.gnu.org id=B13622.136006515419942 (code B ref 13622); Tue, 05 Feb 2013 11:53:01 +0000 Received: (at 13622) by debbugs.gnu.org; 5 Feb 2013 11:52:34 +0000 Received: from localhost ([127.0.0.1]:37242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U2h4j-0005Ba-IV for submit@debbugs.gnu.org; Tue, 05 Feb 2013 06:52:34 -0500 Received: from mail-da0-f52.google.com ([209.85.210.52]:63694) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U2h4h-0005BR-Sw for 13622@debbugs.gnu.org; Tue, 05 Feb 2013 06:52:32 -0500 Received: by mail-da0-f52.google.com with SMTP id f10so20298dak.25 for <13622@debbugs.gnu.org>; Tue, 05 Feb 2013 03:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=CXlRKiT2v0I8Avhw305lu1Lyx0RW29OZmCEibV/tqto=; b=RQfG1QXVYw3EH5m3VePuZ++gsg9EL+zPnxHsGrZaew08FkNUgR2XPpIE2WO33QRrnj qZQ/YQO6bXnC1km18X9uB8mHm4lDX3JlLJruPx/o8AFre3XsajMaDi0uxIZsKaTTRVGr GzJIzzXjzPPURQ3wNF6GrKrPRq2swUeh1tdVCK4fEH5C3OR8XvAQK+eteDvITtEo/+SZ m0ZszMfF2mo+pQXJsP7rlkNKcrUMx8z/SYgK+JufYwnVTdXBFjcjJBJ4WMe9xII+51il QdoBSO5sbvD0uFKTiso+oyvBocXkbSlLiuLVT9MWlmHReYCsV2TumK+za6nvaiqUzlfb mOhw== X-Received: by 10.66.85.73 with SMTP id f9mr63600950paz.13.1360065078876; Tue, 05 Feb 2013 03:51:18 -0800 (PST) Received: from debian-6.05 ([101.63.225.166]) by mx.google.com with ESMTPS id bi2sm28839373pab.18.2013.02.05.03.51.14 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 05 Feb 2013 03:51:16 -0800 (PST) From: Jambunathan K References: <87ip69b4ro.fsf@gmail.com> Date: Tue, 05 Feb 2013 17:20:57 +0530 In-Reply-To: (Glenn Morris's message of "Tue, 05 Feb 2013 03:04:13 -0500") Message-ID: <878v73j7xa.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Glenn I am interested in patch sailing through in whatever form that suits maintainers. Crux of the patch is in how soffice needs to be used. Rest all are fillers, that a reviewer can easily workaround. Feel free to modify the patch in a way that is acceptable to you. Jambunathan K. From unknown Sat Sep 13 13:15:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter References: <87ip69b4ro.fsf@gmail.com> In-Reply-To: <87ip69b4ro.fsf@gmail.com> Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Feb 2013 05:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tassilo Horn Cc: 13622@debbugs.gnu.org, Jambunathan K Received: via spool by 13622-submit@debbugs.gnu.org id=B13622.13603877834555 (code B ref 13622); Sat, 09 Feb 2013 05:30:02 +0000 Received: (at 13622) by debbugs.gnu.org; 9 Feb 2013 05:29:43 +0000 Received: from localhost ([127.0.0.1]:45341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U430R-0001BQ-4E for submit@debbugs.gnu.org; Sat, 09 Feb 2013 00:29:43 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:64353) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U430P-0001BJ-4R for 13622@debbugs.gnu.org; Sat, 09 Feb 2013 00:29:41 -0500 Received: by mail-pb0-f41.google.com with SMTP id um15so38608pbc.14 for <13622@debbugs.gnu.org>; Fri, 08 Feb 2013 21:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:mime-version :content-type; bh=mGf+owKb/yd+hx6yMShvy9TXtxDqO3x4RnsuNfBoymc=; b=c/KQrao9mtHYGRhumJ2XW8AoMeV0IrKdg1xCt8cJOosOWecS7H4SkC76/OmGI5iFb1 WHhQrh1DOraT2tUyPKbR2K3zyH2ewIHoPb1LuBtE0Ma51gYXAAtNJgIHLuP4eJ6SMWHN RQJVQ8tbO/pEvzHel4bJjlyBJ6tdbMyQ8/esPKvEikeFnWFHXOKcfSW20F5QP75krGRD 0P82Lu4odsF7xI7sQFCyqv95HV7kqvRT50G0pe7kbe00rZFL9Yu/eTP7sHdjvNZUnnVo vWlw7M328/UVD+a7WmAibu0AJ9N7Z1KxwJemq3GLJJFbdGKmvRlesKbGp1yrXaYGNqeC 5Lzg== X-Received: by 10.68.223.68 with SMTP id qs4mr1162768pbc.149.1360387773492; Fri, 08 Feb 2013 21:29:33 -0800 (PST) Received: from tsparkle (cm126.delta178.maxonline.com.sg. [59.189.178.126]) by mx.google.com with ESMTPS id bi2sm59440827pab.18.2013.02.08.21.29.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 08 Feb 2013 21:29:32 -0800 (PST) From: Chong Yidong Date: Sat, 09 Feb 2013 13:29:31 +0800 Message-ID: <87bobut5qc.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Tassilo, Could you please review the changes suggested by Jambunathan K (and go ahead and apply them if you agree)? Thanks. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13622 From unknown Sat Sep 13 13:15:27 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jambunathan K Subject: bug#13622: closed (Re: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter) Message-ID: References: <87y5exerdj.fsf@thinkpad.tsdh.de> <87ip69b4ro.fsf@gmail.com> X-Gnu-PR-Message: they-closed 13622 X-Gnu-PR-Package: emacs Reply-To: 13622@debbugs.gnu.org Date: Sat, 09 Feb 2013 10:04:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1360404243-29171-1" This is a multi-part message in MIME format... ------------=_1360404243-29171-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13622: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF con= verter which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13622@debbugs.gnu.org. --=20 13622: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13622 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1360404243-29171-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13622-done) by debbugs.gnu.org; 9 Feb 2013 10:03:34 +0000 Received: from localhost ([127.0.0.1]:45612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U47HR-0007Zl-JT for submit@debbugs.gnu.org; Sat, 09 Feb 2013 05:03:33 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56037) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U47HP-0007Zc-8D for 13622-done@debbugs.gnu.org; Sat, 09 Feb 2013 05:03:31 -0500 Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id F1FA220A08; Sat, 9 Feb 2013 05:03:22 -0500 (EST) Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute5.internal (MEProxy); Sat, 09 Feb 2013 05:03:22 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:references:date :in-reply-to:message-id:mime-version:content-type; s=smtpout; bh=zaWAy+C26syp46UgaovF+gvuFEk=; b=OONnuJE9jQgp+CZ8pTmxGPxck+cQ pscd+bZRNZzMmWKvW9lv9DyhBmAGMgXDbMS/2+OE5bTNG/5bfMtqzsX7g8VjOKSH K9LUp33vaI/IRDAx9GLb9vrChCLxgoHvxmDpTrNK7VWeHa5o7W6BdzhmT7aZsQ5z iWJ7UIoHe5s5k9I= X-Sasl-enc: mvhUdWzSy6fbws7kkgwoa8jlWpIJeHyLDNLP14fkqTZZ 1360404202 Received: from thinkpad.tsdh.de (unknown [91.67.10.84]) by mail.messagingengine.com (Postfix) with ESMTPA id 347358E0961; Sat, 9 Feb 2013 05:03:22 -0500 (EST) From: Tassilo Horn To: Chong Yidong Subject: Re: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter References: <87bobut5qc.fsf@gnu.org> Date: Sat, 09 Feb 2013 11:03:20 +0100 In-Reply-To: <87bobut5qc.fsf@gnu.org> (Chong Yidong's message of "Sat, 09 Feb 2013 13:29:31 +0800") Message-ID: <87y5exerdj.fsf@thinkpad.tsdh.de> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13622-done Cc: Jambunathan K , 13622-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.5 (/) Chong Yidong writes: Hi Chong, > Could you please review the changes suggested by Jambunathan K (and go > ahead and apply them if you agree)? Thanks. > > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13622 Thanks for notifying. Oh, I didn't know soffice up to now. That's a great change as it removes the (optional) dependency to unoconv which probably nobody has installed anyway. I've committed the patch with some minor modification. Thanks, Jambunathan! Bye, Tassilo ------------=_1360404243-29171-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 3 Feb 2013 19:03:13 +0000 Received: from localhost ([127.0.0.1]:34554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U24qO-0008Ti-Ey for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:03:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58345) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U24qM-0008TZ-DP for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:03:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U24pM-0006lI-K2 for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:02:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:45954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24pM-0006lE-GV for submit@debbugs.gnu.org; Sun, 03 Feb 2013 14:02:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24pK-00085c-U5 for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:02:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U24pJ-0006ks-Eh for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:02:06 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:38309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24pJ-0006kc-5r for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:02:05 -0500 Received: by mail-pa0-f50.google.com with SMTP id fa11so393273pad.23 for ; Sun, 03 Feb 2013 11:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:mime-version :content-type; bh=YFx3eiAcY/6acw8QMD5p7liOQVYDrALOQJS3X+v7eys=; b=c1bOoGeVapn9SeB+09+LlPEyv4F4uxvASSjQzqkyACXPGm2sxRV2HFV+zaxjv1aI3x yqGgSUs7UoF/aZZnS5G4UnVw+PS3UKck2xXeB9Zv3xhDqsIR5tgYXYWQllfCzVai50Rv rItEJuvILBPON/n+f1hAeYj8LzKjldy0TomviCKq0Aohqx/dlcEIL7ue++V7rpU4IeKy FyULZpjOG0qrrQ4gUPGRHUtUsv3k9oA6/PRbGSmV6yo8vPP4Q5gddnsDUBxszyA8mWX4 HSkGIfbJBfGz/Vw6H9P4sLsZHrz2+3hFtpscNEvLiiyZtXhg+ecGaOZFJ7/2P1M+gklh Fx1Q== X-Received: by 10.66.78.1 with SMTP id x1mr46021848paw.2.1359918123931; Sun, 03 Feb 2013 11:02:03 -0800 (PST) Received: from debian-6.05 ([115.242.158.117]) by mx.google.com with ESMTPS id wh4sm15390224pbc.18.2013.02.03.11.02.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 03 Feb 2013 11:02:02 -0800 (PST) From: Jambunathan K To: bug-gnu-emacs@gnu.org Subject: 24.3.50; doc-view: Use (and prefer) soffice as default ODF->PDF converter Date: Mon, 04 Feb 2013 00:31:47 +0530 Message-ID: <87ip69b4ro.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --=-=-= Content-Type: text/plain I am attaching a patch. Please apply to trunk. --=-=-= Content-Type: text/plain Content-Disposition: inline Content-Description: doc-view.diff === 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) --=-=-= Content-Type: text/plain 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) --=-=-=-- ------------=_1360404243-29171-1--