Re: Automated indentation

Guido.van.Rossum@cwi.nl
Wed, 11 May 1994 21:40:54 +0200

> Another point. This also assumes that Python programmers have
> python-mode.el available. Not everyone has emacs. Believe it or not,
> other people actually refuse to use emacs even when it is available
> (poor misguided souls...).
>
> What I'm most concerned about at the moment are applications where
> people type fragments of Python code into dialogs that are implemented
> with stupid text-entry "widgets". With the optional "end" delimiters
> the user can be somewhat sloppy about indentation. Without it, he or
> she is forced to do a lot of reindenting, possibly without even the
> minimal sort of reformatting support that "vi" provides. I don't think
> that will be very popular.
>
> I'm not just making this example up to be perverse. I really do have
> some tools I'd like to create where I want the user to enter Python
> bits into a Motif widget.

Now seriously, don't you think that people will start complaining
about such primitive text entry tools when they need to enter indented
text? Entering C in a Motif widget isn't any more fun than entering
Python -- imagine what it would look like if a user did not indent
lines at all, relying totally on braces. Moreover, in that case,
selecting a block to move around would be a nightmarge without a
function to find matching parentheses...

The solution is to design a tool to match the task, not to change the
task to match the tools you happen to have lying around!

If you are at all serious about this, you'll have to give your tool at
least the following features: auto-indent (i.e. typing RETURN or
LINEFEED will insert whitespace at then beginning of the next line to
match the previous line), a simple way to change the indentation of
the current line, and a way to change to indentation of a group of
lines (the region selected with the mouse). Almost all the other
stuff that Emacs' Python mode does is mostly for power users, even the
automatic indent after a line ending in a colon...

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>