From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65762: [PATCH] ; Fix error in 'tex-recenter-output-buffer' Date: Tue, 05 Sep 2023 19:12:41 +0200 Message-ID: Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40556"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 65762@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 05 19:13:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qdZc7-000AMF-A8 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Sep 2023 19:13:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdZbs-0005k6-69; Tue, 05 Sep 2023 13:13:04 -0400 Original-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 ) id 1qdZbp-0005jl-Sx for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 13:13:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdZbp-00082e-Jy for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 13:13:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdZbq-00040a-4d for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 13:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Sep 2023 17:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65762 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169393397915396 (code B ref -1); Tue, 05 Sep 2023 17:13:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Sep 2023 17:12:59 +0000 Original-Received: from localhost ([127.0.0.1]:58816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdZbm-00040G-Qp for submit@debbugs.gnu.org; Tue, 05 Sep 2023 13:12:59 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:36996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdZbk-000401-61 for submit@debbugs.gnu.org; Tue, 05 Sep 2023 13:12:57 -0400 Original-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 ) id 1qdZbe-0005RL-4H for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 13:12:50 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdZbb-00080i-W3 for bug-gnu-emacs@gnu.org; Tue, 05 Sep 2023 13:12:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1693933967; bh=ppT3FiWgknm94U7ugJd9YRQ0hfHhMpOuwVfuM+ZyExk=; h=From:To:Subject:Date:From; b=Iv6FbxCKUpn5yw4B0bc8Maw047s4RORGGyBCc8CJ+pAESucE1R3ysawHwE+7Mx8oq D5YQaEnoHYuozrldm8VcxQPRFm+TTrfuTEqB0XPKxXrT6pkAhpW9swqL41NKjB5QHE 3iKmPIyQ5OnZpVzGAXKKFwUGqkhcp3kMdqQeQCRIatDTa9XK9VaMd5zEpaDezD1iN9 8W6a3FswiRWUseVkIhRViEouyUpvH+i/bgroxV2xX9Vr3V/qXo1ZeDYnEET/ckkmip BCtV4mqnc15+t11EZHEWc/wM8UR//ALgU8AWyFO0V9UWqenS2jjmaXnTxxSfcsNDIE w+RGbInLo4NBQ== X-Hashcash: 1:20:230905:bug-gnu-emacs@gnu.org::6A4gTwKuGQRFxVLs:28DF Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269387 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-error-in-tex-recenter-output-buffer.patch >From fb27907c07cf124773c1ae7add4a26be8ce02bbd Mon Sep 17 00:00:00 2001 From: Eshel Yaron 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 --=-=-=--