Title: IDLE to support
Type: enhancement Stage: patch review
Components: IDLE Versions: Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: THRlWiTi, asvetlov, eric.araujo, gpolo, kbk, ned.deily, rhettinger, roger.serwy, terry.reedy
Priority: normal Keywords:

Created on 2009-02-04 08:37 by rhettinger, last changed 2016-06-03 06:41 by terry.reedy.

File name Uploaded Description Edit roger.serwy, 2009-05-29 00:05 rstrip extension roger.serwy, 2010-10-15 23:28 extension
Messages (14)
msg81131 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-02-04 08:37
Add rstrip() to the Format menu.

Python's svn repository no longer accepts files with trailing whitespace
and it is often necessary to run before submitting.  It
would be nice to have this as a built-in formatting tool.
msg81301 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2009-02-06 21:50
If the interactive interpreter did not require blank lines within blocks
to have at least one 'trailing' space to avoid prematurely ending the
block (as when copy from editor window and paste), IDLE could
automatically rstrip lines.  Given that that should not be done, a menu
item would be nice.
msg88490 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2009-05-29 00:05
Here's an extension that adds rstrip() to the Format menu.
msg88492 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-05-29 01:23
Applied in r72999.  Will backport to 2.7.
msg88495 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-05-29 01:52
Backported in r73001
msg91528 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-13 18:07
This has been closed but why not promote to a module and add
an option on IDLE to allow a complete run ?
msg118808 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-15 17:30 is very much a script: It lacks a nice, full programmatic API, I mean standalone functions to check a file object or a filename and functions implementing the command-line interface.  As it is now, you see for example print calls in the middle of functions, so it’s not usable as a module.

Maybe bring this to python-dev or -ideas?
msg118809 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-10-15 17:39
There's no need to go to python-dev or python-ideas with this one.  If someone wants to figure-out a way to add reindent functionality to IDLE, patches are welcome.
msg118847 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2010-10-15 23:28
I grabbed the core of and put it into an extension, unmodified. 

The original will emit Indentation Errors if they exist. 
ScriptBinding already has nice code to handle these problems by highlighting the error, placing the cursor at the error, and presenting a message box. Rather than duplicate this code, this extension makes calls into ScriptBinding to check for syntax errors when the core reindent code throws exceptions.
msg122083 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-11-22 03:27
Opened back up for the new patch (posted after the previous close).
msg216673 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-04-17 08:27
The code needs to be updated for Python 3 and it needs a test.  I'm deassigning it in the hopes that someone will feel free to pick it up.
msg216678 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-17 09:33
I use rstrip routinely when editing idlelib files, before committing, so it has been useful for that purpose.

I do not happen to know what does that the current format options do not.

#18704 was about integrating the pep8 style checker. That was closed in favor of adding a generic facility to run external analysis tools. There is not an open issue for that yet, but I expect it to happen, perhaps this summer., if maybe improved, might be a candidate, though I will also try to look at the patch sometime.
msg260256 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-02-13 23:27
One other thought, it would be nice if there were an option (on by default) to automatically strip trailing whitespace when a file is saved.  That would be much nicer than making the user remember to do periodic clean-ups as they edit.
msg267059 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-06-03 06:41
Having occasionally forgotten, and had to do whitespace commits, I agree.  For Python code, there is never an absolute need for trailing whitespace.  Trailing whitespace in string literals can be done by parse time concatenation.
line 1
line 2
''' 'line with trailig space    '
Indeed, the trick is needed to mark the trailing space in the code.

I have thought about removing trailing spaces after each return, but pasting may be a problem.
Date User Action Args
2016-06-03 06:41:54terry.reedysetmessages: + msg267059
2016-02-13 23:27:22rhettingersetmessages: + msg260256
2016-02-13 11:59:30THRlWiTisetnosy: + THRlWiTi
2014-04-17 09:33:32terry.reedysetmessages: + msg216678
2014-04-17 08:27:37ned.deilysetassignee: ned.deily ->
stage: commit review -> patch review
messages: + msg216673
versions: + Python 3.5, - Python 3.2
2012-03-25 21:32:41asvetlovsetnosy: + asvetlov
2010-11-29 01:52:07rhettingersetassignee: rhettinger -> ned.deily

nosy: + ned.deily
2010-11-26 22:48:30terry.reedysetstage: resolved -> commit review
resolution: fixed ->
versions: + Python 3.2, - Python 3.1, Python 2.7
2010-11-22 03:27:56rhettingersetstatus: closed -> open

messages: + msg122083
2010-10-15 23:28:11roger.serwysetfiles: +

messages: + msg118847
2010-10-15 17:39:55rhettingersetmessages: + msg118809
2010-10-15 17:30:56eric.araujosetmessages: + msg118808
2010-07-10 19:38:36eric.araujosetnosy: + eric.araujo

resolution: accepted -> fixed
stage: needs patch -> resolved
2009-08-13 18:07:28gpolosetmessages: + msg91528
2009-05-29 01:52:33rhettingersetstatus: open -> closed

messages: + msg88495
2009-05-29 01:23:16rhettingersetassignee: kbk -> rhettinger
resolution: accepted
messages: + msg88492
2009-05-29 00:05:15roger.serwysetfiles: +
nosy: + roger.serwy
messages: + msg88490

2009-04-26 22:18:25ajaksu2setnosy: + gpolo

stage: needs patch
2009-02-06 21:50:38terry.reedysetnosy: + terry.reedy
messages: + msg81301
2009-02-04 08:37:42rhettingercreate