GNU bug report logs - #62713
29.0.60; DocView shows wrong conversion indicator when configured to use svg images

Previous Next

Package: emacs;

Reported by: Gregor Zattler <grfz <at> gmx.de>

Date: Fri, 7 Apr 2023 16:03:02 UTC

Severity: minor

Found in version 29.0.60

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

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 62713 in the body.
You can then email your comments to 62713 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


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Fri, 07 Apr 2023 16:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gregor Zattler <grfz <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 07 Apr 2023 16:03:02 GMT) Full text and rfc822 format available.

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

From: Gregor Zattler <grfz <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; DocView shows wrong conversion indicator when configured
 to use svg images
Date: Fri, 07 Apr 2023 18:02:02 +0200
Package: emacs
Version: 29.0.60
Severity: minor

Dear Emacs developers,

1. start emacs -Q,
2. evaluate `(setq doc-view-mupdf-use-svg t)' in *scratch* buffer, then
3. open a (preferably large) pdf file:

While the pdf file is converted to images in the
background, a modeline indicator is shown:

DocView:pdf->png

which is wrong in this case since the conversion is
configured to produce svg images.

The indicator should look like

DocView: pdf->svg

or

DocView:pdf->img

or

DocView:pdf conversion

or something like that.

Admittedly a very minor issue.
Thanks, Gregor



In GNU Emacs 29.0.60 (build 9, x86_64-pc-linux-gnu,
 cairo version 1.16.0) of 2023-03-18 built on no
Repository revision: 11592bcfda6cf85d797d333072453c98994790e1
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-sound=yes --without-gconf
 --with-mailutils --build x86_64-linux-gnu
 --infodir=/usr/share/info --with-json
 --with-file-notification=yes --with-cairo --with-x=yes
 --with-x-toolkit=no --without-toolkit-scroll-bars
 --enable-checking=yes,glyphs
 --enable-check-lisp-object-type
 --with-native-compilation 'CFLAGS=-g3 -Os
 -ffile-prefix-map=/home/grfz/src/emacs-emacs-29--11592bcfda6cf85d797d333072453c98994790e1--2023-03-18T17-21+01-00=. -fstack-protector-strong
 -Wformat -Werror=format-security ''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM
GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX
LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF X11 XDBE XIM XINPUT2 XPM ZLIB




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Sun, 24 Sep 2023 23:33:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Gregor Zattler <grfz <at> gmx.de>, 62713 <at> debbugs.gnu.org
Cc: Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator when
 configured to use svg images
Date: Sun, 24 Sep 2023 16:31:38 -0700
Gregor Zattler <grfz <at> gmx.de> writes:

> Package: emacs
> Version: 29.0.60
> Severity: minor
>
> Dear Emacs developers,
>
> 1. start emacs -Q,
> 2. evaluate `(setq doc-view-mupdf-use-svg t)' in *scratch* buffer, then
> 3. open a (preferably large) pdf file:
>
> While the pdf file is converted to images in the
> background, a modeline indicator is shown:
>
> DocView:pdf->png
>
> which is wrong in this case since the conversion is
> configured to produce svg images.
>
> The indicator should look like
>
> DocView: pdf->svg
>
> or
>
> DocView:pdf->img
>
> or
>
> DocView:pdf conversion
>
> or something like that.
>
> Admittedly a very minor issue.
> Thanks, Gregor

Visuwesh, what do you think?

> In GNU Emacs 29.0.60 (build 9, x86_64-pc-linux-gnu,
>  cairo version 1.16.0) of 2023-03-18 built on no
> Repository revision: 11592bcfda6cf85d797d333072453c98994790e1
> Repository branch: HEAD
> Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
> System Description: Debian GNU/Linux 11 (bullseye)
>
> Configured using:
>  'configure --with-sound=yes --without-gconf
>  --with-mailutils --build x86_64-linux-gnu
>  --infodir=/usr/share/info --with-json
>  --with-file-notification=yes --with-cairo --with-x=yes
>  --with-x-toolkit=no --without-toolkit-scroll-bars
>  --enable-checking=yes,glyphs
>  --enable-check-lisp-object-type
>  --with-native-compilation 'CFLAGS=-g3 -Os
>  -ffile-prefix-map=/home/grfz/src/emacs-emacs-29--11592bcfda6cf85d797d333072453c98994790e1--2023-03-18T17-21+01-00=. -fstack-protector-strong
>  -Wformat -Werror=format-security ''
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM
> GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX
> LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
> INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
> THREADS TIFF X11 XDBE XIM XINPUT2 XPM ZLIB




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Mon, 25 Sep 2023 04:32:02 GMT) Full text and rfc822 format available.

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

