From fed04b8ba437043f30132fe362509ebf14ed0588 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sun, 21 Mar 2021 08:02:28 +0100 Subject: [PATCH] Use pop-to-buffer-same-window for shell * lisp/progmodes/project.el (project-shell): Behave the same way as 'M-x project-eshell'. * lisp/shell.el (shell): Behave the same way as 'M-x eshell'. * etc/NEWS: Add news entry describing the change. * lisp/tutorial.el: Use lexical-binding. --- etc/NEWS | 4 ++++ lisp/progmodes/project.el | 2 +- lisp/shell.el | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index c602166397..49a4bb8106 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2300,6 +2300,10 @@ since the latter uses 'M-s' as a prefix key of the search prefix map. ** 'vc-print-branch-log' shows the change log for BRANCH from its root directory instead of the default directory. +--- +** 'project-shell' and 'shell' now use 'pop-to-buffer-same-window'. +This is to keep the same behavior as Eshell. + * Incompatible Lisp Changes in Emacs 28.1 diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index bd552c917a..b6a886f731 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -911,7 +911,7 @@ if one already exists." "-shell*")) (shell-buffer (get-buffer default-project-shell-name))) (if (and shell-buffer (not current-prefix-arg)) - (pop-to-buffer shell-buffer) + (pop-to-buffer-same-window shell-buffer) (shell (generate-new-buffer-name default-project-shell-name))))) ;;;###autoload diff --git a/lisp/shell.el b/lisp/shell.el index 53f5d0b6f1..7f4ca76547 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -743,7 +743,7 @@ Make the shell buffer the current buffer, and return it. (current-buffer))) ;; The buffer's window must be correctly set when we call comint ;; (so that comint sets the COLUMNS env var properly). - (pop-to-buffer buffer) + (pop-to-buffer-same-window buffer) (with-connection-local-variables ;; On remote hosts, the local `shell-file-name' might be useless. -- 2.24.3 (Apple Git-128)