GNU logs - #72241, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Manuel Giraud <manuel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 22 Jul 2024 08:28:01 +0000
Resent-Message-ID: <handler.72241.B.172163683331163 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 72241 <at> debbugs.gnu.org
Cc: Tassilo Horn <tsdh@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.172163683331163
          (code B ref -1); Mon, 22 Jul 2024 08:28:01 +0000
Received: (at submit) by debbugs.gnu.org; 22 Jul 2024 08:27:13 +0000
Received: from localhost ([127.0.0.1]:56810 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVoO0-00086Z-C6
	for submit <at> debbugs.gnu.org; Mon, 22 Jul 2024 04:27:13 -0400
Received: from lists.gnu.org ([209.51.188.17]:41896)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manuel@HIDDEN>) id 1sVoNx-00086Q-Sc
 for submit <at> debbugs.gnu.org; Mon, 22 Jul 2024 04:27:10 -0400
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 <manuel@HIDDEN>)
 id 1sVoNu-0004WW-Ey
 for bug-gnu-emacs@HIDDEN; Mon, 22 Jul 2024 04:27:06 -0400
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 <manuel@HIDDEN>)
 id 1sVoNr-0005x7-Dq; Mon, 22 Jul 2024 04:27:06 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=tE5G7k6a
 yXy9XSTFx2DUJ4DHvAx1Pg1k6zI+nM9sW6M=; h=date:subject:cc:to:from;
 d=ledu-giraud.fr; b=TXo5l1MHi4pJ1lgPRdmMGNtAMvhdb7RmpqKV3XM8Kd4Ekq2Nz/
 5MeEGeN+Uw62gfcTIzRVniCbqxW776naW5Ag==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=tE5G7k6ayXy9XSTF
 x2DUJ4DHvAx1Pg1k6zI+nM9sW6M=; h=date:subject:cc:to:from;
 d=ledu-giraud.fr; b=Omq8njC8AZ9AMp4C1eYZkSL1FJTZq2tGKQ1OuDBUXibVkvRWZ8
 lzrdAKjzFksrhe+I9mAryT6O7vgklzFknsjYdPaJba4tXJnrNzC6hk3HnpqE2G/dDOAALl
 LKTPctAD3vtroFAOhABjjxpiYU7n94ChvTZUTIEKc/ZXq2om2u+uT8yM+0BtliyqnKaV8U
 VzHaKEJqyHmGA9c6YzQVILrcK4ToMV6qP5fScWBwH3wVyPTdj+FESoI0yEW2qil+eUJBDY
 mJidfexDp5qi2hELsQ3kn85umoqCv6UMFmsugWmB+sNFKTA4/ONABIbtl6yw7sqq7KdtrQ
 55SsNged9Kzg==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 331997d2
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Mon, 22 Jul 2024 10:26:54 +0200 (CEST)
From: Manuel Giraud <manuel@HIDDEN>
Date: Mon, 22 Jul 2024 10:26:53 +0200
Message-ID: <87jzhd4ysy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@HIDDEN;
 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-Spam-Score: -1.4 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain



Hi,

Here is a patch for DocView that makes it use a dedicated buffer for the
text representation of a document.  This is what was suggested by Stefan
M. in a comment (circa 2019).


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Use-a-dedicated-buffer-for-doc-view-open-text.patch

