GNU bug report logs - #13164
[PATCH] View DjVu documents through doc-view-mode

Previous Next

Package: emacs;

Reported by: Elias Pipping <pipping <at> lavabit.com>

Date: Wed, 12 Dec 2012 22:54:02 UTC

Severity: wishlist

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13164 in the body.
You can then email your comments to 13164 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Message #1 received at quiet <at> debbugs.gnu.org (full text, mbox):

From: Elias Pipping <pipping <at> lavabit.com>
To: quiet <at> debbugs.gnu.org
Subject: [PATCH] View DjVu documents through doc-view-mode
Date: Sun, 02 Sep 2012 13:27:14 +0200
[Message part 1 (text/plain, inline)]
Package: emacs
Severity: wishlist

[resent from
http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00029.html ]

Hello,

I sent a patch to this list last year that made it possible to use
mupdf's "mudraw" instead of ghostscript's "gs" to convert pdf documents
into png files within doc-view-mode.

I've since been testing that patch and never looked back since the
switch sped up the pdf->png conversion by a factor of two and brought
anti-aliasing with it. 

In a similar fashion, I've now added support for DjVu->Tiff conversion
to doc-view-mode through djvulibre. While djvulibre's "ddjvu" has always
allowed for such conversion, I only yesterday requested[1] the necessary
feature of creating one tiff file per page, which was immediately
implemented (Mr. Bottou, if you're reading this, thanks again!).

Consequently, to have the two patches I'm attaching work as expected,
one needs the latest version of djvulibre from

  git://djvu.git.sourceforge.net/gitroot/djvu/djvulibre


Best regards,

Elias Pipping

[1] http://sourceforge.net/tracker/?func=detail&atid=406586&aid=3564062&group_id=32953

PS: I've configured emacs with --without-imagemagick. I did not test
what happens if imagemagick is used.

PPS: If you need PDF and DjVu files to toy around with, I suggest the
ones at http://projecteuclid.org/euclid.pjm/1102986512 since they also
make a nice read.

PPPS: The first diff is against vanilla emacs 24.2.

[0001-Make-doc-view-pdf-png-1-customizable.patch (text/x-patch, attachment)]
[0002-Add-DjVu-support.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Wed, 09 Jan 2013 20:29:02 GMT) Full text and rfc822 format available.

Message #4 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Elias Pipping <pipping <at> lavabit.com>
Cc: 13164 <at> debbugs.gnu.org
Subject: Re: [PATCH] View DjVu documents through doc-view-mode
Date: Wed, 09 Jan 2013 15:28:11 -0500
> I sent a patch to this list last year that made it possible to use
> mupdf's "mudraw" instead of ghostscript's "gs" to convert pdf documents
> into png files within doc-view-mode.

Thanks, I've just installed your mupdf patch with a few cosmetic
changes, thank you.
The djvu patch is still pending,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Thu, 10 Jan 2013 00:17:01 GMT) Full text and rfc822 format available.

Message #7 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Elias Pipping <pipping <at> lavabit.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13164 <at> debbugs.gnu.org
Subject: Re: [PATCH] View DjVu documents through doc-view-mode
Date: Thu, 10 Jan 2013 01:15:28 +0100
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> I sent a patch to this list last year that made it possible to use
>> mupdf's "mudraw" instead of ghostscript's "gs" to convert pdf documents
>> into png files within doc-view-mode.
>
> Thanks, I've just installed your mupdf patch with a few cosmetic
> changes, thank you.
> The djvu patch is still pending,

I see you've pushed the djvu patch as well. Thank you; also for the
modifications you've made.

I've attached three more tiny patches.


Best regards,

Elias Pipping

[0001-Enable-doc-view-for-djvu-files.patch (text/x-patch, attachment)]
[0002-single-page-converter-need-not-be-passed.patch (text/x-patch, attachment)]
[0003-Detect-properly-if-PDFs-can-be-handled.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Thu, 10 Jan 2013 15:51:02 GMT) Full text and rfc822 format available.

Message #10 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Elias Pipping <pipping <at> lavabit.com>
Cc: 13164 <at> debbugs.gnu.org
Subject: Re: [PATCH] View DjVu documents through doc-view-mode
Date: Thu, 10 Jan 2013 10:50:28 -0500
> I've attached three more tiny patches.

Thanks, installed,


        Stefan




bug closed, send any further explanations to 13164 <at> debbugs.gnu.org and Elias Pipping <pipping <at> lavabit.com> Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Thu, 10 Jan 2013 15:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Fri, 11 Jan 2013 15:04:02 GMT) Full text and rfc822 format available.

Message #15 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13164 <at> debbugs.gnu.org, Elias Pipping <pipping <at> lavabit.com>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Fri, 11 Jan 2013 16:02:48 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

