From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72305: [PATCH] Fix DocView's text conversion on tty Emacs Date: Fri, 26 Jul 2024 17:49:47 +0200 Message-ID: <878qxorw4k.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25397"; mail-complaints-to="usenet@ciao.gmane.io" To: 72305@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 26 17:51:16 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sXNDw-0006RV-Bo for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Jul 2024 17:51:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXNDb-0007DI-HR; Fri, 26 Jul 2024 11:50:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXNDZ-0007Cx-Jh for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2024 11:50:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sXNDZ-0007jr-B9 for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2024 11:50:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sXNDi-0001HB-08 for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2024 11:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Jul 2024 15:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17220090104844 (code B ref -1); Fri, 26 Jul 2024 15:51:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Jul 2024 15:50:10 +0000 Original-Received: from localhost ([127.0.0.1]:39882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXNCr-0001G2-Tk for submit@debbugs.gnu.org; Fri, 26 Jul 2024 11:50:10 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXNCq-0001Ft-1g for submit@debbugs.gnu.org; Fri, 26 Jul 2024 11:50:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXNCh-000771-08 for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2024 11:49:59 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXNCe-0007K7-82 for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2024 11:49:57 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=TnPld7wa OarbFdSniYqsmDK6F5p+x+maGF35/FlFXYM=; h=date:subject:to:from; d=ledu-giraud.fr; b=cfGnLxg/xP+yrAISme7ofAtNRnebpSUc8KFyBnC25bt7q2uyFG JHG05xWymi2VqfJ7B8jxZrwM4CXsFR+6pUAw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=TnPld7waOarbFdSn iYqsmDK6F5p+x+maGF35/FlFXYM=; h=date:subject:to:from; d=ledu-giraud.fr; b=Zvit1Tf7MphlKIh03tOeu9EWVXwaS3lkrUUypeNlpZuAGY3zGa XcomHy5cXNxA34WlwrIbZ38mzcjriHvnpy4ompUQUkDY4ReXyThr1+TfrEHJm8Kf0tskOj twZYpwVCYdVgxKYpsHD1/GQLZ3QjWH5NJNh9FetnRfJNv/Wvk26cE35V55m9iUDjS/RUyf VT0kwFuOXYITOLtsVtG6qxgmoZlsSy03EnaxEODGE5PgSeLx2nUL+AaY5O6OOfkkgHMcCS e5g+eylRCXIBILBqEbYD9KunTSvfWFyAMRufsO74pua7pBKYdD9jnRGKvcS4ZnKNsZmzLE tppkIIGHOFxA== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 273cffd5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 26 Jul 2024 17:49:49 +0200 (CEST) Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289371 Archived-At: --=-=-= Content-Type: text/plain 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-DocView-s-text-conversion-on-tty-Emacs.patch >From 645544da19787ac6a79c7b8d63cd1b037cedbf32 Mon Sep 17 00:00:00 2001 From: Manuel Giraud 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 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--