[OS X Emacs] Re: python-mode

Michael Terry formido at gmail.com
Fri Dec 28 20:47:39 EST 2007


Hey, that helps a lot. How did you figure that out originally? I
couldn't find any document explaining it, and it's not particularly
intuitive. I finally figured out that if you evaluated a region it
would print the result, apparently just running the code in its own
context each time (that is, no globals were saved between runs). I was
thrown off because the shell prints the results of all expressions.
When I tested similar expressions in emacs nothing was output. In
looking at the c apis for embedding Python, I see you can actually
control that, so not all interpreters will necessarily do it the same.

How on earth would I have thought starting the interpreter would
change 'execute region''s behavior, anyway? Starting the interpreter
actually opens a new buffer with a prompt, leading me to think it was
just a way to run the normal interactive interpreter inside emacs.
Crazy.

Also, some things aren't right. _ doesn't get set and I wish all
expressions emitted output like in the shell. (As a matter of fact, I
wish expressions like x = 7 and the like had a result, too, like in
AppleScript, but I'm new to Python and I'm sure they have their
reasons).

Thanks for the response--this should work out better than using IDLE
and redirecting output to Console.app, anyway.

Thanks very much,
- Michael Terry

It's not perfect though. _ doesn't seem to get set
On 12/28/07, Mark Bestley <newsgmane at bestley.co.uk> wrote:
> Michael Terry wrote:
> > It's driving me nuts that when I evaluate a region in Python mode, the
> > result isn't printed in the minibuffer or messages buffer or anything.
> > Is this really the way it's supposed to work? I basically want to work
> > with Python the way I would AppleScript in Satimage's Smile, but this
> > is killing my dream.
>
> It works for me ;)
>
> However you do need to start the interpreter first
>
> Try menu Python->Start Interpreter
>
> Then executing a region will send the text to the python interpreter and
> will show what that would do - in effect the results of print
>
> The interaction with python is just a very nice wrapper on command line
> python - which I think is better than most other development environments
> --
> Mark
>
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
>



More information about the MacOSX-Emacs mailing list