[Pythonmac-SIG] soft tabs for PythonIDE (preview; for the adventurous)

Oliver Steele steele@cs.brandeis.edu
Fri, 21 May 1999 19:50:57 -0400


<http://www.cs.brandeis.edu/~steele/sources/PythonSpaceEditor.py>.

This is a work in progress.  It's alpha software: use it at your own risk.

Importing this module into PythonIDE changes the behavior of text windows
such that the Tab key inserts four spaces, instead of a tab character. It
also changes "Shift left" and "Shift right" to recognize and insert,
respectively, spaces instead of tabs.  These changes make PythonIDE
compatible with the behavior of emacs' python-mode, and with IDLE; they're
useful if you're editing code that was developed on or is shared with
developers on other platforms.

For compatibility with hard-tabbed files, the system recognizes files that
contain a carriage return followed by a tab ('\r\t'), and uses hard tabs
instead of spaces in windows opened on those files.   The behavior of the
patched system is intended to be identical to the behavior of the unpatched
system in this case, except that with the patch, the editor recognizes a
sequence of spaces -- even in a window marked as hard-tabbed -- as being
equivalent to a level of indentation.

At some point it should become possible to set this behavior (hard tab
versus soft tab) on a window-by-window basis, and to change the default.
For now, you can type "PySpaceEditor.PySpaceEditor.use_hard_tabs = 1" to
cause new files to use hard tabs.

Usage:  After PythonIDE has launched, type 'import PySpaceEditor' at its
command line.