; 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.  (Bug#65762)
This commit is contained in:
Eshel Yaron 2023-09-05 18:58:02 +02:00 committed by Eli Zaretskii
parent d17c5adc05
commit bc56da92d8

View file

@ -2677,17 +2677,17 @@ This function is more useful than \\[tex-buffer] when you need the
The last line of the buffer is displayed on The last line of the buffer is displayed on
line LINE of the window, or centered if LINE is nil." line LINE of the window, or centered if LINE is nil."
(interactive "P") (interactive "P")
(let ((tex-shell (get-buffer "*tex-shell*")) (let ((tex-shell (get-buffer "*tex-shell*")))
(window))
(if (null tex-shell) (if (null tex-shell)
(message "No TeX output buffer") (message "No TeX output buffer")
(setq window (display-buffer tex-shell display-tex-shell-buffer-action)) (when-let ((window
(with-selected-window window (display-buffer tex-shell display-tex-shell-buffer-action)))
(bury-buffer tex-shell) (with-selected-window window
(goto-char (point-max)) (bury-buffer tex-shell)
(recenter (if linenum (goto-char (point-max))
(prefix-numeric-value linenum) (recenter (if linenum
(/ (window-height) 2))))))) (prefix-numeric-value linenum)
(/ (window-height) 2))))))))
(defcustom tex-print-file-extension ".dvi" (defcustom tex-print-file-extension ".dvi"
"The TeX-compiled file extension for viewing and printing. "The TeX-compiled file extension for viewing and printing.