* bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
@ 2024-07-26 15:49 Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-26 21:48 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 4+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-26 15:49 UTC (permalink / raw)
To: 72305
[-- Attachment #1: Type: text/plain, Size: 955 bytes --]
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'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-DocView-s-text-conversion-on-tty-Emacs.patch --]
[-- Type: text/patch, Size: 1023 bytes --]
From 645544da19787ac6a79c7b8d63cd1b037cedbf32 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@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
[-- Attachment #3: Type: text/plain, Size: 19 bytes --]
--
Manuel Giraud
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
2024-07-26 15:49 bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-26 21:48 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 15:17 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-26 21:48 UTC (permalink / raw)
To: 72305; +Cc: manuel
Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@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]...
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
2024-07-26 21:48 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-27 15:17 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 17:01 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 4+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-27 15:17 UTC (permalink / raw)
To: Jeremy Bryant; +Cc: 72305
Jeremy Bryant <jb@jeremybryant.net> writes:
> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs
2024-07-27 15:17 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-27 17:01 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 4+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-27 17:01 UTC (permalink / raw)
To: Jeremy Bryant; +Cc: 72305
Manuel Giraud <manuel@ledu-giraud.fr> writes:
> Jeremy Bryant <jb@jeremybryant.net> writes:
>
>> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-27 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 15:49 bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-26 21:48 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 15:17 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 17:01 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
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).