Hi Elias & Stefan,

>> I've attached three more tiny patches.
>
> Thanks, installed,

I really like the new mupdf support.  It's much faster than ghostscript.

There seems to be some minor issue, though: the last-page counter in the
mode-line doesn't seem to be updated properly during conversion.  I've
just tested with some 700 pages PDF. Initially, it displayed "1/4" but
didn't increase anymore.  To make it update again, I needed to do
something, e.g., switch to another page or just scroll a bit.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Mon, 21 Jan 2013 23:12:02 GMT) Full text and rfc822 format available.

Message #18 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Elias Pipping <pipping <at> lavabit.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 13164 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Tue, 22 Jan 2013 00:10:32 +0100
[Message part 1 (text/plain, inline)]
Tassilo Horn <tsdh <at> gnu.org> writes:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> Hi Elias & Stefan,
>
>>> I've attached three more tiny patches.
>>
>> Thanks, installed,
>
> I really like the new mupdf support.  It's much faster than ghostscript.
>
> There seems to be some minor issue, though: the last-page counter in the
> mode-line doesn't seem to be updated properly during conversion.  I've
> just tested with some 700 pages PDF. Initially, it displayed "1/4" but
> didn't increase anymore.  To make it update again, I needed to do
> something, e.g., switch to another page or just scroll a bit.

Indeed, I can reproduce your problem with a recent version of emacs,
namely

  commit c5a8149837c5ed53655d4383dea3b8f29374b266
  Author: Glenn Morris <rgm <at> gnu.org>
  Date:   Sat Jan 19 18:40:49 2013 -0800

      * lisp-mode.el (emacs-lisp-mode-map): Add native profiler menu entries.

I do not have it with emacs 24.2.92 and my original two patches (I'm
attaching them in case you want to verify that; please note that you
need to have

  (setq doc-view-pdf->png-converter-invocation
        'doc-view-pdf->png-converter-invocation-mupdf)

in your init.el with that version for mupdf to be used). So it must've
snuck in sometime after.


Best regards,

Elias Pipping

[0001-Make-doc-view-pdf-png-1-customizable.patch (text/x-patch, attachment)]
[0002-Add-DjVu-support.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Tue, 22 Jan 2013 15:04:02 GMT) Full text and rfc822 format available.

Message #21 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Elias Pipping <pipping <at> lavabit.com>
Cc: 13164 <at> debbugs.gnu.org, Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Tue, 22 Jan 2013 10:02:03 -0500
>> There seems to be some minor issue, though: the last-page counter in the
>> mode-line doesn't seem to be updated properly during conversion.  I've
[...]
> Indeed, I can reproduce your problem with a recent version of Emacs

Could someone bisect to find the commit that introduced this problem?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Tue, 22 Jan 2013 15:27:02 GMT) Full text and rfc822 format available.

Message #24 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 13164 <at> debbugs.gnu.org, Elias Pipping <pipping <at> lavabit.com>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Tue, 22 Jan 2013 16:24:45 +0100
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>>> There seems to be some minor issue, though: the last-page counter in
>>> the mode-line doesn't seem to be updated properly during conversion.
>>> I've
> [...]
>> Indeed, I can reproduce your problem with a recent version of Emacs
>
> Could someone bisect to find the commit that introduced this problem?

Yes, I can do that.  I'll report back when I'm done.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Wed, 23 Jan 2013 09:52:02 GMT) Full text and rfc822 format available.

Message #27 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 13164 <at> debbugs.gnu.org, Elias Pipping <pipping <at> lavabit.com>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Wed, 23 Jan 2013 10:42:33 +0100
Tassilo Horn <tsdh <at> gnu.org> writes:

Hi!

>>>> There seems to be some minor issue, though: the last-page counter
>>>> in the mode-line doesn't seem to be updated properly during
>>>> conversion.  I've
>> [...]
>>> Indeed, I can reproduce your problem with a recent version of Emacs
>>
>> Could someone bisect to find the commit that introduced this problem?
>
> Yes, I can do that.  I'll report back when I'm done.

Ok, I'm done.

--8<---------------cut here---------------start------------->8---
046fb9fbdc0ee0c26e0063ce5ee94bead46ee98d is the first bad commit
commit 046fb9fbdc0ee0c26e0063ce5ee94bead46ee98d
Author: Dmitry Antipov <dmantipov <at> yandex.ru>
Date:   Tue Dec 11 13:51:12 2012 +0400

    * buffer.c (Fset_buffer_multibyte): Do not force redisplay
    if changed buffer is not shown in a window.
    * insdel.c (prepare_to_modify_buffer): Likewise.
    * window.c (replace_buffer_in_windows_safely): Do nothing
    if buffer is not shown in a window.
    (Fforce_window_update): Likewise if string or buffer argument
    is passed.

