A modest indentation proposal
quinn at hurl.ugcs.caltech.edu
Sat Dec 1 12:02:26 CET 2001
On Fri, 30 Nov 2001 23:25:34 -0800, Erann Gat <gat at jpl.nasa.gov> wrote:
>In article <slrna0ggia.1dh.quinn at chunder.ugcs.caltech.edu>,
>quinn at chunder.ugcs.caltech.edu (Quinn Dunkan) wrote:
>> If you want the OFMPM, it's basically like pindent.py.
>So I wasn't actually aware of the existence of pindent.py. Can it be
>easily rolled into an emacs mode?
No idea, since I don't use emacs. It's just a standard stdin-stdout filter,
and I'd be real surprised if emacs can't handle that.
>> If that's not enough, and you think there needs to be a fundamental change to
>> the language syntax,
>No, I'm not asking for a fundamental change to the language syntax. I'm
>asking for the functionality of pindent.py to be packaged up as an emacs
>mode, and for the parser to warn me when there's a discrepancy between the
>indentation that pindent.py would produce and what's actually in the
>file. I'm also asking that "# end for" be spelled ";". That's all.
Ok, that shouldn't be hard. From a casual glance, it looks like you could
inherit from pindent.PythonIndenter and override endprog to match whatever you
want, such as a lone semicolon. You'll probably have to do a little more
since it wants to find a matching closing keyword (e.g. "end if" or "end
for"). pindent will make noise on stderr about unmatched blocks, so it should
be easy to get emacs to tell you about problems.
There's no need to ask when you can go ahead and do it, asking just stirs up a
lot of emotional sentiment.
>> Did you manage to convince the lispers that the compilers should support an
>> optional ()-less infix syntax to make your boss happy? They'd probably say
>> "so write a read macro" :)
>It turns out that what made the bosses unhappy about Lisp was not the
>syntax but the fact that no one uses it. And before you protest and tell
>me that it's not true that no one uses Lisp, yes, I *know* it's not true.
>I also know that indentation is not much of a problem in practice.
But if what you're concerned about is the Boss' half-baked opinions, then why
the wacky semicolon syntax? You can mention that the python block delimeters
are even stricter than C's, since they must match the opening delimeter. Show
'em some marked up "# end this" "# end that" code. If that makes them happy
your problem is solved. If you think it's too much typing, consider how much
typing you're saving by not having to use C++. Or go modify pindent. Up to
you. You could never write any closing delimeters but put pindent on as a cvs
checkin filter (or saving filter for emacs) and you won't have to type
More information about the Python-list