From: Eshel Yaron Date: Tue, 5 Sep 2023 16:58:02 +0000 (+0200) Subject: ; Fix error in 'tex-recenter-output-buffer' X-Git-Tag: emacs-29.1.90~132 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bc56da92d8df806ff9ec66be70920d98e0ef5b42;p=emacs.git ; 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) --- diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 294c9792f39..c33a5997070 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -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 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.