HahaHortness
HahaHortness

Reputation: 1628

making python interpreter open in same window

Maybe I'm being irrational but I really really hate it when a command opens a new window in emacs. I'm using emacs on Ubuntu which came with python-mode and when I start an interpreter with C-c ! it pops up in a new window.

What I want is for emacs to switch to a new buffer in the same window. So far I've tried adding Jython(I set the interpreter to jython) to same-window-buffer-names and even going into python-mode.el and changing switch-to-buffer-other-window calls to switch-to-buffer(which I since changed back). So far I've gotten no change.

I have emacs 23.1.1 and python-mode 5.1.0

Edit: The actual name of the jython buffer is bracketed by asterisks and I don't know how to let stackoverflow know that they aren't styling information.

Upvotes: 1

Views: 1214

Answers (2)

Andreas Röhler
Andreas Röhler

Reputation: 4804

current python-mode.el from

http://launchpad.net/python-mode

comes with a customizable variable

py-shell-switch-buffers-on-execute-p

"When non-nil switch to the new Python shell. "

related: py-split-windows-on-execute-p "When non-nil split windows."

Beside commands ending with switch/noswitch allow to ignore the customized or default setting

See menu PyExec

Upvotes: 1

spk
spk

Reputation: 594

I use python-mode 5.2.0.

I went into python-mode.el and changed the switch-to-buffer-other-window to switch-to-buffer. I evaluated it and now the interpreter opens up in the same window (regardless of the number of other windows I have).

Did you evaluate the function when you changed the above line?

Btw, opening the interpreter in another window is a feature, not a bug, IMHO. We want to be able to see the interpreter when we evaluate a region of code using C-c | or the buffer using C-c C-c.

Upvotes: 0

Related Questions