unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
       [not found] <E1U47Uj-0004Wk-3p@vcs.savannah.gnu.org>
@ 2013-02-09 14:26 ` Stefan Monnier
  2013-02-09 20:03   ` Glenn Morris
  2013-02-10 11:07   ` Tassilo Horn
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2013-02-09 14:26 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-devel

> committer: Tassilo Horn <tsdh@gnu.org>
> branch nick: trunk
> timestamp: Sat 2013-02-09 10:58:48 +0100
> message:
>   * doc-view.el: Use (and prefer) soffice as default ODF->PDF
>   converter (Bug#13622).  Patch provided by Jambunathan K
>   <kjambunathan@gmail.com>.
>   (doc-view-unoconv-program): Make obsolete variable.
>   (doc-view-odf->pdf-converter-program): New variable.
>   (doc-view-odf->pdf-converter-function): New variable.
>   (doc-view-mode-p): Use it.
>   (doc-view-odf->pdf-converter-unoconv): Rename from
>   `doc-view-odf->pdf-converter-unoconv'.
>   (doc-view-odf->pdf-converter-soffice): New function.
>   (doc-view-convert-current-doc): Use
>   `doc-view-odf->pdf-converter-function'.
> modified:
>   lisp/ChangeLog
>   lisp/doc-view.el

> === modified file 'lisp/ChangeLog'
> --- a/lisp/ChangeLog	2013-02-09 05:52:20 +0000
> +++ b/lisp/ChangeLog	2013-02-09 09:58:48 +0000
> @@ -1,3 +1,18 @@
> +2013-02-09  Tassilo Horn  <tsdh@gnu.org>
> +
> +	* doc-view.el: Use (and prefer) soffice as default ODF->PDF
> +	converter (Bug#13622).  Patch provided by Jambunathan K
> +	<kjambunathan@gmail.com>.
> +	(doc-view-unoconv-program): Make obsolete variable.
> +	(doc-view-odf->pdf-converter-program): New variable.
> +	(doc-view-odf->pdf-converter-function): New variable.
> +	(doc-view-mode-p): Use it.
> +	(doc-view-odf->pdf-converter-unoconv): Rename from
> +	`doc-view-odf->pdf-converter-unoconv'.
> +	(doc-view-odf->pdf-converter-soffice): New function.
> +	(doc-view-convert-current-doc): Use
> +	`doc-view-odf->pdf-converter-function'.

This change log is wrong, since it says you're the author.
It should instead start with

    2013-02-09  Jambunathan K  <kjambunathan@gmail.com>

This said, I have another question: assuming both soffice and unoconv
are installed.  Which of the two is preferable and why (e.g. faster or
gives better output)?


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-09 14:26 ` [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF Stefan Monnier
@ 2013-02-09 20:03   ` Glenn Morris
  2013-02-10  0:26     ` Glenn Morris
  2013-02-10 11:07   ` Tassilo Horn
  1 sibling, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2013-02-09 20:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Tassilo Horn

Stefan Monnier wrote:

> This said, I have another question: assuming both soffice and unoconv
> are installed.  Which of the two is preferable and why (e.g. faster or
> gives better output)?

IIUC, unoconv depends on soffice and is a small utility whose sole
purpose is to convert file formats. So if someone has installed it, they
probably want to use it for that.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-09 20:03   ` Glenn Morris
@ 2013-02-10  0:26     ` Glenn Morris
  2013-02-10  8:57       ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2013-02-10  0:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Tassilo Horn, emacs-devel

Glenn Morris wrote:

> IIUC, unoconv depends on soffice and is a small utility whose sole
> purpose is to convert file formats. So if someone has installed it, they
> probably want to use it for that.

PS I think it's impossible to have unoconv without soffice, so this
change amounts to "always use soffice".



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-10  0:26     ` Glenn Morris
@ 2013-02-10  8:57       ` Bastien
  2013-02-10 20:51         ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-02-10  8:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel, Stefan Monnier, Tassilo Horn

Glenn Morris <rgm@gnu.org> writes:

> Glenn Morris wrote:
>
>> IIUC, unoconv depends on soffice and is a small utility whose sole
>> purpose is to convert file formats. So if someone has installed it, they
>> probably want to use it for that.
>
> PS I think it's impossible to have unoconv without soffice, so this
> change amounts to "always use soffice".

I'm not sure I get the logic here: you need to have soffice installed
if you want to use unoconv, but being able to use unoconv instead of
soffice is good.  So as I understand it, the change does not amount
to "always use soffice", does it?

-- 
 Bastien



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-09 14:26 ` [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF Stefan Monnier
  2013-02-09 20:03   ` Glenn Morris
@ 2013-02-10 11:07   ` Tassilo Horn
  1 sibling, 0 replies; 10+ messages in thread
From: Tassilo Horn @ 2013-02-10 11:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +	* doc-view.el: Use (and prefer) soffice as default ODF->PDF
>> +	converter (Bug#13622).  Patch provided by Jambunathan K
>> +	<kjambunathan@gmail.com>.
>
> This change log is wrong, since it says you're the author.
> It should instead start with
>
>     2013-02-09  Jambunathan K  <kjambunathan@gmail.com>

Thanks for fixing that.

> This said, I have another question: assuming both soffice and unoconv
> are installed.  Which of the two is preferable and why (e.g. faster or
> gives better output)?

Both use the same Libreoffice internal conversion facilities, so their
output and speed are the same.  The only difference is that soffice is
part of every LibreOffice installation whereas unoconv is some external
utility that probably almost nobody has installed.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-10  8:57       ` Bastien
@ 2013-02-10 20:51         ` Glenn Morris
  2013-02-11  3:36           ` Jambunathan K
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2013-02-10 20:51 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-devel, Stefan Monnier, Tassilo Horn

Bastien wrote:

>> PS I think it's impossible to have unoconv without soffice, so this
>> change amounts to "always use soffice".
>
> I'm not sure I get the logic here: you need to have soffice installed
> if you want to use unoconv, but being able to use unoconv instead of
> soffice is good.  So as I understand it, the change does not amount
> to "always use soffice", does it?

(cond
   ((executable-find "soffice") "soffice")
   ((executable-find "unoconv") "unoconv")
   (t "soffice"))

It is impossible for this to return anything but "soffice".
IMO it should be:

(or (executable-find "unoconv") "soffice")



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-10 20:51         ` Glenn Morris
@ 2013-02-11  3:36           ` Jambunathan K
  2013-02-11  4:40             ` Stephen J. Turnbull
  0 siblings, 1 reply; 10+ messages in thread
From: Jambunathan K @ 2013-02-11  3:36 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Bastien, Tassilo Horn, Stefan Monnier, emacs-devel

Glenn Morris <rgm@gnu.org> writes:

> Bastien wrote:
>
>>> PS I think it's impossible to have unoconv without soffice, so this
>>> change amounts to "always use soffice".
>>
>> I'm not sure I get the logic here: you need to have soffice installed
>> if you want to use unoconv, but being able to use unoconv instead of
>> soffice is good.  So as I understand it, the change does not amount
>> to "always use soffice", does it?
>
> (cond
>    ((executable-find "soffice") "soffice")
>    ((executable-find "unoconv") "unoconv")
>    (t "soffice"))
>
> It is impossible for this to return anything but "soffice".
> IMO it should be:
>
> (or (executable-find "unoconv") "soffice")

I didn't put deliberate thought in what the order should be.

My patch WILL require tweaks on a case-by-case basis. My immediate focus
was to get the functionality in.  I invite people with commit access to
fix "minor issues" without much ado.

soffice comes from libreoffice-common
    ,----
    | kjambunathan@debian-6:~$ dpkg -S /usr/bin/soffice
    | libreoffice-common: /usr/bin/soffice
    `----

unoconv does NOT depend on libreoffice-common
    ,----
    | kjambunathan@debian-6:~$ apt-rdepends unoconv | grep libre
    | Reading package lists... Done
    | Building dependency tree       
    | Reading state information... Done
    |   Depends: libreadline6 (>= 6.0)
    | libreadline6
    `----

unoconv instread depends on openoffice.org packages
    ,----
    | kjambunathan@debian-6:~$ apt-rdepends unoconv | grep office
    | Reading package lists... Done
    | Building dependency tree       
    | Reading state information... Done
    |   Depends: openoffice.org-core (= 1:3.2.1-11+squeeze7)
    | openoffice.org-core
    |   Depends: openoffice.org-common (>> 1:3.2.1)
    | openoffice.org-common
    |   Depends: openoffice.org-style
    |   Depends: openoffice.org-style-default
    | openoffice.org-style
    | openoffice.org-style-default
    `----

I see an soffice.sh in /etc/openoffice/soffice.sh

    ,----
    | kjambunathan@debian-6:~$ dpkg -L openoffice.org-common
    | /etc
    | /etc/bash_completion.d
    | /etc/bash_completion.d/ooffice.sh
    | /etc/openoffice
    | /etc/openoffice/sofficerc
    | /etc/openoffice/psprint.conf
    | /etc/openoffice/soffice.sh
    | kjambunathan@debian-6:~$ 
    `----




>
>

-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-11  3:36           ` Jambunathan K
@ 2013-02-11  4:40             ` Stephen J. Turnbull
  2013-02-12  9:59               ` Tassilo Horn
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen J. Turnbull @ 2013-02-11  4:40 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Bastien, emacs-devel, Stefan Monnier, Tassilo Horn

From the unoconv home page:

    Requirements
    unoconv is written in python. It needs a recent LibreOffice or
    OpenOffice with UNO bindings.

For what it's worth, Jambunathan K writes:

 > unoconv does NOT depend on libreoffice-common

Always cross-check what a package manager tells you for this kind of
information.  Package managers have completely different model of the
world from humans.

 > >> I'm not sure I get the logic here: you need to have soffice
 > >> installed if you want to use unoconv, but being able to use
 > >> unoconv instead of soffice is good.

That's true for the *user* at the command line, but for Emacs it
depends on how unoconv is being used.  If the UI provides a Swiss Army
knife able to convert any given format to any other by delegating the
format grokking to unoconv, yes, it's sort of good, assuming that
Emacs will never pass incorrect arguments to unoconv.[1]  In that case
unoconv (and any other "universal converters") should be tried only
after specific converters that do a better job are tried.[2]

If in fact what happens is that Emacs parses the formats and only
handles formats that it recognizes, unoconv is useless to Emacs.  (I
suspect this is rarely what most users want[3], but I prefer it.  If
Emacs can't do a good job automatically, it should leave it up to me!)

Footnotes: 
[1]  It's OK if Emacs passes arguments that unoconv *can't* convert;
what I'm referring to here is a situation where unoconv could convert
if given certain information that Emacs does know in the correct
format, but because Emacs's "generic" invocation of unoconv either
fails to provide the information, or fails to invoke the command with
correct syntax, the command fails.

[2]  There may be none.  Seems unlikely to me though, given how
horribly unreliable even Microsoft Office software is for producing
high-quality output across platforms.

[3]  IME most users will accept any garbage that comes out as long as
a program has generated it because they're happy to blame the program
if somebody bitches about poor quality.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-11  4:40             ` Stephen J. Turnbull
@ 2013-02-12  9:59               ` Tassilo Horn
  2013-02-12 11:58                 ` Tassilo Horn
  0 siblings, 1 reply; 10+ messages in thread
From: Tassilo Horn @ 2013-02-12  9:59 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Bastien, Jambunathan K, Stefan Monnier, emacs-devel

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

>  > >> I'm not sure I get the logic here: you need to have soffice
>  > >> installed if you want to use unoconv, but being able to use
>  > >> unoconv instead of soffice is good.
>
> That's true for the *user* at the command line, but for Emacs it
> depends on how unoconv is being used.  If the UI provides a Swiss Army
> knife able to convert any given format to any other by delegating the
> format grokking to unoconv, yes, it's sort of good, assuming that
> Emacs will never pass incorrect arguments to unoconv.[1] In that case
> unoconv (and any other "universal converters") should be tried only
> after specific converters that do a better job are tried.[2]
>
> If in fact what happens is that Emacs parses the formats and only
> handles formats that it recognizes, unoconv is useless to Emacs.  (I
> suspect this is rarely what most users want[3], but I prefer it.  If
> Emacs can't do a good job automatically, it should leave it up to me!)

Ok, to clear up the situation a bit: unoconv is probably more powerful
than soffice.  For example, it is possible to run it as a server that
accepts conversion requests from multiple clients.  doc-view doesn't
need that.

doc-view just uses either unoconv or soffice to convert OpenDocument or
Microsoft Office documents to PDF.  Both tools can do that just fine,
and they use the same LibreOffice/OpenOffice internal APIs for the job.

I've converted some example documents with both of them, and the output
is almost identical: identically displayed, identical with respect to
file size of the generated PDF, but diff says they differ nonetheless.

However, soffice is appoximately 2.5 to 7 times faster.  It seems that
unoconv has some significant startup overhead compared to soffice.  I
hadn't expected that, but in the end it justifies that soffice is picked
up by default when both soffice and unoconv are installed on a system.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF
  2013-02-12  9:59               ` Tassilo Horn
@ 2013-02-12 11:58                 ` Tassilo Horn
  0 siblings, 0 replies; 10+ messages in thread
From: Tassilo Horn @ 2013-02-12 11:58 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Bastien, Jambunathan K, Stefan Monnier, emacs-devel

Tassilo Horn <tsdh@gnu.org> writes:

> Ok, to clear up the situation a bit: unoconv is probably more powerful
> than soffice.  For example, it is possible to run it as a server that
> accepts conversion requests from multiple clients.  doc-view doesn't
> need that.
>
> doc-view just uses either unoconv or soffice to convert OpenDocument
> or Microsoft Office documents to PDF.  Both tools can do that just
> fine, ...

Now I've found a more serious issue with soffice.  It doesn't work when
there's already a running LibreOffice instance.  In that case, it simply
finishes successfully without doing anything.  That's already reported
as a bug:

    https://bugs.freedesktop.org/show_bug.cgi?id=37531

Reading that report, it doesn't seem likely to be fixed anytime soon,
and even then it'll take time until the buggy versions won't be used
anymore.

Fortunately, there's also a workaround.  By default, LibreOffice use the
directory ~/.config/libreoffice/<major-version>/ for storing
customizations, scripts, settings, etc.  This can be overridden using
the undocumented -env:UserInstallation option, and when using separate
UserInstallation directories per invocation, it works just fine.

I've just committed a change that adds the option

    -env:UserInstallation=file:///tmp/libreoffice-docview<tmp-suffix>

to the options passed to soffice.  This seems to add about 0.5 seconds
to the ODF->PDF conversion time, but that's still much faster than
unoconv.

These temporary directories are deleted immediately after the conversion
has finished in order not to clutter the filesystem with lots of 1.7MB
dirs.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-02-12 11:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1U47Uj-0004Wk-3p@vcs.savannah.gnu.org>
2013-02-09 14:26 ` [Emacs-diffs] /srv/bzr/emacs/trunk r111707: * doc-view.el: Use (and prefer) soffice as default ODF->PDF Stefan Monnier
2013-02-09 20:03   ` Glenn Morris
2013-02-10  0:26     ` Glenn Morris
2013-02-10  8:57       ` Bastien
2013-02-10 20:51         ` Glenn Morris
2013-02-11  3:36           ` Jambunathan K
2013-02-11  4:40             ` Stephen J. Turnbull
2013-02-12  9:59               ` Tassilo Horn
2013-02-12 11:58                 ` Tassilo Horn
2013-02-10 11:07   ` Tassilo Horn

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).