From 03d83f95c9a6502bf6b85d0b14e47022cf29bd3d Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@HIDDEN>
Date: Sun, 21 Jul 2024 18:52:52 +0200
Subject: [PATCH] Use a dedicated buffer for `doc-view-open-text'

* lisp/doc-view.el (doc-view-open-text): Create a new "doc's
contents" buffer an switch to it.
(doc-view-toggle-display): Switch back to the document buffer and
kill the "doc's contents" one.
---
 lisp/doc-view.el | 60 +++++++++++++++++++-----------------------------
 1 file changed, 24 insertions(+), 36 deletions(-)

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 801783bd766..6313ee83857 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1768,34 +1768,25 @@ doc-view-open-text
     (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))
           (page (doc-view-current-page)))
       (if (file-readable-p txt)
-	  (let ((inhibit-read-only t)
-		(buffer-undo-list t)
-		(dv-bfn doc-view--buffer-file-name))
-	    (erase-buffer)
-            ;; FIXME: Replacing the buffer's PDF content with its txt rendering
-            ;; is pretty risky.  We should probably use *another*
-            ;; buffer instead, so there's much less risk of
-            ;; overwriting the PDF file with some text rendering.
-	    (set-buffer-multibyte t)
-	    (insert-file-contents txt)
-	    (doc-view--text-view-mode)
-	    (setq-local doc-view--buffer-file-name dv-bfn)
-	    (set-buffer-modified-p nil)
-	    (doc-view-minor-mode)
-            (goto-char (point-min))
-            ;; Put point at the start of the page the user was
-            ;; reading.  Pages are separated by Control-L characters.
-            (re-search-forward page-delimiter nil t (1- page))
-	    (add-hook 'write-file-functions
-		      (lambda ()
-                        ;; FIXME: If the user changes major mode and then
-                        ;; saves the buffer, the PDF file will be clobbered
-                        ;; with its txt rendering!
-			(when (eq major-mode 'doc-view--text-view-mode)
-			  (error "Cannot save text contents of document %s"
-				 buffer-file-name)))
-		      nil t))
-	(doc-view-doc->txt txt 'doc-view-open-text)))))
+          (let ((dv-bfn doc-view--buffer-file-name)
+                (dv-text-buffer-name (format "%s/text" (buffer-name))))
+            ;; Prepare the text buffer
+            (with-current-buffer (get-buffer-create dv-text-buffer-name)
+              (let ((inhibit-read-only t)
+                    (buffer-undo-list t))
+                (erase-buffer)
+                (set-buffer-multibyte t)
+                (insert-file-contents txt)
+                (doc-view--text-view-mode)
+                (setq-local doc-view--buffer-file-name dv-bfn)
+                (set-buffer-modified-p nil)
+                (doc-view-minor-mode)
+                (goto-char (point-min))
+                ;; Put point at the start of the page the user was
+                ;; reading.  Pages are separated by Control-L characters.
+                (re-search-forward page-delimiter nil t (1- page))))
+            (switch-to-buffer (get-buffer dv-text-buffer-name)))
+        (doc-view-doc->txt txt 'doc-view-open-text)))))
 
 ;;;;; Toggle between editing and viewing
 
@@ -1816,14 +1807,11 @@ doc-view-toggle-display
     (doc-view-fallback-mode)
     (doc-view-minor-mode 1))
    ((eq major-mode 'doc-view--text-view-mode)
-    (let ((buffer-undo-list t))
-      ;; We're currently viewing the document's text contents, so switch
-      ;; back to .
-      (setq buffer-read-only nil)
-      (insert-file-contents doc-view--buffer-file-name nil nil nil t)
-      (doc-view-fallback-mode)
-      (doc-view-minor-mode 1)
-      (set-buffer-modified-p nil)))
+    ;; We're currently viewing the document's text contents, switch to
+    ;; the buffer visiting the real document and kill myself.
+    (let ((dv-buffer (find-buffer-visiting doc-view--buffer-file-name)))
+      (kill-buffer)
+      (switch-to-buffer dv-buffer)))
    (t
     ;; Switch to doc-view-mode
     (when (and (buffer-modified-p)
-- 
2.45.2


--=-=-=
Content-Type: text/plain



In GNU Emacs 31.0.50 (build 27, x86_64-unknown-openbsd7.5) of 2024-07-22
 built on computer
Repository revision: 03d83f95c9a6502bf6b85d0b14e47022cf29bd3d
Repository branch: mgi/doc-view
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: OpenBSD computer 7.5 GENERIC.MP#198 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 --without-cairo
 --without-compress-install'

Configured features:
DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF
LIBXML2 MODULES NOTIFY KQUEUE OLDXMENU PDUMPER PNG RSVG SQLITE3 THREADS
TIFF TREE_SITTER WEBP X11 XDBE XFT XIM XINPUT2 XPM ZLIB

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Diff

Minor modes in effect:
  whitespace-mode: t
  display-time-mode: t
  display-battery-mode: t
  desktop-save-mode: t
  exwm-randr-mode: t
  server-mode: t
  electric-pair-mode: t
  override-global-mode: t
  repeat-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/manuel/prog/elisp/exwm/exwm-randr hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-randr
/home/manuel/prog/elisp/exwm/exwm hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm
/home/manuel/prog/elisp/exwm/exwm-xsettings hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-xsettings
/home/manuel/prog/elisp/exwm/exwm-xim hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-xim
/home/manuel/prog/elisp/exwm/exwm-workspace hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-workspace
/home/manuel/prog/elisp/exwm/exwm-systemtray hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-systemtray
/home/manuel/prog/elisp/exwm/exwm-manage hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-manage
/home/manuel/prog/elisp/exwm/exwm-layout hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-layout
/home/manuel/prog/elisp/exwm/exwm-input hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-input
/home/manuel/prog/elisp/exwm/exwm-floating hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-floating
/home/manuel/prog/elisp/exwm/exwm-core hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-core
/home/manuel/prog/elisp/exwm/exwm-config hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-config
/home/manuel/prog/elisp/exwm/exwm-background hides /home/manuel/.emacs.d/elpa/exwm-0.31/exwm-background
/home/manuel/.emacs.d/elpa/ef-themes-1.7.0/theme-loaddefs hides /home/manuel/emacs/share/emacs/31.0.50/lisp/theme-loaddefs

Features:
(shadow sort mail-extr smerge-mode diff whitespace pulse emacsbug imenu
display-line-numbers bookmark cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew cal-julian holidays holiday-loaddefs cal-iso
face-remap texinfo texinfo-loaddefs org-indent org-agenda flymake-cc
flymake warnings python conf-mode oc-basic org-element org-persist
org-id org-element-ast inline avl-tree ol-eww eww url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect ol-docview doc-view
filenotify jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m
ol-doi org-link-doi gnus-icalendar org-capture org-refile org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities org-version
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs org-compat org-macs vc-cvs vc-rcs
log-view pcvs-util make-mode view sh-script smie treesit executable
mule-util on-screen gnus-dired bug-reference vc-git diff-mode
track-changes vc-dir ewoc vc vc-dispatcher time battery cus-load desktop
frameset exwm-randr xcb-randr exwm exwm-input xcb-keysyms xcb-xkb
exwm-manage exwm-floating xcb-cursor xcb-render exwm-layout
exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb xcb-xproto xcb-types
xcb-debug server ef-kassio-theme ef-themes modus-operandi-theme
modus-themes zone speed-type url-http url-auth url-gw nsm ytdious
mpdired transmission color calc-bin calc-ext calc calc-loaddefs rect
calc-macs supercite regi ebdb-gnus gnus-msg gnus-art mm-uu mml2015
mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku
url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range gnus-win ebdb-message message sendmail yank-media puny rfc822
mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums gmm-utils mailheader
ebdb-mua ebdb-com crm ebdb-format ebdb mailabbrev eieio-opt speedbar
ezimage dframe find-func eieio-base timezone icalendar gnus nnheader
gnus-util mail-utils range mm-util mail-prsvr wid-edit web-mode derived
disp-table erlang-start skeleton cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs slime-asdf grep
slime-tramp tramp rx trampver tramp-integration files-x tramp-message
tramp-compat xdg shell pcomplete parse-time iso8601 time-date
format-spec tramp-loaddefs slime-fancy slime-indentation slime-cl-indent
cl-indent slime-trace-dialog slime-fontifying-fu slime-package-fu
slime-references slime-compiler-notes-tree advice slime-scratch
slime-presentations bridge slime-macrostep macrostep compat
slime-mdot-fu slime-enclosing-context slime-fuzzy slime-fancy-trace
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
slime-repl slime-parse slime apropos compile text-property-search etags
fileloop generator xref project arc-mode archive-mode noutline outline
pp comint ansi-osc ansi-color ring hyperspec thingatpt elec-pair edmacro
kmacro use-package-bind-key bind-key appt diary-lib diary-loaddefs
cal-menu calendar cal-loaddefs pcase dired-x dired-aux dired
dired-loaddefs use-package-core repeat easy-mmode calfw-autoloads
calfw-cal-autoloads calfw-org-autoloads debbugs-autoloads ebdb-autoloads
cl-extra help-mode ef-themes-autoloads exwm-autoloads
hyperbole-autoloads kotl-autoloads hact set hhist on-screen-autoloads
osm-autoloads rust-mode-autoloads info slime-autoloads
macrostep-autoloads speed-type-autoloads transmission-autoloads
xelb-autoloads ytdious-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind kqueue lcms2 dynamic-setting system-font-setting
font-render-setting xinput2 x multi-tty move-toolbar
make-network-process emacs)

Memory information:
((conses 16 933704 633678) (symbols 48 53527 2)
 (strings 32 250981 60259) (string-bytes 1 6331174)
 (vectors 16 153303) (vector-slots 8 2126367 44503)
 (floats 8 1075 1790) (intervals 56 28683 309) (buffers 992 146))

-- 
Manuel Giraud

--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Manuel Giraud <manuel@HIDDEN>
Subject: bug#72241: Acknowledgement (31.0.50; [PATCH] Use a dedicated
 buffer for `doc-view-open-text')
Message-ID: <handler.72241.B.172163683331163.ack <at> debbugs.gnu.org>
References: <87jzhd4ysy.fsf@HIDDEN>
X-Gnu-PR-Message: ack 72241
X-Gnu-PR-Package: emacs
X-Gnu-PR-Keywords: patch
Reply-To: 72241 <at> debbugs.gnu.org
Date: Mon, 22 Jul 2024 08:28:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 72241 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
72241: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72241
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Tassilo Horn <tsdh@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 22 Jul 2024 18:12:01 +0000
Resent-Message-ID: <handler.72241.B72241.17216719156616 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 72241 <at> debbugs.gnu.org, Manuel Giraud <manuel@HIDDEN>
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.17216719156616
          (code B ref 72241); Mon, 22 Jul 2024 18:12:01 +0000
Received: (at 72241) by debbugs.gnu.org; 22 Jul 2024 18:11:55 +0000
Received: from localhost ([127.0.0.1]:58550 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVxVq-0001ie-J9
	for submit <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:11:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43836)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tsdh@HIDDEN>) id 1sVxVo-0001iM-3E
 for 72241 <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:11:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1sVxVe-0005Lg-65; Mon, 22 Jul 2024 14:11:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=ipaNfgWVHtkwgnVQYXk2Pi6vNNHNqsQJxWvg9UZlVcc=; b=gR13IXLuZq/XKlf8WWMU
 y3jDJ2dezHwxUypnklJ8HJhz/3ZOAeeZ/0YW6d7ud9a6ZBDN3/uU39/ddB0GShI7QevfwGLb2Qht3
 7rHGhPgxTasOJ6hfw8irvoopfJg/HySVs6ldhEtIdDRWB9ahy9DpqtSs7On7/LnuP8G+dWMtqnDND
 DDAntQ4hQR+6LQSNNTAn1gThbo/q32EWn8sd4ylD5t/Q6wnjYaeYAGfBv/uWX8rzVrqFlgqBkUtej
 XXh9A6E4+2kfLu0JzPNGfK4ZG5JKhGDqWMBqaGOhLYXqBIimzm0DU/Br1Za+uXlFe52BYKlzUXAvy
 9jKt9eG7kTYI4Q==;
