In python-mode (for emacs), hitting Control-C\Control-C will execute the current buffer. However, when execution is finished, the output buffer springs up and splits my editing window in half. This is a complete pain, especially given that there's generally no output in the buffer anyway!
Is there a way to stop the buffer from appearing? Also, how can I send painful electric shocks to the programmer who thought unexpectedly interrupting my train of thought with an empty buffer was a good idea?
Edit: Apparently, there are uses for this behavior, most notably in seeing the output of a program. That's fine, but if there's no output (as in the program with which I'm tinkering), it is really dumb to cut my buffer in half with a blank window.
stderr is line-buffered, which helps mitigate some of the problems with output not appearing. By default, Python buffers output to standard output (stdout) and standard error (stderr). This means that output from your code might not show up immediately, making debugging harder.
To hide output of subprocess with Python, we can set stdout to subprocess. DEVNULL`. to output the echo command's output to dev null by setting the stdout to subprocess. DEVNULL when we call subprocess.
So, the purpose of buffering is to speed up your program. Its a buffer, meaning its a silo until its full and needs to be drained. Your program took less time because it was making fewer system calls.
What python-mode are you using? Unfortunately, there are several.
Type C-h k and then C-c C-c .. what does it say in the modeline? Does it say "py-execute-buffer" or does it say "python-send-buffer", the first kind indicates you're using Tim Peters' python-mode, while the second indicates you're using Dave Love's python-mode.
I myself prefer Dave Love's python mode, and it's the version that ships with Emacs 23 (and maybe earlier too?). Dave Love's does not pop up the buffer when you run C-c C-c, you have to explicitly switch to the *Python* buffer if you want to see it.
If you're really intent on sticking with Tim Peters' version, you could always put something like the following in your .emacs and you'll never see the output buffer again unless explicitly moved to.
(defadvice py-execute-buffer (after advice-delete-output-window activate)
(delete-windows-on "*Python Output*"))
Sorry that I can't help you with emacs, but as for your second question, a modified aluminum keyboard from Apple may be a solution:
http://www.apple.com/keyboard/
In recent python-mode.el
that behavior is controlled by a customizable variable:
py-shell-switch-buffers-on-execute
See these links:
An Emacs mode for editing Python code
Link to direct download
You might want to customize the pop-up-windows
variable; that controls the splitting functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With