6

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.

2
  • What version of emacs are you using? I'm using GNU Emacs 22.3.1 and the output buffer doesn't come up when I hit C-C C-C in python-mode. Commented Feb 17, 2009 at 17:54
  • I just upgraded to 23.0.60.1 (on XP) and still don't see this behaviour. I think the answer by EnigmaCurry below is helpful. Commented Feb 18, 2009 at 9:27

5 Answers 5

6

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*")) 
Sign up to request clarification or add additional context in comments.

3 Comments

Okay, apparently I'm using the version that uses "py-execute-buffer", which is the version I downloaded from the python-mode page. Where can I find the other version?
I just found his version, and so far, I definitely prefer it. My only gripe now (and it was present in the other version) is that imports aren't being...well, imported. It looks like Emacs is shooting the buffer into a temp file, when there's already a file it could use. Grrrrr.
Apparently, if the directory from which Python is started is world-writable, imports are turned off, or something. I don't understand it, but commenting that out of python.el seemed to work. What a freaking pain.
2

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/

Comments

2

In recent python-mode.el that behavior is controlled by a customizable variable:

py-shell-switch-buffers-on-execute

See these links:

Comments

1

You might want to customize the pop-up-windows variable; that controls the splitting functionality.

Comments

0

Don't know how to stop it from popping up, but C-x, 1 will close the window.

1 Comment

And all the other windows you have open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.