From: Visuwesh <visuweshm <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator
 when configured to use svg images
Date: Mon, 25 Sep 2023 10:00:40 +0530
Good day, Stefan!

[ஞாயிறு செப்டம்பர் 24, 2023] Stefan Kangas wrote:

>> The indicator should look like
>>
>> DocView: pdf->svg
>>
>> or
>>
>> DocView:pdf->img
>>
>> or
>>
>> DocView:pdf conversion
>>
>> or something like that.
>>
>> Admittedly a very minor issue.
>> Thanks, Gregor
>
> Visuwesh, what do you think?

It is better solved by writing a separate pdf->svg converter function.
Right now, the svg conversion is tacked on top of pdf->png converter
function used for MuPDF.  This was done because I thought only MuPDF
supported pdf->svg conversion but later I was informed that poppler has
utilities to do too.

Such a generic approach was discussed in [1] with the other Stefan but
it fell off my radar since I rarely use docview and hence lost my
motivation.  I will try to whip something up in the coming week.

1. https://yhetil.org/emacs-bugs/87zganwvgp.fsf <at> gmail.com/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Mon, 25 Sep 2023 08:21:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator when
 configured to use svg images
Date: Mon, 25 Sep 2023 01:20:35 -0700
Visuwesh <visuweshm <at> gmail.com> writes:

> It is better solved by writing a separate pdf->svg converter function.
> Right now, the svg conversion is tacked on top of pdf->png converter
> function used for MuPDF.  This was done because I thought only MuPDF
> supported pdf->svg conversion but later I was informed that poppler has
> utilities to do too.
>
> Such a generic approach was discussed in [1] with the other Stefan but
> it fell off my radar since I rarely use docview and hence lost my
> motivation.  I will try to whip something up in the coming week.

Sounds good!  Thanks for working on this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Mon, 25 Sep 2023 12:48:02 GMT) Full text and rfc822 format available.

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

From: Visuwesh <visuweshm <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator
 when configured to use svg images
Date: Mon, 25 Sep 2023 18:17:01 +0530
[Message part 1 (text/plain, inline)]
[திங்கள் செப்டம்பர் 25, 2023] Visuwesh wrote:

> It is better solved by writing a separate pdf->svg converter function.
> Right now, the svg conversion is tacked on top of pdf->png converter
> function used for MuPDF.  This was done because I thought only MuPDF
> supported pdf->svg conversion but later I was informed that poppler has
> utilities to do too.

And looks like the poppler utility pdftocairo does not work the doc-view
expects it to when generating svg images.  AFAICT, there is no way to
make pdftocairo to generate a svg image per page like other tools do.  I
cannot loop either as there is also no way to know the number of pages
beforehand.  The png function also has hacks since pdftocairo is not
cooperative, and changing doc-view to not use
doc-view--image-file-pattern does not seem to be easy.  I attach the
patch named "doc-view-general-svg-wip.patch" which has my WIP and it
works just fine for MuPDF.

