GNU bug report logs - #72305
[PATCH] Fix DocView's text conversion on tty Emacs

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Fri, 26 Jul 2024 15:51:01 UTC

Severity: normal

Tags: patch

Fixed in version 31.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 72305 in the body.
You can then email your comments to 72305 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#72305; Package emacs. (Fri, 26 Jul 2024 15:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Manuel Giraud <manuel <at> ledu-giraud.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 26 Jul 2024 15:51:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Fri, 26 Jul 2024 17:49:47 +0200
[Message part 1 (text/plain, inline)]
Tags: patch

Hi,

When doing 'M-x doc-view-mode' on document buffer in "emacs -nw", Emacs
proposes to convert this document to the text version and if the user
says "yes" it calls `doc-view-open-text'.

`doc-view-open-text' tries to get the current page by calling the
`doc-view-current-page' but this latter relies on
`image-mode-window-get' which most probably return nil on a tty.

In GNU Emacs 31.0.50 (build 1, x86_64-unknown-openbsd7.5, cairo version
 1.18.0) of 2024-07-26 built on computer
Repository revision: 52cae67e1e73615fff184abcc8e635d80f8846ad
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: OpenBSD computer 7.5 GENERIC.MP#207 amd64

Configured using:
 'configure CC=egcc CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=no --with-cairo
 --without-compress-install'

