Subject: bug#65762: closed (Re: bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer')

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 06 Sep 2023 16:40:02 +0000

Your bug report

#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
65762: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65762
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
From: Eli Zaretskii <[email-masked]>
To: martin rudalics <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Wed, 06 Sep 2023 19:39:10 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Wed, 6 Sep 2023 18:21:18 +0200
> Cc: [email-masked], [email-masked]
> From: martin rudalics <[email-masked]>
> 
>  > Martin, any further comments?
> 
> The patch looks good and should be applied.

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

Subject: [PATCH] ; Fix error in 'tex-recenter-output-buffer'
From: Eshel Yaron <[email-masked]>
To: [email-masked]
Date: Tue, 05 Sep 2023 19:12:41 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

>From fb27907c07cf124773c1ae7add4a26be8ce02bbd Mon Sep 17 00:00:00 2001
From: Eshel Yaron <[email-masked]>
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