Try splitting the frame repeating some times the command
Then try open the shell with
It will open in a random window and not the one which you have typed the command from. Why?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
The reason is that
If you want to use the selected window try this in your config.
(add-to-list 'display-buffer-alist `(,(rx bos "*shell*") display-buffer-same-window (reusable-frames . visible)))
The following works well in my GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2017-12-09
(add-to-list 'display-buffer-alist `(,(rx bos "*shell*") display-buffer-same-window))
However, with the answer provided by @bertfred I get the error
(wrong-type-argument window-live-p nil)
Here is the content of the
*Backtrace* buffer after
M-x shell with @bertfred's suggested
Debugger entered--Lisp error: (wrong-type-argument window-live-p nil) select-window(nil nil) pop-to-buffer(#<buffer *shell*>) shell(nil) funcall-interactively(shell nil) call-interactively(shell record nil) command-execute(shell record) execute-extended-command(nil "shell" "shell") funcall-interactively(execute-extended-command nil "shell" "shell") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command)