:040000 040000 c3cd9f89a3926ca04ecfee03ae667056986ba352 385c925b8bcfcc59262a140e4ce8701b20eb7265 M	src
--8<---------------cut here---------------end--------------->8---

In bzr, that's revno 111189.

BTW: I first tried the bzr bisect plugin, but I got frequent conflicts
in cl-loaddefs.el when it switched to another revision.  I used "bzr
resolve --take-other lisp/emacs-lisp/cl-loaddefs.el", and in the end the
bisection aborted somehow.  I also had lots of problems with files that
were added/removed between revisions.  Are there any instructions on
doing bisection on emacs bzr?  Maybe I've just operated bzr bisect
wrongly...

Anyway, git bisect on the git mirror worked flawlessly.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Wed, 23 Jan 2013 13:20:01 GMT) Full text and rfc822 format available.

Message #30 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dmitry Antipov <dmantipov <at> yandex.ru>
Cc: 13164 <at> debbugs.gnu.org, Elias Pipping <pipping <at> lavabit.com>,
	Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Wed, 23 Jan 2013 08:18:37 -0500
>>> Could someone bisect to find the commit that introduced this problem?
>> Yes, I can do that.  I'll report back when I'm done.
> Ok, I'm done.

Thank you very much.

> --8<---------------cut here---------------start------------->8---
> 046fb9fbdc0ee0c26e0063ce5ee94bead46ee98d is the first bad commit
> commit 046fb9fbdc0ee0c26e0063ce5ee94bead46ee98d
> Author: Dmitry Antipov <dmantipov <at> yandex.ru>
> Date:   Tue Dec 11 13:51:12 2012 +0400

>     * buffer.c (Fset_buffer_multibyte): Do not force redisplay
>     if changed buffer is not shown in a window.
>     * insdel.c (prepare_to_modify_buffer): Likewise.
>     * window.c (replace_buffer_in_windows_safely): Do nothing
>     if buffer is not shown in a window.
>     (Fforce_window_update): Likewise if string or buffer argument
>     is passed.

Dmitry, could you take a look at this?  It looks like the new code's
more aggressive avoidance of redisplay ends up leaving some mode-lines
out-of-date after running timers.

I don't see any immediate connection between the above commit message
and doc-view's timer behavior, so maybe the problem is a problem in
your commit.

OTOH maybe doc-view was simply lucky that the redisplay was not
optimized enough and we should really use something like the patch below,

> Are there any instructions on doing bisection on emacs bzr?

My impression that "bzr bisect" is in the same boat as "bzr switch" and
"bzr rebase": kinda works sometimes, but not nearly robust enough.


        Stefan


=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el	2013-01-10 15:50:04 +0000
+++ lisp/doc-view.el	2013-01-23 13:14:23 +0000
@@ -1265,6 +1265,8 @@
                                            "[0-9]+")
                                    t)
                   'doc-view-sort))
+      (unless (eq (length prev-pages) (length doc-view-current-files))
+        (force-mode-line-update))
       (dolist (win (or (get-buffer-window-list buffer nil t)
 		       (list t)))
 	(let* ((page (doc-view-current-page win))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Wed, 23 Jan 2013 14:56:03 GMT) Full text and rfc822 format available.

Message #33 received at 13164 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Antipov <dmantipov <at> yandex.ru>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 13164 <at> debbugs.gnu.org, Elias Pipping <pipping <at> lavabit.com>,
	Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Wed, 23 Jan 2013 18:54:11 +0400
On 01/23/2013 05:18 PM, Stefan Monnier wrote:

> Dmitry, could you take a look at this?  It looks like the new code's
> more aggressive avoidance of redisplay ends up leaving some mode-lines
> out-of-date after running timers.

Should be fixed by bzr commit 111589.

Dmitry





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13164; Package emacs. (Thu, 24 Jan 2013 07:41:02 GMT) Full text and rfc822 format available.

Message #36 received at 13164-done <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Dmitry Antipov <dmantipov <at> yandex.ru>
Cc: 13164-done <at> debbugs.gnu.org, Stefan Monnier <monnier <at> IRO.UMontreal.CA>,
	Elias Pipping <pipping <at> lavabit.com>
Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode
Date: Thu, 24 Jan 2013 08:39:55 +0100
Dmitry Antipov <dmantipov <at> yandex.ru> writes:

>> Dmitry, could you take a look at this?  It looks like the new code's
>> more aggressive avoidance of redisplay ends up leaving some
>> mode-lines out-of-date after running timers.
>
> Should be fixed by bzr commit 111589.

Confirmed, it works again.  Thanks Dmitry!

I'm closing the bug since the original issue (the DjVu patches) have
already been applied.

Bye,
Tassilo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 21 Feb 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 37 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.