X-ME-Sender: <xms:3KCeZtPshX_7TvRCWEjgaETJVJ8moyqMp_DJLsSTv3JDPV8ne4PaLg>
 <xme:3KCeZv-DRTNyxedFf9NoiGA7PsLl8ig2WKG8Zlii9P5GonRfajDA2LdmZJ9ONqtwL
 3t84imQy_vLcA>
X-ME-Received: <xmr:3KCeZsSlpBF5OhvR-3XeE4czo9Gl5sjJDG06rk9dxiwX2gVrpH5WMgi2nXMV-ieQMk-7VVIelkp2K4SNef5Zki5SkZ2Fgg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrheejgdduvdefucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufgjfhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefvrghsshhi
 lhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnheptd
 dutdeugfeihedtvddtleehfeduffetfeefiefhjeejudffgedvudettdduffetnecuvehl
 uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomh
 gvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdel
 kedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh
X-ME-Proxy: <xmx:3KCeZpsYnH2hOpjmUQHumTmt_I9oEJDTG-3IhTVsYVhztJPcIbmGfw>
 <xmx:3KCeZleAuQ46kSXVcP6-axJTQEIbzrOT_o7MMY6xdysWlD04VG2FDg>
 <xmx:3KCeZl1rZDHTepnsoElVPG5oiAFBclD9XarxZ51j4UMuDYKuGHk1AQ>
 <xmx:3KCeZh_WkFJYgiHcjS8TdH2N-8BewVwhx9Uv_INU11rFoE1hUVHrxA>
 <xmx:3KCeZg_ST5e-5XK2eqOWqHcmLFpit4qRwTUjULYztCCYf6kAOIpTUm4f>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
