emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python-mode: make sure output is not eaten


From: Slawomir Nowaczyk
Subject: Re: python-mode: make sure output is not eaten
Date: Fri, 25 Aug 2006 11:03:41 +0200

On Thu, 24 Aug 2006 20:18:07 -0400
Steven Huwig <address@hidden> wrote:

#> On Aug 23, 2006, at 12:04 AM, Stefan Monnier wrote:
#> >
#> > Yes, of course.  BTW do you have any idea why the current code uses  
#> > "\n\n"?
#> 
#> Might it be because the Python interactive interpreter needs the extra
#> newline due to significant whitespace?  E.g.
#> 
#>  >>> for i in range(1,5):
#> ...     print i,
#> ...
#> 1 2 3 4
#> 
#> a DEDENT token is created by the unindented second newline, closing
#> the block.  A single newline cannot do that as it is also the
#> statement terminator.
#> 
#> Probably it compensates for indented text without a trailing newline.
#> It doesn't look like python-mode itself has any situations where this
#> matters, but it is possible -- but unlikely -- for user input to be
#> affected.
#> 
#> If you do the following in python-mode with both versions:
#> 
#> C-c C-s for i in range(1, 5): C-q C-j
#> <tab> print i, <return>
#> 
#> you will see the difference in behavior.

OK, you are right... In my testing I only made sure that ending code
with indented block works fine with commands like python-send-buffer and
python-send-region, I haven't tested with bare python-send-string. Yes,
double "\n" might be an attempt to get that working.

#> To explain my post a little more, I think the new code is the right
#> thing. If someone is astute enough to type in multi-line Python
#> commands at an Emacs interactive prompt, then they will likely be
#> astute enough to realize that they need to add an extra newline.
#> 
#> Plus I don't think the usage pattern is typical in the first place;
#> there is a comint buffer for such interaction.

I agree.

Besides, if anything, TRT would be to allow people start an indented
block with C-c C-s and then *continue* it in comint buffer... but it is
neither easy nor important enough to worry about it right now, IMHO.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( address@hidden )

Write your questions down on the back of $20 dollar bill and send them to me.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]