From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50765: 27.2; [PATCH] Fix problems with 'C-c C-n' in sh-script-mode Date: Thu, 23 Sep 2021 18:28:21 +0200 Message-ID: <8735pv8dei.fsf@miha-pc> Reply-To: miha@kamnitnik.top Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18281"; mail-complaints-to="usenet@ciao.gmane.io" To: 50765@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 23 18:26:24 2021 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 1mTRYF-0004bI-P6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 18:26:24 +0200 Original-Received: from localhost ([::1]:54858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTRYE-0000Jc-Nz for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 12:26:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTRXu-0000HM-Kr for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2021 12:26:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44125) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTRXu-0001AM-9i for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2021 12:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mTRXu-0004Iv-4D for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2021 12:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: miha@kamnitnik.top Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Sep 2021 16:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50765 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.163241431016459 (code B ref -1); Thu, 23 Sep 2021 16:26:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Sep 2021 16:25:10 +0000 Original-Received: from localhost ([127.0.0.1]:55671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTRX4-0004HP-60 for submit@debbugs.gnu.org; Thu, 23 Sep 2021 12:25:10 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTRX2-0004HG-Kx for submit@debbugs.gnu.org; Thu, 23 Sep 2021 12:25:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTRX2-0007z3-BB for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2021 12:25:08 -0400 Original-Received: from kamnitnik.top ([2001:19f0:5001:bf2:5400:2ff:fee0:2626]:50292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTRWz-0000Nm-G6 for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2021 12:25:07 -0400 Original-Received: from localhost (unknown [IPv6:2a00:ee2:e04:9300:e18:5d33:4bd1:d3a4]) by kamnitnik.top (Postfix) with ESMTPSA id 070189C704 for ; Thu, 23 Sep 2021 16:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1632414302; bh=KQpje+5zAure8fYsTvXmMcGoHXcp8UTxc92BBP3qDEA=; h=From:To:Subject:Date:From; b=ugx7p4/S3p+671xwNm38qozy2X96uEVksvejJG52yPpb7klZBKltXkJKi2VUvwK5u bujgb14uoBX/oRskOs4kyv1I4Govp1x5tvEPooTdW8jqyfrRuDsZ97OG4d9ZDcALPs LVjauO7lJAhykjhDv8/hBjuUr8xKy/cwXjjmi6xQicjs8OdDMd0nH0DOaG5j3mPFHD 7/iHmD0tAepG9Fw5Hsn6Z3LhnHfrTimyjw5qBUJ+V3ZWAPwVH55Q+p7pkZuaKd2hi0 fHQrLO10smxpqOJRLK4DXYpsmqDsjHh6KZV2AfRwUNDXCkioVwqVjsisWIb6cMhd7U R7dKr0+bYDr1A== Received-SPF: pass client-ip=2001:19f0:5001:bf2:5400:2ff:fee0:2626; envelope-from=miha@kamnitnik.top; helo=kamnitnik.top X-Spam_score_int: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 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, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=1.997, GAPPY_SUBJECT=0.1, PDS_OTHER_BAD_TLD=1.997, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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" Xref: news.gmane.io gmane.emacs.bugs:215202 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Scenario: we are editing a buffer in 'shell-script-mode' and a *shell* buffer doesn't exist yet. In Emacs 27, pressing 'C-c C-n' creates a shell buffer and displays it in a separate window by default. This is less annoying than displaying it in the selected window, which is what Emacs 28 currently does by default, so this patch reverts that. It also fixes a subtle bug, where a local variable is set in an incorrect buffer. Best regards. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-problems-with-C-c-C-n-in-sh-script-mode.patch Content-Transfer-Encoding: quoted-printable From=2084cdc5fd707baa2537cc57a77cec4ea537c4f308 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Thu, 23 Sep 2021 18:03:24 +0200 Subject: [PATCH] Fix problems with 'C-c C-n' in sh-script-mode * lisp/progmodes/sh-script.el (sh-shell-process): If a *shell* buffer doesn't exist, 'C-c C-n' creates one and displays it. This patch prevents it from being displayed in the selected window. Additionally, it ensures that the local `sh-shell-process' variable is set in the correct buffer. =2D-- lisp/progmodes/sh-script.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index cccd70f06c..3b6774aa14 100644 =2D-- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1396,8 +1396,15 @@ sh-shell-process (or found (and force (get-buffer-process =2D (let ((explicit-shell-file-name sh-shell-file)) =2D (shell))))))))) + (let ((explicit-shell-file-name sh-shell-file) + (display-buffer-overriding-action + '(nil . ((inhibit-same-window . t))))) + ;; We must prevent this `(shell)' call from + ;; switching buffers, so that the variable + ;; `sh-shell-process' is set locally in the + ;; correct buffer. + (save-current-buffer + (shell)))))))))) =20 (defun sh-show-shell () "Pop the shell interaction buffer." =2D-=20 2.33.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmFMqyUTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP6AHD/4sYmyVL9nTKvrCao7DxrQH7KLDTRUd gLEkp2ev7eCexuTFszutgAYGKBQZG/WQx1cZMBI0TBZQe8hsClBpVB1J9Uil7STh fmFCKvjzil2V2Cmyfl3BoUncUvHdwlfvINIaz95Km6sLTfGObRf8BvSYj9TC5S5C FfeiRPQcW76xCVSEHYZHFtmIN/u0VSaelI7Cv/w6Jeeas/qBiRhS6vbKvXmPM5s6 7rJf+4F9j+M5QSFpMEjLReIKFKfanepKg+XEjTukQR0v38Y5QNg2Sd2SzgTKr2sJ Z0O9ysnPFz+OvPoMXQaVRoa2XzTv+tjPEKbtVw6brI8X/4Ja0CXb7+7XsY54sOOD ENC6v/4wqTYZa0C3kpKcS71umyY+iFipZWdPpNTTmu/v0uFNkWoTaAA3xJZ0Q5LI 85lOCLWN5MGHpAAUpiymdHFZ1OnG4R8qd6VeepxXWxA9wOp+3KDvigV8v8v2VL3g uW7dHEtaXOn4+8ezoIz7XgAdZm221ebAL6/9zDXSeElRDHmx8q3u3YoGCIMIYAT8 O71wm5mILw/av/07ertBUD0cIyynD44gOHzJX7WuF3hFV5cgGJMS5Kdnm5KSkzNX 6v1Qjcury7A5kXg+RyLhjAL/BbXFHlruc8DODibZlSyyMskftH6oyh+U9DJTEwEU F7hTHSAqjx9KFg== =ZeGz -----END PGP SIGNATURE----- --==-=-=--