In-Reply-To: <87jzhd4ysy.fsf@HIDDEN> (Manuel Giraud's message of "Mon, 
 22 Jul 2024 10:26:53 +0200")
References: <87jzhd4ysy.fsf@HIDDEN>
Date: Mon, 22 Jul 2024 20:11:34 +0200
Message-ID: <87v80xwb3d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Manuel Giraud <manuel@HIDDEN> writes:

Hi Manuel,

> Here is a patch for DocView that makes it use a dedicated buffer for
> the text representation of a document.  This is what was suggested by
> Stefan M. in a comment (circa 2019).

I think that's a good idea in general and addresses a FIXME.

Since it doesn't fix a bug, I think it should only be applied to master.

Oh, and in the commit message there's an "an" where an "and" was meant.
And maybe a "text-contents buffer" is a slightly better term than "doc's
contents buffer".

I'm not sure if a NEWS entry is needed for that change.  It certainly
changes existing behavior but not in a way that usage patterns/muscle
memory would need to be adapted...

(info "(emacs) Document View") might need a small update for the
description where some requirement is not met (e.g., emacs in a TTY
frame) where it says that "the (document) buffer" is put in text mode
when one answers the query if the contents should be shown as plain text
with yes.

Bye,
  Tassilo




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 22 Jul 2024 18:31:02 +0000
Resent-Message-ID: <handler.72241.B72241.17216730148612 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: 72241 <at> debbugs.gnu.org, manuel@HIDDEN
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.17216730148612
          (code B ref 72241); Mon, 22 Jul 2024 18:31:02 +0000
Received: (at 72241) by debbugs.gnu.org; 22 Jul 2024 18:30:14 +0000
Received: from localhost ([127.0.0.1]:58573 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVxna-0002Eq-4N
	for submit <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:30:14 -0400
Received: from eggs.gnu.org ([209.51.188.92]:32804)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sVxnW-0002DT-15
 for 72241 <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:30:12 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sVxnL-0000yX-SA; Mon, 22 Jul 2024 14:30:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=g0aFA+wXrvgJ/JLJsK0QbVHJwveI+4uyRzCO8b46k/I=; b=sdicRgbPdvuZ
 Yq+zhYctnHqvDuR8SoiFV3+cCcyHtchklVCxy319zEg9xqGrAW7YDdGOZ6UvsVOfVUNHMb1GnUA8o
 +3u+zLERKpN3mUe7wn3azs6qs1ntjp8cQ9novuzwfLjcrAf/Fo7xla4VKnVw7mM6uGONhMrxWZ1GO
 m/jcogKRvZhf8zTkwiky9bumT7tx3hmqKpDhSP4HrKSqGjtKNRmB35d3Z/x+/E8OFn7AOaP0ocR0r
 fl55L6CSNEwL4SFuDCW7Mv9UFWUa94cNOamOXtDVFcfl4Iz+6Hg/Z70WqkGCHkzKhfvxwfMK1/Qox
 S/CBjbVPuWWL9EY9BBdjPA==;
Date: Mon, 22 Jul 2024 21:29:54 +0300
Message-Id: <86le1t9t5p.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87v80xwb3d.fsf@HIDDEN> (message from Tassilo Horn on Mon, 22
 Jul 2024 20:11:34 +0200)
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Tassilo Horn <tsdh@HIDDEN>
> Date: Mon, 22 Jul 2024 20:11:34 +0200
> 
> I'm not sure if a NEWS entry is needed for that change.  It certainly
> changes existing behavior but not in a way that usage patterns/muscle
> memory would need to be adapted...

Can you tell in what way the behavior will change after this?  I'd
like to think whether a NEWS entry is necessary and what to day there.

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Tassilo Horn <tsdh@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 22 Jul 2024 18:41:02 +0000
Resent-Message-ID: <handler.72241.B72241.17216736129535 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 72241 <at> debbugs.gnu.org, manuel@HIDDEN
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.17216736129535
          (code B ref 72241); Mon, 22 Jul 2024 18:41:02 +0000
Received: (at 72241) by debbugs.gnu.org; 22 Jul 2024 18:40:12 +0000
Received: from localhost ([127.0.0.1]:58586 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVxxD-0002Tj-QE
	for submit <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:40:12 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33122)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tsdh@HIDDEN>) id 1sVxxB-0002TU-UQ
 for 72241 <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:40:10 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1sVxx2-0002m5-82; Mon, 22 Jul 2024 14:40:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=JWH/dm7LimYmY8R+C+QSbJ41HRAJvXXbmWO56MZr8Yg=; b=qWKzxE349sEof/Xbu3cI
 pFF6CbvS53dCYdW3irWncDX73FgefwWhgJtXqLYpHBfxrI/y0Qu4DeVfFicdGSwd1UzQGpzdqpSdO
 88P2N3AfSo4G9CQPcAqYnQlExgrHCyKIuwJaHgcgBIrjKIfru/RDesRXrh7zcxjDhvALH6MKniGFC
 TpXIk/PhFtQNI3QybQMxyhlU8LApUV53qBR51ZWNAg6e4bb8xT6SBMpKO4tpLqCp6RiM7Szo/Rjak
 +4K+V2O1Ak0nEb9ILpQVVq1d9UPiiy/5Y0aXkd1Pj5KOyMOwDtsLDgpdxxz3mZUXyHCRzpqyimgaV
 fCfM8uw4la4NDg==;
X-ME-Sender: <xms:fqeeZgLgVs9P8d3V9nmV4_LvmFCG_IxNDSvwcA40jC4nKrRDO7XS9Q>
 <xme:fqeeZgJJDdvBwx-6Co8sJ0KSfqNwp8kSxj3Q-LHzY5A689M-kMXOl3cIR7IZUtaFY
 yniMKS6ZgacIQ>
X-ME-Received: <xmr:fqeeZgs6eDUS5BG1zF8DZxJlv9gmG-INp1rtPK-5TBLStSfQ21Pq4NKexrLqZg3y8b8E9R8xYMgQEOw45D_HkqwHiY9YLg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrheejgddufedtucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvvefujghffffkgggtsehttdertddttddtnecuhfhrohhmpefvrghsshhi
 lhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnhepte
 eltdegheffhfetkeekveekkeevgfegkeetueffleeiheekhffgffeuueegieffnecuvehl
 uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomh
 gvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdel
 kedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh
X-ME-Proxy: <xmx:fqeeZtYEXhnVKCI1n8ToHCxY__d7bXbdL-SDyluHXQJMXXYWZVAOmw>
 <xmx:fqeeZnYX7Io-nKXqGdf_buy6Xc_7w1hvdp7Zi9zUl57CqbdNEJ52XQ>
 <xmx:fqeeZpCdSLnPDYbTwozkoOM77xaLut2tyYqOyMQN8n9CxFFyUpOsSQ>
 <xmx:fqeeZtYH2LRCNT825IqfSbEGJ0_lo-DoU7_2aycLijVwJQrGcSKrNg>
 <xmx:fqeeZvpm_uzHzs4WRemB9n4_MuMrFVvtYVu71XkMR19bNPaxaXpG-2jO>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
In-Reply-To: <86le1t9t5p.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 22 Jul
 2024 21:29:54 +0300")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN>
Date: Mon, 22 Jul 2024 20:39:54 +0200
Message-ID: <87r0blw9s5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Tassilo Horn <tsdh@HIDDEN>
>> Date: Mon, 22 Jul 2024 20:11:34 +0200
>> 
>> I'm not sure if a NEWS entry is needed for that change.  It certainly
>> changes existing behavior but not in a way that usage patterns/muscle
>> memory would need to be adapted...
>
> Can you tell in what way the behavior will change after this?  I'd
> like to think whether a NEWS entry is necessary and what to day there.

Right now, when you open foo.pdf you see the images generated from the
PDF.  When you do C-c C-t, it'll replace the foo.pdf buffer contents
with the plain text contents of the PDF.  With another C-c C-c, the
contents are again replaced with the PDF and you see the images again.

With Manuel's patch, C-c C-t shows the plain text contents in a separate
buffer foo.pdf/text.  C-c C-c in there kills that separate buffer and
switches back to the original foo.pdf buffer.

So basically everything you have to do stays the same but there are now
two instead of just one buffer.  That has the advantage that you can
switch between them and removes the possibility that you accidentally
overwrite your PDF with the plain text contents (which in what Stefan's
FIXME was about).

Bye,
  Tassilo




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 22 Jul 2024 18:49:01 +0000
Resent-Message-ID: <handler.72241.B72241.172167412810385 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: 72241 <at> debbugs.gnu.org, manuel@HIDDEN
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172167412810385
          (code B ref 72241); Mon, 22 Jul 2024 18:49:01 +0000
Received: (at 72241) by debbugs.gnu.org; 22 Jul 2024 18:48:48 +0000
Received: from localhost ([127.0.0.1]:58596 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sVy5Y-0002hQ-7b
	for submit <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:48:48 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56354)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sVy5W-0002hD-Cp
 for 72241 <at> debbugs.gnu.org; Mon, 22 Jul 2024 14:48:46 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sVy5J-0004qJ-Gx; Mon, 22 Jul 2024 14:48:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=5dUJv0TR4AAPF3ia1wWvHlSHoYcnCJBUBL2x3gNBPqk=; b=Dkr9Z19i59GJ
 mfRHTRpj3Og9Zq7j63v/XvC0O/ydKA5a+zsXl0Sm80h2yvldss35DRunE41eu795s0ibMQm661OTy
 anDLGbuHzJ/hFWMoRLcmJN7dsn7mPgoOvIeA2YAvKwdc8zWlnSRvqg2I2Y9lASG+ZvXwC3I7SZ1qn
 Aq5e7aTFM13Ry/10en0mhTDUm7vZ9NneoNhZkLcMP/nLG5T4CY+mpA6LXKBQGbGJEkJSkKCC7/E1/
 bwp7cQv16R9T44o9wmfpR/XPhrLAxDWGRc6xKSrB5GZj/45PBxP5smTzwJqbG/UtTMeObk/aMMsH0
 8LSUjdrjcgdz0Oj2mfRlfw==;
Date: Mon, 22 Jul 2024 21:48:27 +0300
Message-Id: <86jzhd9sas.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87r0blw9s5.fsf@HIDDEN> (message from Tassilo Horn on Mon, 22
 Jul 2024 20:39:54 +0200)
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Tassilo Horn <tsdh@HIDDEN>
> Cc: 72241 <at> debbugs.gnu.org,  manuel@HIDDEN
> Date: Mon, 22 Jul 2024 20:39:54 +0200
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Can you tell in what way the behavior will change after this?  I'd
> > like to think whether a NEWS entry is necessary and what to day there.
> 
> Right now, when you open foo.pdf you see the images generated from the
> PDF.  When you do C-c C-t, it'll replace the foo.pdf buffer contents
> with the plain text contents of the PDF.  With another C-c C-c, the
> contents are again replaced with the PDF and you see the images again.
> 
> With Manuel's patch, C-c C-t shows the plain text contents in a separate
> buffer foo.pdf/text.  C-c C-c in there kills that separate buffer and
> switches back to the original foo.pdf buffer.
> 
> So basically everything you have to do stays the same but there are now
> two instead of just one buffer.  That has the advantage that you can
> switch between them and removes the possibility that you accidentally
> overwrite your PDF with the plain text contents (which in what Stefan's
> FIXME was about).

Thanks, I think this is enough in users' faces to warrant a NEWS
entry.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Manuel Giraud <manuel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 07:56:02 +0000
Resent-Message-ID: <handler.72241.B72241.172172132815376 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172172132815376
          (code B ref 72241); Tue, 23 Jul 2024 07:56:02 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 07:55:28 +0000
Received: from localhost ([127.0.0.1]:59183 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWAMq-0003zw-A7
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 03:55:28 -0400
Received: from ledu-giraud.fr ([51.159.28.247]:45304)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manuel@HIDDEN>) id 1sWAMl-0003zd-9O
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 03:55:26 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=mkYOH6vb
 A9sjhUvJfZOZRNxwqrTf5hK1jVv67F0P6yE=;
 h=date:references:in-reply-to:
 subject:cc:to:from; d=ledu-giraud.fr; b=lTkXbcvvm/VmWBAveCnsrhOcMNB5w7
 CFbzSKJCCt5k7Ly1XQf5AcAwWzRT1d9yEZHUcBMudoFpnsXyRkg19DCw==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=mkYOH6vbA9sjhUvJ
 fZOZRNxwqrTf5hK1jVv67F0P6yE=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=ledu-giraud.fr; b=djljD3KABA7VWMVU4lxIOGP1rPjTDGdpAroTcq
 8NhgIwFI76OoJj44slIrC8ptEKkSQqtt+x/L4bBMej15s2m/PhGs7EANxaTuI7IY/GvN48
 jYwr7W60WjBriloHxpCOa3xKOjnQZPYC+/Cj7yNWPVuCtmKEmSQt+iqh/vUHxTX2nbxQhG
 PaI1mtINU2t/nhWjPjkBVlkEpR2i15pZhiQsObeVTH6royV5Wqr21THMllF8ZlpDn4ushh
 p8J7bHL708uh7gp6SCFcd6T5Zni7eBBUeNgk/6mNSplqJjkOYmhudHUbOvrZoGRGX89uGd
 kvJ8l9sYVv6op3aN9Abft1nA==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 27cd740c
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 23 Jul 2024 09:55:17 +0200 (CEST)
From: Manuel Giraud <manuel@HIDDEN>
In-Reply-To: <87v80xwb3d.fsf@HIDDEN> (Tassilo Horn's message of "Mon, 22 Jul
 2024 20:11:34 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 09:55:14 +0200
Message-ID: <87ed7kk0f1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Tassilo Horn <tsdh@HIDDEN> writes:

> Manuel Giraud <manuel@HIDDEN> writes:
>
> Hi Manuel,
>
>> Here is a patch for DocView that makes it use a dedicated buffer for
>> the text representation of a document.  This is what was suggested by
>> Stefan M. in a comment (circa 2019).
>
> I think that's a good idea in general and addresses a FIXME.
>
> Since it doesn't fix a bug, I think it should only be applied to
> master.

Yes, I also do think so.

> Oh, and in the commit message there's an "an" where an "and" was meant.
> And maybe a "text-contents buffer" is a slightly better term than "doc's
> contents buffer".

Ok.  I'll fix that.

[...]

> (info "(emacs) Document View") might need a small update for the
> description where some requirement is not met (e.g., emacs in a TTY
> frame) where it says that "the (document) buffer" is put in text mode
> when one answers the query if the contents should be shown as plain text
> with yes.

I have not tested in a TTY=E2=80=A6 maybe I should =F0=9F=98=85
--=20
Manuel Giraud




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Manuel Giraud <manuel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 08:11:02 +0000
Resent-Message-ID: <handler.72241.B72241.172172224416887 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172172224416887
          (code B ref 72241); Tue, 23 Jul 2024 08:11:02 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 08:10:44 +0000
Received: from localhost ([127.0.0.1]:59196 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWAbb-0004OJ-MC
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 04:10:43 -0400
Received: from ledu-giraud.fr ([51.159.28.247]:41514)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manuel@HIDDEN>) id 1sWAbY-0004O7-Ix
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 04:10:42 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=bfwvOFjw
 uT1TIpvxUol0MwiCth5SEG2sjoZCP23qmxw=;
 h=date:references:in-reply-to:
 subject:cc:to:from; d=ledu-giraud.fr; b=DKigLBa2luCKm2Du8UDcf8NNzF8iKD
 /bgp7UWqyP0Ycn7hISMFSk6Raufuqd+6KtzPRhD9UlN7JsvZ/tF5x9Ag==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=bfwvOFjwuT1TIpvx
 Uol0MwiCth5SEG2sjoZCP23qmxw=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=ledu-giraud.fr; b=TdNIPt/ciuTSemTSOYLV+vEO1yP5dXvrKjOyja
 luI+laEAzzqSm8DYbMmmS7SrD5aT/NRo2VhsZR8iZleFQMP/4seH8EfW0Q8qyLWaF5ORFG
 4z6vimMokuuq2yy0VJvdnHbms0Wy4nCLnO5QUUD8YrDiUpPTTDIIxoED+dx0tfLR0QM42+
 f47eXaUeJv6YIDjdp1JUKICX+5MCv69WZvaGIxjLvHBan/tLSgYOnYVyhAxuGMmFzt87/b
 K8MqwsEyTGkNxSpvZ41BtdIcwYKbdIfYuFQVb61iQvP56s+1800c+YIVimEFxWf1HB1CHS
 wOB+z4VFjAgwNYHuPhcQt0qw==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id b92f2a5f
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 23 Jul 2024 10:10:34 +0200 (CEST)
From: Manuel Giraud <manuel@HIDDEN>
In-Reply-To: <87r0blw9s5.fsf@HIDDEN> (Tassilo Horn's message of "Mon, 22 Jul
 2024 20:39:54 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 10:10:32 +0200
Message-ID: <87a5i8jzpj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Tassilo Horn <tsdh@HIDDEN> writes:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> From: Tassilo Horn <tsdh@HIDDEN>
>>> Date: Mon, 22 Jul 2024 20:11:34 +0200
>>> 
>>> I'm not sure if a NEWS entry is needed for that change.  It certainly
>>> changes existing behavior but not in a way that usage patterns/muscle
>>> memory would need to be adapted...
>>
>> Can you tell in what way the behavior will change after this?  I'd
>> like to think whether a NEWS entry is necessary and what to day there.
>
> Right now, when you open foo.pdf you see the images generated from the
> PDF.  When you do C-c C-t, it'll replace the foo.pdf buffer contents
> with the plain text contents of the PDF.  With another C-c C-c, the
> contents are again replaced with the PDF and you see the images again.

FWIW, this is not the current behaviour that I see:

      - C-c C-t replace the buffer contents with the text version
      
      - C-c C-c, DocView switches back to the "edit" view: the raw
        content of a PDF for instance is displayed into the buffer.

      - another C-c C-c, DocView switches to the "display" view where
        you see the images again

Maybe while here, we should clarify how DocView cycles through those 3
view: display, edit and text.  Or maybe, there is no 3-states cycling
and the "text contents" view is just considered a "side" view.  WDYT?
-- 
Manuel Giraud




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Tassilo Horn <tsdh@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 10:41:02 +0000
Resent-Message-ID: <handler.72241.B72241.172173120131681 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Manuel Giraud <manuel@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172173120131681
          (code B ref 72241); Tue, 23 Jul 2024 10:41:02 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 10:40:01 +0000
Received: from localhost ([127.0.0.1]:59280 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWCw5-0008Ej-20
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 06:40:01 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43666)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tsdh@HIDDEN>) id 1sWCw2-0008ER-Kr
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 06:39:59 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1sWCvr-0006Xm-RH; Tue, 23 Jul 2024 06:39:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=FUV4sTcg1JyM0cW7wVGOJnI7WQwgCc1hzTEaAESeScQ=; b=gK4F5HBnhs29UI/9ON0t
 AdVZ9HVGSpmPvK3U0IsI4kBee1oHXSc3YT883/sENQnFx1JbWIh79fe3CkvLKmGCOdQWS/h0tG0u0
 SsZFMGVm0bs0lFColTx2SaFfpM2N7ZpEcf3Du1yNtR9VlUVevTESalv/SmHjRBidGTEncZ1Vk9Y+N
 gAFWO5ZR1F6p7yTbyT7qSjAH6JgmY3IAtj1ZteDU+gux8+HPXCWGrQ+w+Iub7toP2Yy6ZnwIGhmUI
 usmAJfE4a/HIZX9KwUrt2iMuAFU2cqEJ9/yeMmgRpHB93x9B3oARAR1htZB70lZG0T9bX/t0KkFAo
 3+jEMY8xj+d73A==;
X-ME-Sender: <xms:a4ifZo9ETgSmlhXZbs5SXTCgcxwrd6mTjGsUhwkYHnhi73rk4jxhAg>
 <xme:a4ifZgvHtaT7VniFDFDe4SpGttIdlkEq1brH5NdOqce6QStju9mNK98lRD0Ke4fI3
 eiWhmBvqou9Vg>
X-ME-Received: <xmr:a4ifZuD5vXHZogyH5du33C0VizbrbxpfNEj_txaCrUj9Qppx4fLaKu_h8TArZSdotpopZXOoPwrVxJ5UXutiDwWwot1Q4Q>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrheelgdefudcutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvfevufgjfhffkfggtgesthdtredttddttdenucfhrhhomhepvfgrshhsihhl
 ohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpeetle
 dtgeehfffhteekkeevkeekvefggeekteeuffelieehkefhgfffueeugeeiffenucevlhhu
 shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvg
 hsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleek
 qdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhmpdhnsggprhgtphhtth
 hopedt
X-ME-Proxy: <xmx:a4ifZocQxvu-O_dscW3nutWkX8SxrO3vWYP9kpAixkTbVBthTb8kYQ>
 <xmx:a4ifZtMX5rANyEytf2c687n3K3lrkBg4yRfndqbby80suHkuzi3SQQ>
 <xmx:a4ifZilTynwJNRyE3JibOwj8-94efG-k28IPvfY4jmoNiTqjgIoBBQ>
 <xmx:a4ifZvvPRZPZCe0z1mM4387pb1_3n-c5ZbeLjBN-XrLnkZa9rlmutQ>
 <xmx:a4ifZrvcqdusAztlO2o8PDJBWWJ7RAORJIv1dJRW-eISCXmVTKtgt-7l>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
In-Reply-To: <87a5i8jzpj.fsf@HIDDEN> (Manuel Giraud's message of "Tue, 
 23 Jul 2024 10:10:32 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
 <87a5i8jzpj.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 12:39:35 +0200
Message-ID: <87ttggl7dk.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Manuel Giraud <manuel@HIDDEN> writes:

Hi,

>>> Can you tell in what way the behavior will change after this?  I'd
>>> like to think whether a NEWS entry is necessary and what to day there.
>>
>> Right now, when you open foo.pdf you see the images generated from
>> the PDF.  When you do C-c C-t, it'll replace the foo.pdf buffer
>> contents with the plain text contents of the PDF.  With another C-c
>> C-c, the contents are again replaced with the PDF and you see the
>> images again.
>
> FWIW, this is not the current behaviour that I see:
>
>       - C-c C-t replace the buffer contents with the text version
>       
>       - C-c C-c, DocView switches back to the "edit" view: the raw
>         content of a PDF for instance is displayed into the buffer.
>
>       - another C-c C-c, DocView switches to the "display" view where
>         you see the images again

That's right and my answer was aproximately correct.  The beef is that
for the "text version", you get a separate buffer with your patch.
"edit" and "display" are in the same buffer because the contents (raw
PDF, DVI, PostScript,...) are the same, just how they are presented to
the user differs.

> Maybe while here, we should clarify how DocView cycles through those 3
> view: display, edit and text.  Or maybe, there is no 3-states cycling
> and the "text contents" view is just considered a "side" view.  WDYT?

Here's a state machine describing the current behavior.

    display <-- C-c C-c --> edit
    \     ^
     \     \    
 C-c C-t  C-c C-c
       \     \
        `> text

So with C-c C-c you can toggle between "display" and "edit" which just
changes how the buffer contents are presented to the user (images or raw
text).

In the "display" state C-c C-t one gets a plain text version of the
contents, and that's in a separate foo.pdf/text buffer with Manuel's
patch.  In there, C-c C-c kills the foo.pdf/text buffer and returns to
the original foo.pdf buffer.

However, that now one can switch between foo.pdf and foo.pdf/text
independently, there is no guarantee that C-c C-c in the foo.pdf/text
buffer will return to foo.pdf in "display" state.  One could have
toggled to edit state there or even killed the foo.pdf buffer, so
there's nothing to return to.

So I'd say: right now it is a state machine with 3 states but with
Manuel's patch the current "text" state becomes an auxiliary view.

Bye,
  Tassilo




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Manuel Giraud <manuel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 12:01:02 +0000
Resent-Message-ID: <handler.72241.B72241.172173601717997 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172173601717997
          (code B ref 72241); Tue, 23 Jul 2024 12:01:02 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 12:00:17 +0000
Received: from localhost ([127.0.0.1]:59384 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWEBl-0004gC-4Z
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 08:00:17 -0400
Received: from ledu-giraud.fr ([51.159.28.247]:6672)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manuel@HIDDEN>) id 1sWEBf-0004fy-Sv
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 08:00:15 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=XiCfD89/
 Qnhr0wo5VHzuckwMHI8WSFx6CuEAnyTOfT8=;
 h=date:references:in-reply-to:
 subject:cc:to:from; d=ledu-giraud.fr; b=bdCcsXsYwIvgHgY8Z8op/wRPkHrD+r
 ru6ayl1+yUj2wC6VZ8EII4B86vQzDMSOhD3xIG3ya3FKh8qCqp2HT/Aw==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=XiCfD89/Qnhr0wo5
 VHzuckwMHI8WSFx6CuEAnyTOfT8=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=ledu-giraud.fr; b=SFwqzpLVXhiJf3yEp4JL3yxpax4frLPIaip3j/
 FwhCxgtDjV9tDUizQO38hDlxNxcV0BbzI+3JUQVm7+3xmMoBjHYnaZVfUFnxfntvfTcgPC
 wjysKaX1h0dq8elcVhbaIVj3Kcw0WnVStk9oh0hGcRZgF7nynjAWDzM+s4puXbZvYjX1lq
 SpfyOy80Ui0U5wHJ/+w5neX9cLBt3n9Dm2ZQ4MjCu68TWN79UXYw4Hc6YN6ot3QZMdy/ok
 SWMHLQ33UuG2F34OG7iJhMspdDw1FOHQE9SgKezVBoIDmxlrkABI7d+wcUPLKW78tZ8JoG
 dgJpVGq/myCGr36CqR/kbbJA==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 318935e3
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 23 Jul 2024 14:00:04 +0200 (CEST)
From: Manuel Giraud <manuel@HIDDEN>
In-Reply-To: <87ttggl7dk.fsf@HIDDEN> (Tassilo Horn's message of "Tue, 23 Jul
 2024 12:39:35 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
 <87a5i8jzpj.fsf@HIDDEN> <87ttggl7dk.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 14:00:03 +0200
Message-ID: <87frs0b9oc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Tassilo Horn <tsdh@HIDDEN> writes:

[...]

>> Maybe while here, we should clarify how DocView cycles through those 3
>> view: display, edit and text.  Or maybe, there is no 3-states cycling
>> and the "text contents" view is just considered a "side" view.  WDYT?
>
> Here's a state machine describing the current behavior.
>
>     display <-- C-c C-c --> edit
>     \     ^
>      \     \
>  C-c C-t  C-c C-c
>        \     \
>         `> text

I think the current behavior is more like this (I suck at ASCII art):

    display <-- C-c C-c --> edit
    \                      ^
     \                  /--
 C-c C-t            C-c C-c
       \        /--
        `> text

Your state machine is what my patch gives you.

[...]

> However, that now one can switch between foo.pdf and foo.pdf/text
> independently, there is no guarantee that C-c C-c in the foo.pdf/text
> buffer will return to foo.pdf in "display" state.  One could have
> toggled to edit state there or even killed the foo.pdf buffer, so
> there's nothing to return to.

Yes, you're right.  In the latter case (the foo.pdf buffer was killed
otherwise), a C-c C-c in the foo.pdf/text buffer just kill it, go to
another buffer and the document is not open anywhere in any form.  Maybe
it is a not so bad behavior.

> So I'd say: right now it is a state machine with 3 states but with
> Manuel's patch the current "text" state becomes an auxiliary view.

Yes.  So I'm going to try to fix my patch with your remarks (maybe fix
the info also) and come up with a NEWS entry.  Thanks.
-- 
Manuel Giraud




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Tassilo Horn <tsdh@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 12:17:02 +0000
Resent-Message-ID: <handler.72241.B72241.172173700419483 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Manuel Giraud <manuel@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172173700419483
          (code B ref 72241); Tue, 23 Jul 2024 12:17:02 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 12:16:44 +0000
Received: from localhost ([127.0.0.1]:59395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWERg-00054B-70
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 08:16:44 -0400
Received: from eggs.gnu.org ([209.51.188.92]:35758)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tsdh@HIDDEN>) id 1sWERd-00053x-DN
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 08:16:42 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1sWERS-0003wf-Ib; Tue, 23 Jul 2024 08:16:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=E68U7Qzyj4X0zs8PVwUKy/aCWgtoi8hFjPs1EH6/Z1Y=; b=kxaUjLBtexwVuU2szMOA
 p9nrvJs4izuTKTjxxMSwPh7W1umepFV50ns6qqPO3cR5xfaHfGTizrGk5MeYjGG35qeF5YcWvNB/b
 seBT/1lpuaojhWK1Dp9lfGD2BVzgw2qjuD+zzK7EKe/gh4B3Kp4sKnbuTrkA7qJ8DbibQXzGaRU9Q
 GbWnt2ufOq6Ra3/hOuwG6c7ZDmzX5L9o7Z3nOsrAZMxARgszXMia1RjRgQvB/OpXkcI5SuVWG4loB
 XYcNXuXMHvZw1jvIXd2q1VnUEm0AxRkHfpXIl2LMVv2WqpSTJcRgmvreuOrXhT4TW1Zsc8qHL4fqe
 zqP6R29iqtI3MA==;
X-ME-Sender: <xms:G5-fZl1Inmvptgf-FxjDGWQPmdHlDjjDKl0SITI3VqJJGB6rmsJZ8A>
 <xme:G5-fZsF5GqvKZRB1UsOY1yGdh7A-CgNHCr31x1VYOVXONjpoYa3MBezvb6zwgeCFY
 OirsA92D9Y0Cg>
X-ME-Received: <xmr:G5-fZl6V9TbUtlZD-YEpBbRfrD1qMTR3b0VW9AyIyh1EKNhdtgRNQ7vy6cevpOxL7AIHxE1X9cAOe58SAX3virIuGH9bIQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrheelgdehtdcutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvfevufgjfhffkfggtgesthdtredttddttdenucfhrhhomhepvfgrshhsihhl
 ohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpeetle
 dtgeehfffhteekkeevkeekvefggeekteeuffelieehkefhgfffueeugeeiffenucevlhhu
 shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvg
 hsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleek
 qdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhmpdhnsggprhgtphhtth
 hopedt
X-ME-Proxy: <xmx:G5-fZi15ToYsjl3u70dMFZWOQHYewWrfhtzeXd1Gwefkk4LhCdAlig>
 <xmx:G5-fZoHKB6ix5AbGX5TOZv8w3uqelksIEcsOBK_i9hT7ym6q-g9l9w>
 <xmx:G5-fZj-7E5kIm6_6yXiOFVr6FQyR90tLp9keomCQMk7k2ve2_OJjCQ>
 <xmx:G5-fZlnlUpr48dnjDkB5id9lxylxGF-hdy--EXtDDQtgBE39PGPeIA>
 <xmx:G5-fZsFpFtS73LESz--az5xDFkU1jtCos7rVR0p-pABXQfKKu2hu3SuG>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
In-Reply-To: <87frs0b9oc.fsf@HIDDEN> (Manuel Giraud's message of "Tue, 
 23 Jul 2024 14:00:03 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
 <87a5i8jzpj.fsf@HIDDEN> <87ttggl7dk.fsf@HIDDEN>
 <87frs0b9oc.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 14:16:24 +0200
Message-ID: <87le1sl2w7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Manuel Giraud <manuel@HIDDEN> writes:

>> Here's a state machine describing the current behavior.
>>
>>     display <-- C-c C-c --> edit
>>     \     ^
>>      \     \
>>  C-c C-t  C-c C-c
>>        \     \
>>         `> text
>
> I think the current behavior is more like this (I suck at ASCII art):
>
>     display <-- C-c C-c --> edit
>     \                      ^
>      \                  /--
>  C-c C-t            C-c C-c
>        \        /--
>         `> text

You are right.

>> However, that now one can switch between foo.pdf and foo.pdf/text
>> independently, there is no guarantee that C-c C-c in the foo.pdf/text
>> buffer will return to foo.pdf in "display" state.  One could have
>> toggled to edit state there or even killed the foo.pdf buffer, so
>> there's nothing to return to.
>
> Yes, you're right.  In the latter case (the foo.pdf buffer was killed
> otherwise), a C-c C-c in the foo.pdf/text buffer just kill it, go to
> another buffer and the document is not open anywhere in any form.
> Maybe it is a not so bad behavior.

No, I think that's ok.

>> So I'd say: right now it is a state machine with 3 states but with
>> Manuel's patch the current "text" state becomes an auxiliary view.
>
> Yes.  So I'm going to try to fix my patch with your remarks (maybe fix
> the info also) and come up with a NEWS entry.  Thanks.

Great, thanks!

Bye,
  Tassilo




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Manuel Giraud <manuel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 13:46:01 +0000
Resent-Message-ID: <handler.72241.B72241.17217423567223 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.17217423567223
          (code B ref 72241); Tue, 23 Jul 2024 13:46:01 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 13:45:56 +0000
Received: from localhost ([127.0.0.1]:59527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWFpz-0001sR-RK
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 09:45:56 -0400
Received: from ledu-giraud.fr ([51.159.28.247]:19795)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manuel@HIDDEN>) id 1sWFpt-0001sA-Vd
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 09:45:54 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=yG79JTUm
 C6mt45qg7avAkLb3jLXQpZ46T0oNRy5PIps=;
 h=date:references:in-reply-to:
 subject:cc:to:from; d=ledu-giraud.fr; b=k2dP92wJzKLciwkQ9i1hfJdz6OB1WM
 kjQG4xfFTmsqt0NLxRd5zMGGyF2E6J7ebXvZbT/lHaYPY6twCkNQGXBg==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=yG79JTUmC6mt45qg
 7avAkLb3jLXQpZ46T0oNRy5PIps=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=ledu-giraud.fr; b=vH30eFeVmAlwedTjF7neVryjqtL2qXg4IlpsAi
 ZXrjXrZyeIGt+3pPKG+yoOnBQJ2NhhhUs2qWO6C5U0IFOGTKYCqYToQtHvCNuN267CgFUM
 57zXseL7gI9KainXVGn98aKjqq2y74gj70AKxjKPy3q4KBwBwqHk8PsBzU1Q6ijyMi8W3g
 gG4dvhwGItwYLxjvggWyuPcljNc0jhOesnkSmcSOYANL+/I6esJ00xB3sBrFTFGBw1uLlX
 96qvbSxNzm5zqF5kbbNUA5TbGqyTg8e1F0Hza1MXIWGJHoZWuOgVeOKz1oLqYfLc8rHkEN
 dXJI60KrUMA3eeBfIosuQZ/A==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id a97ea816
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 23 Jul 2024 15:45:44 +0200 (CEST)
From: Manuel Giraud <manuel@HIDDEN>
In-Reply-To: <87le1sl2w7.fsf@HIDDEN> (Tassilo Horn's message of "Tue, 23 Jul
 2024 14:16:24 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
 <87a5i8jzpj.fsf@HIDDEN> <87ttggl7dk.fsf@HIDDEN>
 <87frs0b9oc.fsf@HIDDEN> <87le1sl2w7.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 15:45:43 +0200
Message-ID: <87bk2ob4s8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Tassilo Horn <tsdh@HIDDEN> writes:

[...]

>> Yes.  So I'm going to try to fix my patch with your remarks (maybe fix
>> the info also) and come up with a NEWS entry.  Thanks.
>
> Great, thanks!

Hi again,

I don't think I'm going to modify the info page with this patch.  I've
just tested on TTY emacs to open a PDF and both without and with my
patch DocView does not load and the buffer stays in fundamental-mode.
So I guess, we need more work in this area.
-- 
Manuel Giraud




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Resent-From: Manuel Giraud <manuel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 23 Jul 2024 14:33:02 +0000
Resent-Message-ID: <handler.72241.B72241.172174516412759 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 72241
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Tassilo Horn <tsdh@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 72241 <at> debbugs.gnu.org
Received: via spool by 72241-submit <at> debbugs.gnu.org id=B72241.172174516412759
          (code B ref 72241); Tue, 23 Jul 2024 14:33:02 +0000
Received: (at 72241) by debbugs.gnu.org; 23 Jul 2024 14:32:44 +0000
Received: from localhost ([127.0.0.1]:60458 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sWGZH-0003Jh-Eg
	for submit <at> debbugs.gnu.org; Tue, 23 Jul 2024 10:32:43 -0400
Received: from ledu-giraud.fr ([51.159.28.247]:9484)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manuel@HIDDEN>) id 1sWGZB-0003JS-FV
 for 72241 <at> debbugs.gnu.org; Tue, 23 Jul 2024 10:32:42 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=PsxDq8yV
 nZRfphc6fdrh4dKLC3AIditNKL/cgV0KBsk=;
 h=date:references:in-reply-to:
 subject:cc:to:from; d=ledu-giraud.fr; b=mQSKd02Nngtba1jFy/EttJPmbKGRxV
 rkvec5GkMMSq+W2PW+e4+Adj/duhvlElVNgpORFm8qna6KZZfUKjlgDg==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=PsxDq8yVnZRfphc6
 fdrh4dKLC3AIditNKL/cgV0KBsk=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=ledu-giraud.fr; b=irf5EsWipzIJUlWhbqp8YQN0xtjIQy+p5H3yzG
 wmy7En4W5qlbx7l6bpaL/wOnm56qNOaRoX9O19M9fSeuf/3pFqrcaY6XwSkeIs6XLjn8Pf
 +U/OLssgh2QT25opinrJNGkaT/xKcUf+Ue0cr4i+yOxkiiarL487UzP0uyZXs3hrFvc58T
 PphEkO1Qzc4uKrLbDTEHhNfVpNy+7L1cp8f6QMLfSGhpUSPbITgV2UdSfgph4sqEdNkyTq
 SUCv2qRIdmlB9a25rArwYu3Cqfy0Gn9aL3Hj5bhQcA8WwSNLmzjptxnABa/LTOgTLQ1iL9
 h4CPFBWGApRYz3CZeDNodkmg==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 8389162c
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 23 Jul 2024 16:32:31 +0200 (CEST)
From: Manuel Giraud <manuel@HIDDEN>
In-Reply-To: <87le1sl2w7.fsf@HIDDEN> (Tassilo Horn's message of "Tue, 23 Jul
 2024 14:16:24 +0200")
References: <87jzhd4ysy.fsf@HIDDEN> <87v80xwb3d.fsf@HIDDEN>
 <86le1t9t5p.fsf@HIDDEN> <87r0blw9s5.fsf@HIDDEN>
 <87a5i8jzpj.fsf@HIDDEN> <87ttggl7dk.fsf@HIDDEN>
 <87frs0b9oc.fsf@HIDDEN> <87le1sl2w7.fsf@HIDDEN>
Date: Tue, 23 Jul 2024 16:32:30 +0200
Message-ID: <877cdcb2m9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Here is an updated version of this patch.  WDYT?

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Use-a-dedicated-buffer-for-doc-view-open-text.patch

From 6e32534012cafeda1d7e67aab23a8206bc887c9f Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@HIDDEN>
Date: Sun, 21 Jul 2024 18:52:52 +0200
Subject: [PATCH] Use a dedicated buffer for `doc-view-open-text'

* lisp/doc-view.el (doc-view-open-text): Create a new "text
contents" buffer and switch to it.
(doc-view-toggle-display): Switch back to the document buffer
and kill the "text contents" one.
* etc/NEWS: Mention the change.
---
 etc/NEWS         |  7 ++++++
 lisp/doc-view.el | 60 +++++++++++++++++++-----------------------------
 2 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index d683db606ec..81382200eef 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -149,6 +149,13 @@ This affects calls to 'warn', 'lwarn', 'display-warning', and
 In most cases, having it enabled leads to a large amount of false
 positives.
 
+** DocView
+
+---
+*** Dedicated buffer for plain text contents.
+When switching to the plain text contents with 'doc-view-open-text',
+DocView now creates a dedicated buffer to display it. 'C-c C-c' gets you
+back to real DocView buffer if it still exists.
 
 * New Modes and Packages in Emacs 31.1
 
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 801783bd766..6313ee83857 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1768,34 +1768,25 @@ doc-view-open-text
     (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))
           (page (doc-view-current-page)))
       (if (file-readable-p txt)
-	  (let ((inhibit-read-only t)
-		(buffer-undo-list t)
-		(dv-bfn doc-view--buffer-file-name))
-	    (erase-buffer)
-            ;; FIXME: Replacing the buffer's PDF content with its txt rendering
-            ;; is pretty risky.  We should probably use *another*
-            ;; buffer instead, so there's much less risk of
-            ;; overwriting the PDF file with some text rendering.
-	    (set-buffer-multibyte t)
-	    (insert-file-contents txt)
-	    (doc-view--text-view-mode)
-	    (setq-local doc-view--buffer-file-name dv-bfn)
-	    (set-buffer-modified-p nil)
-	    (doc-view-minor-mode)
-            (goto-char (point-min))
-            ;; Put point at the start of the page the user was
-            ;; reading.  Pages are separated by Control-L characters.
-            (re-search-forward page-delimiter nil t (1- page))
-	    (add-hook 'write-file-functions
-		      (lambda ()
-                        ;; FIXME: If the user changes major mode and then
-                        ;; saves the buffer, the PDF file will be clobbered
-                        ;; with its txt rendering!
-			(when (eq major-mode 'doc-view--text-view-mode)
-			  (error "Cannot save text contents of document %s"
-				 buffer-file-name)))
-		      nil t))
-	(doc-view-doc->txt txt 'doc-view-open-text)))))
+          (let ((dv-bfn doc-view--buffer-file-name)
+                (dv-text-buffer-name (format "%s/text" (buffer-name))))
+            ;; Prepare the text buffer
+            (with-current-buffer (get-buffer-create dv-text-buffer-name)
+              (let ((inhibit-read-only t)
+                    (buffer-undo-list t))
+                (erase-buffer)
+                (set-buffer-multibyte t)
+                (insert-file-contents txt)
+                (doc-view--text-view-mode)
+                (setq-local doc-view--buffer-file-name dv-bfn)
+                (set-buffer-modified-p nil)
+                (doc-view-minor-mode)
+                (goto-char (point-min))
+                ;; Put point at the start of the page the user was
+                ;; reading.  Pages are separated by Control-L characters.
+                (re-search-forward page-delimiter nil t (1- page))))
+            (switch-to-buffer (get-buffer dv-text-buffer-name)))
+        (doc-view-doc->txt txt 'doc-view-open-text)))))
 
 ;;;;; Toggle between editing and viewing
 
@@ -1816,14 +1807,11 @@ doc-view-toggle-display
     (doc-view-fallback-mode)
     (doc-view-minor-mode 1))
    ((eq major-mode 'doc-view--text-view-mode)
-    (let ((buffer-undo-list t))
-      ;; We're currently viewing the document's text contents, so switch
-      ;; back to .
-      (setq buffer-read-only nil)
-      (insert-file-contents doc-view--buffer-file-name nil nil nil t)
-      (doc-view-fallback-mode)
-      (doc-view-minor-mode 1)
-      (set-buffer-modified-p nil)))
+    ;; We're currently viewing the document's text contents, switch to
+    ;; the buffer visiting the real document and kill myself.
+    (let ((dv-buffer (find-buffer-visiting doc-view--buffer-file-name)))
+      (kill-buffer)
+      (switch-to-buffer dv-buffer)))
    (t
     ;; Switch to doc-view-mode
     (when (and (buffer-modified-p)
-- 
2.45.2


--=-=-=
Content-Type: text/plain

-- 
Manuel Giraud

--=-=-=--





Last modified: Tue, 23 Jul 2024 14:45:01 UTC

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