Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable feature which split window into 2 when run M-x shell #6820

Closed
liuchong opened this issue Aug 14, 2016 · 6 comments
Closed

How to disable feature which split window into 2 when run M-x shell #6820

liuchong opened this issue Aug 14, 2016 · 6 comments

Comments

@liuchong
Copy link
Contributor

When I type M-x shell, the window will be splited into 2 windows, but I want it keep one window, as I'm usually use a small size window, if it be splited the windows will too small, so I must type C-x 1 to change it back.
Any one knows that how could I write the configuration to disable this splitting? thanks a lot!

@liuchong
Copy link
Contributor Author

seems the build-in command "shell" changed from emacs version 24 (pop to same window) to 25 (pop to seprated window), anything I can do on this?

@bmag
Copy link
Collaborator

bmag commented Aug 14, 2016

The command shell uses pop-to-buffer. If you have the Emacs source code, you can see it for yourself by running SPC h d f shell to open the function's documentation, and then clicking the link to the function's source.

Because shell calls pop-to-buffer, you can configure its display via display-buffer-alist. Try this:

(push (cons "\\*shell\\*" display-buffer--same-window-action) display-buffer-alist)

For more info, see the documentation for pop-to-buffer, display-buffer, display-buffer-alist and the relevant sections in the Emacs and Elisp manuals (Window-Choice, Choosing-Windows).

@liuchong
Copy link
Contributor Author

It works, thanks! 👍

@liuchong
Copy link
Contributor Author

seems it get bad again, while the config "(push (cons ...))" keep as is in .spacemacs/init.el

@bmag
Copy link
Collaborator

bmag commented Aug 24, 2016

@liuchong hmm, the behavior shouldn't change unless you changed your config or a package that you use has changed it behavior. You can look at the source of shell and examing the value of display-buffer-alist to try and understand what causes the bad behavior. The display-buffer mechanism is explained in the sources I referred to in my previous comment.

@aa755
Copy link

aa755 commented Feb 12, 2019

Another possible way: on my computer M-x ansi-term does not split the window (but M-x shell does).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants