unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
@ 2023-09-05 17:12 Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-06 10:57 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-05 17:12 UTC (permalink / raw)
  To: 65762

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

Tags: patch

This fixes an issue in `tex-recenter-output-buffer` (which affect
several other commands that rely on it) where it calls `display-buffer`
and tries to select the returned window, without checking that
`display-buffer` returned non-nil.  This leads to an error when
`display-tex-shell-buffer-action` or `display-buffer-alist` are
configured to prevent the display of the *tex-shell* buffer.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-error-in-tex-recenter-output-buffer.patch --]
[-- Type: text/patch, Size: 1666 bytes --]

From fb27907c07cf124773c1ae7add4a26be8ce02bbd Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
Date: Tue, 5 Sep 2023 18:58:02 +0200
Subject: [PATCH] ; Fix error in 'tex-recenter-output-buffer'

* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer): Check that
'display-buffer' returned a window, rather than nil, before selecting it.
---
 lisp/textmodes/tex-mode.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 41c4a6a1373..a26e7b9c83a 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -2673,17 +2673,17 @@ tex-recenter-output-buffer
 The last line of the buffer is displayed on
 line LINE of the window, or centered if LINE is nil."
   (interactive "P")
-  (let ((tex-shell (get-buffer "*tex-shell*"))
-	(window))
+  (let ((tex-shell (get-buffer "*tex-shell*")))
     (if (null tex-shell)
 	(message "No TeX output buffer")
-      (setq window (display-buffer tex-shell display-tex-shell-buffer-action))
-      (with-selected-window window
-	(bury-buffer tex-shell)
-	(goto-char (point-max))
-	(recenter (if linenum
-		      (prefix-numeric-value linenum)
-		    (/ (window-height) 2)))))))
+      (when-let ((window
+                  (display-buffer tex-shell display-tex-shell-buffer-action)))
+        (with-selected-window window
+	  (bury-buffer tex-shell)
+	  (goto-char (point-max))
+	  (recenter (if linenum
+		        (prefix-numeric-value linenum)
+		      (/ (window-height) 2))))))))
 
 (defcustom tex-print-file-extension ".dvi"
   "The TeX-compiled file extension for viewing and printing.
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
  2023-09-05 17:12 bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer' Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-06 10:57 ` Eli Zaretskii
  2023-09-06 11:03   ` Tassilo Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-09-06 10:57 UTC (permalink / raw)
  To: Eshel Yaron, Tassilo Horn; +Cc: 65762

> Date: Tue, 05 Sep 2023 19:12:41 +0200
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> This fixes an issue in `tex-recenter-output-buffer` (which affect
> several other commands that rely on it) where it calls `display-buffer`
> and tries to select the returned window, without checking that
> `display-buffer` returned non-nil.  This leads to an error when
> `display-tex-shell-buffer-action` or `display-buffer-alist` are
> configured to prevent the display of the *tex-shell* buffer.

Thanks.  Tassilo, any comments?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
  2023-09-06 10:57 ` Eli Zaretskii
@ 2023-09-06 11:03   ` Tassilo Horn
  2023-09-06 12:27     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2023-09-06 11:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Eshel Yaron, 65762

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eshel & Eli,

>> This fixes an issue in `tex-recenter-output-buffer` (which affect
>> several other commands that rely on it) where it calls
>> `display-buffer` and tries to select the returned window, without
>> checking that `display-buffer` returned non-nil.  This leads to an
>> error when `display-tex-shell-buffer-action` or
>> `display-buffer-alist` are configured to prevent the display of the
>> *tex-shell* buffer.
>
> Thanks.  Tassilo, any comments?

Yes, looks right in cases where display-tex-shell-buffer-action is
display-buffer-no-window or maybe something similar is achieved by
display-buffer-alist which would lead to errors right now.  But I'm no
authority here, tex-mode.el is not tex.el (from auctex).

Bye,
Tassilo





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
  2023-09-06 11:03   ` Tassilo Horn
@ 2023-09-06 12:27     ` Eli Zaretskii
  2023-09-06 16:21       ` martin rudalics
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-09-06 12:27 UTC (permalink / raw)
  To: Tassilo Horn, martin rudalics; +Cc: me, 65762

> From: Tassilo Horn <tsdh@gnu.org>
> Cc: Eshel Yaron <me@eshelyaron.com>, 65762@debbugs.gnu.org
> Date: Wed, 06 Sep 2023 13:03:26 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> Hi Eshel & Eli,
> 
> >> This fixes an issue in `tex-recenter-output-buffer` (which affect
> >> several other commands that rely on it) where it calls
> >> `display-buffer` and tries to select the returned window, without
> >> checking that `display-buffer` returned non-nil.  This leads to an
> >> error when `display-tex-shell-buffer-action` or
> >> `display-buffer-alist` are configured to prevent the display of the
> >> *tex-shell* buffer.
> >
> > Thanks.  Tassilo, any comments?
> 
> Yes, looks right in cases where display-tex-shell-buffer-action is
> display-buffer-no-window or maybe something similar is achieved by
> display-buffer-alist which would lead to errors right now.  But I'm no
> authority here, tex-mode.el is not tex.el (from auctex).

Thanks.

Martin, any further comments?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
  2023-09-06 12:27     ` Eli Zaretskii
@ 2023-09-06 16:21       ` martin rudalics
  2023-09-06 16:39         ` Eli Zaretskii
  2023-09-06 16:51         ` Stefan Kangas
  0 siblings, 2 replies; 7+ messages in thread
From: martin rudalics @ 2023-09-06 16:21 UTC (permalink / raw)
  To: Eli Zaretskii, Tassilo Horn; +Cc: me, 65762

 > Martin, any further comments?

The patch looks good and should be applied.

martin





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
  2023-09-06 16:21       ` martin rudalics
@ 2023-09-06 16:39         ` Eli Zaretskii
  2023-09-06 16:51         ` Stefan Kangas
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-09-06 16:39 UTC (permalink / raw)
  To: martin rudalics; +Cc: 65762-done, me, tsdh

> Date: Wed, 6 Sep 2023 18:21:18 +0200
> Cc: me@eshelyaron.com, 65762@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
> 
>  > Martin, any further comments?
> 
> The patch looks good and should be applied.

Thanks, installed on the emacs-29 branch and closing the bug.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
  2023-09-06 16:21       ` martin rudalics
  2023-09-06 16:39         ` Eli Zaretskii
@ 2023-09-06 16:51         ` Stefan Kangas
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2023-09-06 16:51 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, 65762-done, me, Tassilo Horn

Version: 30.1

martin rudalics <rudalics@gmx.at> writes:

>> Martin, any further comments?
>
> The patch looks good and should be applied.

Thanks, installed on master as commit ba7690c230a.  Closing.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-09-06 16:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 17:12 bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer' Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-06 10:57 ` Eli Zaretskii
2023-09-06 11:03   ` Tassilo Horn
2023-09-06 12:27     ` Eli Zaretskii
2023-09-06 16:21       ` martin rudalics
2023-09-06 16:39         ` Eli Zaretskii
2023-09-06 16:51         ` Stefan Kangas

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).