Indenting in Emacs

E

eugene.morozov

Hello,
Does anyone know how to make python-mode correctly indent nested lists
and dictionaries. I hate indenting Django url patterns and Zope
Archetypes schemas by hand, because python-mode indents them in
incorrect and ugly way.

Here's how it should be:
StringField('reference',
widget=StringWidget(
description='Position reference'
)),

Here's how python-mode indents this code:
schema = BaseSchema.copy() + Schema((
StringField('reference',
widget=StringWidget(
description='Position reference'
)),

I can provide examples of how ugly it indents nested dictionaries/
lists/tuples, but I think that everyone using emacs already have seen
that.

py-version is 4.78

Are we doomed to manually indent python lists in Emacs?

I didn't find any patches fixing indentation in python-mode.
Eugene
 
M

Michael Hoffman

Hello,
Does anyone know how to make python-mode correctly indent nested lists
and dictionaries. I hate indenting Django url patterns and Zope
Archetypes schemas by hand, because python-mode indents them in
incorrect and ugly way.

Here's how it should be:
StringField('reference',
widget=StringWidget(
description='Position reference'
)),

Here's how python-mode indents this code:
schema = BaseSchema.copy() + Schema((
StringField('reference',
widget=StringWidget(
description='Position reference'
)),

I get:

schema = BaseSchema.copy() + Schema((
StringField('reference',
widget=StringWidget(
description='Position reference'
)),

I'm using py-version "$Revision$." Oops! Anyway, try to install the
latest python-mode, whatever that is, if it isn't 4.78.
 
S

Steven W. Orr

On Thursday, Jun 21st 2007 at 10:11 +0100, quoth Michael Hoffman:

=>[email protected] wrote:
=>> Hello,
=>> Does anyone know how to make python-mode correctly indent nested lists
=>> and dictionaries. I hate indenting Django url patterns and Zope
=>> Archetypes schemas by hand, because python-mode indents them in
=>> incorrect and ugly way.
=>>
=>> Here's how it should be:
=>> StringField('reference',
=>> widget=StringWidget(
=>> description='Position reference'
=>> )),
=>>
=>> Here's how python-mode indents this code:
=>> schema = BaseSchema.copy() + Schema((
=>> StringField('reference',
=>> widget=StringWidget(
=>> description='Position reference'
=>> )),
=>
=>I get:
=>
=>schema = BaseSchema.copy() + Schema((
=> StringField('reference',
=> widget=StringWidget(
=> description='Position reference'
=> )),
=>
=>I'm using py-version "$Revision$." Oops! Anyway, try to install the
=>latest python-mode, whatever that is, if it isn't 4.78.

Ok. I'm not stupid but I do not see a 4.78 anywhere even though I see refs
from google. I have 4.75 The SVN tree doesn't seem to even have that.

I checked the latest copy out from sourceforge and that was 4.75 too.

Can someone please tell me where to find the latest?

--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
 
E

Eugene Morozov

Steven W. Orr пишет:
> Ok. I'm not stupid but I do not see a 4.78 anywhere even though I see refs
from google. I have 4.75 The SVN tree doesn't seem to even have that.

I checked the latest copy out from sourceforge and that was 4.75 too.

Can someone please tell me where to find the latest?

It's from Emacs 22.
Eugene
 
J

John J. Lee

Eugene Morozov said:
Steven W. Orr пишет:

It's from Emacs 22.

Note that's a different python-mode to the old one that lives on SF.
Yes, there are now two of them.


John
 
J

John J. Lee

Michael Hoffman said:
Which one is better?

I've not noticed a big difference in usability.

I find indentation with the new mode very mildly more annoying than
the old mode. YMMV on that. There are probably annoyances with the
old mode that I've now forgotten about.

I'm told by an emacs developer at work that the new mode is more
emacsy in its implementation -- I don't know in what ways exactly, but
presumably that, plus the fact that the new mode is included with
emacs 22, will mean that it's likely to work better with other emacs
code (not that I ever had much problem with the old mode -- but then I
didn't push it very far).


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top