From 4765487d5d24fc8a2a06c329dc9cc3bed9803391 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 11 Jan 2022 19:19:37 +0200 Subject: [PATCH] More fixes for display-comint-buffer-action * lisp/window.el (display-comint-buffer-action): Use display-buffer--same-window-action as the default value. * lisp/progmodes/sh-script.el (sh-show-shell): * lisp/shell.el (shell): Add display-comint-buffer-action to pop-to-buffer. * lisp/progmodes/project.el (project-shell, project-eshell): Use `bound-and-true-p display-comint-buffer-action' for backward-compatibility. https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg02964.html --- lisp/progmodes/project.el | 4 ++-- lisp/progmodes/sh-script.el | 2 +- lisp/shell.el | 2 +- lisp/window.el | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index eda19c46a37..c812f28c1bb 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1017,7 +1017,7 @@ if one already exists." (default-project-shell-name (project-prefixed-buffer-name "shell")) (shell-buffer (get-buffer default-project-shell-name))) (if (and shell-buffer (not current-prefix-arg)) - (pop-to-buffer shell-buffer display-comint-buffer-action) + (pop-to-buffer shell-buffer (bound-and-true-p display-comint-buffer-action)) (shell (generate-new-buffer-name default-project-shell-name))))) ;;;###autoload @@ -1033,7 +1033,7 @@ if one already exists." (eshell-buffer-name (project-prefixed-buffer-name "eshell")) (eshell-buffer (get-buffer eshell-buffer-name))) (if (and eshell-buffer (not current-prefix-arg)) - (pop-to-buffer eshell-buffer display-comint-buffer-action) + (pop-to-buffer eshell-buffer (bound-and-true-p display-comint-buffer-action)) (eshell t)))) ;;;###autoload diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index e0d597d89de..ba86ceb0eda 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1407,7 +1407,7 @@ If FORCE is non-nil and no process found, create one." (defun sh-show-shell () "Pop the shell interaction buffer." (interactive) - (pop-to-buffer (process-buffer (sh-shell-process t)))) + (pop-to-buffer (process-buffer (sh-shell-process t)) display-comint-buffer-action)) (defun sh-send-text (text) "Send the text to the `sh-shell-process'." diff --git a/lisp/shell.el b/lisp/shell.el index dcb6bea0421..c0a82bca183 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -758,7 +758,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 buffer display-comint-buffer-action) (with-connection-local-variables ;; On remote hosts, the local `shell-file-name' might be useless. diff --git a/lisp/window.el b/lisp/window.el index dc5f5b98e1c..0d8e1813ab1 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7474,7 +7474,7 @@ ALIST. See `display-buffer' for details." :version "24.1" :group 'windows) -(defcustom display-comint-buffer-action '((display-buffer-same-window)) +(defcustom display-comint-buffer-action display-buffer--same-window-action "`display-buffer' action for displaying comint buffers." :type display-buffer--action-custom-type :risky t -- 2.39.2