From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.bugs 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 Message-ID: <87ip69b4ro.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1359918185 6960 80.91.229.3 (3 Feb 2013 19:03:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Feb 2013 19:03:05 +0000 (UTC) To: 13622@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 03 20:03:25 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U24qb-000734-4D for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Feb 2013 20:03:25 +0100 Original-Received: from localhost ([::1]:36378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24qI-00087w-P8 for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Feb 2013 14:03:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24qF-000870-EI for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:03:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U24qE-00079M-2E for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:03:03 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U24qD-00079G-TP for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:03:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U24rC-0008Ul-5O for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2013 14:04:02 -0500 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135991819332598 (code B ref -1); Sun, 03 Feb 2013 19:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Feb 2013 19:03:13 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70653 Archived-At: --=-=-= 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) --=-=-=--