[0001-Fix-DocView-s-text-conversion-on-tty-Emacs.patch (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
-- 
Manuel Giraud

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Fri, 26 Jul 2024 21:49:02 GMT) Full text and rfc822 format available.

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

From: Jeremy Bryant <jb <at> jeremybryant.net>
To: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: 72305 <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Re: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Fri, 26 Jul 2024 22:48:00 +0100
Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Tags: patch
>
> Hi,
>
> When doing 'M-x doc-view-mode' on document buffer in "emacs -nw", Emacs
> proposes to convert this document to the text version and if the user
> says "yes" it calls `doc-view-open-text'.
>
> `doc-view-open-text' tries to get the current page by calling the
> `doc-view-current-page' but this latter relies on
> `image-mode-window-get' which most probably return nil on a tty.

I can't reproduce this bug on 29.4, could you provide a more complete
recipe starting from emacs -Q?
>
> In GNU Emacs 31.0.50 (build 1, x86_64-unknown-openbsd7.5, cairo version
>  1.18.0) of 2024-07-26 built on computer
> Repository revision: 52cae67e1e73615fff184abcc8e635d80f8846ad
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
> System Description: OpenBSD computer 7.5 GENERIC.MP#207 amd64
>
> Configured using:
>  'configure CC=egcc CPPFLAGS=-I/usr/local/include
>  LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
>  --bindir=/home/manuel/bin --with-x-toolkit=no --with-cairo
>  --without-compress-install'
>
> [2. text/patch; 0001-Fix-DocView-s-text-conversion-on-tty-Emacs.patch]...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Fri, 26 Jul 2024 21:49:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Sat, 27 Jul 2024 15:18:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Jeremy Bryant <jb <at> jeremybryant.net>
Cc: "Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>, 72305 <at> debbugs.gnu.org
Subject: Re: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Sat, 27 Jul 2024 17:17:24 +0200
Jeremy Bryant <jb <at> jeremybryant.net> writes:

> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>> Tags: patch
>>
>> Hi,
>>
>> When doing 'M-x doc-view-mode' on document buffer in "emacs -nw", Emacs
>> proposes to convert this document to the text version and if the user
>> says "yes" it calls `doc-view-open-text'.
>>
>> `doc-view-open-text' tries to get the current page by calling the
>> `doc-view-current-page' but this latter relies on
>> `image-mode-window-get' which most probably return nil on a tty.
>
> I can't reproduce this bug on 29.4, could you provide a more complete
> recipe starting from emacs -Q?

You're right but I see an error nevertheless.  Here is my recipe:

       - emacs -Q -nw
       - C-x C-f "a_doc_for_example_a.pdf"
       - M-x doc-view-mode ;; No automatic mode detection (I think it
                           ;; would be the object of another bug report)
       - Answer "y" to the question "Unable to render file.  View
         extracted text instead? "

Here I see an error in 29.4 but the text version is rendered anyway.  In
30 (or master), I see an error and the text version is not rendered.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Sat, 27 Jul 2024 15:18:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Sat, 27 Jul 2024 17:02:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Jeremy Bryant <jb <at> jeremybryant.net>
Cc: "Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>, 72305 <at> debbugs.gnu.org
Subject: Re: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Sat, 27 Jul 2024 19:01:13 +0200
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

> Jeremy Bryant <jb <at> jeremybryant.net> writes:
>
>> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:
>>
>>> Tags: patch
>>>
>>> Hi,
>>>
>>> When doing 'M-x doc-view-mode' on document buffer in "emacs -nw", Emacs
>>> proposes to convert this document to the text version and if the user
>>> says "yes" it calls `doc-view-open-text'.
>>>
>>> `doc-view-open-text' tries to get the current page by calling the
>>> `doc-view-current-page' but this latter relies on
>>> `image-mode-window-get' which most probably return nil on a tty.
>>
>> I can't reproduce this bug on 29.4, could you provide a more complete
>> recipe starting from emacs -Q?
>
> You're right but I see an error nevertheless.  Here is my recipe:
>
>        - emacs -Q -nw
>        - C-x C-f "a_doc_for_example_a.pdf"
>        - M-x doc-view-mode ;; No automatic mode detection (I think it
>                            ;; would be the object of another bug report)
>        - Answer "y" to the question "Unable to render file.  View
>          extracted text instead? "
>
> Here I see an error in 29.4 but the text version is rendered anyway.  In
> 30 (or master), I see an error and the text version is not rendered.

Erratum

   - 29.4 and 30 behave the same: an error but shows the text version anyway
   - master: error and no text version shown
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Sat, 27 Jul 2024 17:02:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Sun, 23 Feb 2025 00:51:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 72305 <at> debbugs.gnu.org, Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Sun, 23 Feb 2025 00:50:39 +0000
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

> When doing 'M-x doc-view-mode' on document buffer in "emacs -nw", Emacs
> proposes to convert this document to the text version and if the user
> says "yes" it calls `doc-view-open-text'.
>
> `doc-view-open-text' tries to get the current page by calling the
> `doc-view-current-page' but this latter relies on
> `image-mode-window-get' which most probably return nil on a tty.

Tassilo, any comments on this patch?

>>From 645544da19787ac6a79c7b8d63cd1b037cedbf32 Mon Sep 17 00:00:00 2001
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Date: Fri, 26 Jul 2024 17:37:02 +0200
> Subject: [PATCH] Fix DocView's text conversion on tty Emacs
>
> * lisp/doc-view.el (doc-view-open-text): Defaults to first page
> should `doc-view-current-page' return nil.
> ---
>  lisp/doc-view.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/doc-view.el b/lisp/doc-view.el
> index 63e0de9afe3..72a9ec16c45 100644
> --- a/lisp/doc-view.el
> +++ b/lisp/doc-view.el
> @@ -1766,7 +1766,7 @@ doc-view-open-text
>    (if doc-view--current-converter-processes
>        (message "DocView: please wait till conversion finished.")
>      (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))
> -          (page (doc-view-current-page)))
> +          (page (or (doc-view-current-page) 1)))
>        (if (file-readable-p txt)
>            (let ((dv-bfn doc-view--buffer-file-name)
>                  (dv-text-buffer-name (format "%s/text" (buffer-name))))
> --
> 2.45.2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72305; Package emacs. (Sun, 23 Feb 2025 09:16:01 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 72305 <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Re: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Sun, 23 Feb 2025 10:15:35 +0100
Stefan Kangas <stefankangas <at> gmail.com> writes:

>> When doing 'M-x doc-view-mode' on document buffer in "emacs -nw",
>> Emacs proposes to convert this document to the text version and if
>> the user says "yes" it calls `doc-view-open-text'.
>>
>> `doc-view-open-text' tries to get the current page by calling the
>> `doc-view-current-page' but this latter relies on
>> `image-mode-window-get' which most probably return nil on a tty.
>
> Tassilo, any comments on this patch?

It's so simple that it's obviously right.

Bye,
Tassilo

>>>From 645544da19787ac6a79c7b8d63cd1b037cedbf32 Mon Sep 17 00:00:00 2001
>> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
>> Date: Fri, 26 Jul 2024 17:37:02 +0200
>> Subject: [PATCH] Fix DocView's text conversion on tty Emacs
>>
>> * lisp/doc-view.el (doc-view-open-text): Defaults to first page
>> should `doc-view-current-page' return nil.
>> ---
>>  lisp/doc-view.el | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lisp/doc-view.el b/lisp/doc-view.el
>> index 63e0de9afe3..72a9ec16c45 100644
>> --- a/lisp/doc-view.el
>> +++ b/lisp/doc-view.el
>> @@ -1766,7 +1766,7 @@ doc-view-open-text
>>    (if doc-view--current-converter-processes
>>        (message "DocView: please wait till conversion finished.")
>>      (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))
>> -          (page (doc-view-current-page)))
>> +          (page (or (doc-view-current-page) 1)))
>>        (if (file-readable-p txt)
>>            (let ((dv-bfn doc-view--buffer-file-name)
>>                  (dv-text-buffer-name (format "%s/text" (buffer-name))))
>> --
>> 2.45.2




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

Notification sent to Manuel Giraud <manuel <at> ledu-giraud.fr>:
bug acknowledged by developer. (Sun, 23 Feb 2025 13:45:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 72305-done <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Re: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
Date: Sun, 23 Feb 2025 13:44:26 +0000
Version: 31.1

Tassilo Horn <tsdh <at> gnu.org> writes:

>> Tassilo, any comments on this patch?
>
> It's so simple that it's obviously right.

Thanks, installed on master as commit 09bef781326.

I'm therefore closing this bug report.




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

This bug report was last modified 88 days ago.

Previous Next


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