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
This commit is contained in:
Juri Linkov 2022-01-11 19:19:37 +02:00
parent a18517f619
commit 4765487d5d
4 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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'."

View file

@ -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.

View file

@ -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