This particular problem can be easily solved by the following simple
patch instead:

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index b856b09c8b7..c0d27bdc68a 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1283,7 +1283,8 @@ doc-view-pdf->png-converter-mupdf
                                     (expand-file-name
                                      doc-view-epub-user-stylesheet)))))))
     (doc-view-start-process
-     "pdf->png" doc-view-pdfdraw-program
+     (concat "pdf->" (symbol-name doc-view--image-type))
+     doc-view-pdfdraw-program
      `(,@(doc-view-pdfdraw-program-subcommand)
        ,@options
        ,pdf

But if you say we don't bother about pdftocairo support and implement
the generic support system, I can prepare a patch without the pdftocairo
stuff, and add some documentation to aid the users to write custom
converter functions.

[doc-view-general-svg-wip.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Tue, 26 Sep 2023 11:44:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>,
 Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator when
 configured to use svg images
Date: Tue, 26 Sep 2023 04:43:05 -0700
Visuwesh <visuweshm <at> gmail.com> writes:

> [திங்கள் செப்டம்பர் 25, 2023] Visuwesh wrote:
>
>> It is better solved by writing a separate pdf->svg converter function.
>> Right now, the svg conversion is tacked on top of pdf->png converter
>> function used for MuPDF.  This was done because I thought only MuPDF
>> supported pdf->svg conversion but later I was informed that poppler has
>> utilities to do too.
>
> And looks like the poppler utility pdftocairo does not work the doc-view
> expects it to when generating svg images.  AFAICT, there is no way to
> make pdftocairo to generate a svg image per page like other tools do.  I
> cannot loop either as there is also no way to know the number of pages
> beforehand.  The png function also has hacks since pdftocairo is not
> cooperative, and changing doc-view to not use
> doc-view--image-file-pattern does not seem to be easy.  I attach the
> patch named "doc-view-general-svg-wip.patch" which has my WIP and it
> works just fine for MuPDF.
>
> This particular problem can be easily solved by the following simple
> patch instead:

Tassilo, could you perhaps take a look at this patch?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Fri, 29 Sep 2023 09:41:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator
 when configured to use svg images
Date: Fri, 29 Sep 2023 11:34:35 +0200
Stefan Kangas <stefankangas <at> gmail.com> writes:

>> This particular problem can be easily solved by the following simple
>> patch instead:
>
> Tassilo, could you perhaps take a look at this patch?

Yes, the simple patch looks good and fixes the bug.  Feel free to commit
it.

I've skimmed at the WIP patch, too.  It also looks good but has not much
to do with the bug report but adds another pdf->svg converter.
Visuwesh, I noticed that the docstrings speak of pdfcairo while the
program actually is pdftocairo.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Fri, 29 Sep 2023 09:45:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator when
 configured to use svg images
Date: Fri, 29 Sep 2023 02:43:50 -0700
Tassilo Horn <tsdh <at> gnu.org> writes:

> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>>> This particular problem can be easily solved by the following simple
>>> patch instead:
>>
>> Tassilo, could you perhaps take a look at this patch?
>
> Yes, the simple patch looks good and fixes the bug.  Feel free to commit
> it.

Great, thanks.

Visuwesh, could you please send the patch as an attachment instead?  We
prefer that patches are created with a command like `git format-patch
-1'.

Please also include:

- The bug number of this bug in the commit message, like so: Bug#62713

- A ChangeLog entry, as described in the file CONTRIBUTE.

That would make it easier for us to review and install this patch.

Thanks in advance.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62713; Package emacs. (Fri, 29 Sep 2023 14:56:02 GMT) Full text and rfc822 format available.

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

From: Visuwesh <visuweshm <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 62713 <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>,
 Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator
 when configured to use svg images
Date: Fri, 29 Sep 2023 20:25:09 +0530
[Message part 1 (text/plain, inline)]
[வெள்ளி செப்டம்பர் 29, 2023] Stefan Kangas wrote:

> Tassilo Horn <tsdh <at> gnu.org> writes:
>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>>>> This particular problem can be easily solved by the following simple
>>>> patch instead:
>>>
>>> Tassilo, could you perhaps take a look at this patch?
>>
>> Yes, the simple patch looks good and fixes the bug.  Feel free to commit
>> it.
>
> Great, thanks.
>
> Visuwesh, could you please send the patch as an attachment instead?  We
> prefer that patches are created with a command like `git format-patch
> -1'.

Please find attached patch.

[0001-Fix-doc-view-conversion-indicator-for-svg-images.patch (text/x-diff, attachment)]

Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 01 Oct 2023 13:02:02 GMT) Full text and rfc822 format available.

Notification sent to Gregor Zattler <grfz <at> gmx.de>:
bug acknowledged by developer. (Sun, 01 Oct 2023 13:02:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 62713-done <at> debbugs.gnu.org, Gregor Zattler <grfz <at> gmx.de>,
 Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#62713: 29.0.60; DocView shows wrong conversion indicator when
 configured to use svg images
Date: Sun, 1 Oct 2023 06:00:43 -0700
Version: 30.1

Visuwesh <visuweshm <at> gmail.com> writes:

> [வெள்ளி செப்டம்பர் 29, 2023] Stefan Kangas wrote:
>
>> Tassilo Horn <tsdh <at> gnu.org> writes:
>>
>>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>>
>>>>> This particular problem can be easily solved by the following simple
>>>>> patch instead:
>>>>
>>>> Tassilo, could you perhaps take a look at this patch?
>>>
>>> Yes, the simple patch looks good and fixes the bug.  Feel free to commit
>>> it.
>>
>> Great, thanks.
>>
>> Visuwesh, could you please send the patch as an attachment instead?  We
>> prefer that patches are created with a command like `git format-patch
>> -1'.
>
> Please find attached patch.

Thanks, installed on master [1: f0abc9bc0d5], and I'm consequently
closing this bug report.

[1: f0abc9bc0d5]: 2023-10-01 14:58:48 +0200
  Fix doc-view conversion indicator for svg images
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f0abc9bc0d536e5b2834c04714d75d18fde431c3




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Oct 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 178 days ago.

Previous Next


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