Indenting in Emacs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eugene.morozov@gmail.com

    Indenting in Emacs

    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('re ference',
    widget=StringWi dget(
    description='Po sition reference'
    )),

    Here's how python-mode indents this code:
    schema = BaseSchema.copy () + Schema((
    StringField('re ference',
    widget=StringWi dget(
    description='Po sition 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

  • Michael Hoffman

    #2
    Re: Indenting in Emacs

    eugene.morozov@ gmail.com 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('re ference',
    widget=StringWi dget(
    description='Po sition reference'
    )),
    >
    Here's how python-mode indents this code:
    schema = BaseSchema.copy () + Schema((
    StringField('re ference',
    widget=StringWi dget(
    description='Po sition reference'
    )),
    I get:

    schema = BaseSchema.copy () + Schema((
    StringField('re ference',
    widget=StringWi dget(
    description='Po sition 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.
    --
    Michael Hoffman

    Comment

    • Steven W. Orr

      #3
      Re: Indenting in Emacs

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

      =>eugene.morozo v@gmail.com 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('re ference',
      => widget=StringWi dget(
      => description='Po sition reference'
      => )),
      =>>
      =>Here's how python-mode indents this code:
      =>schema = BaseSchema.copy () + Schema((
      => StringField('re ference',
      => widget=StringWi dget(
      => description='Po sition reference'
      => )),
      =>
      =>I get:
      =>
      =>schema = BaseSchema.copy () + Schema((
      = StringField('re ference',
      = widget=StringWi dget(
      = description='Po sition 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

      Comment

      • Eugene Morozov

        #4
        Re: Indenting in Emacs

        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

        Comment

        • John J. Lee

          #5
          Re: Indenting in Emacs

          Eugene Morozov <usenet@eugenem orozov.namewrit es:
          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.
          Note that's a different python-mode to the old one that lives on SF.
          Yes, there are now two of them.


          John

          Comment

          • Michael Hoffman

            #6
            Re: Indenting in Emacs

            John J. Lee wrote:
            Eugene Morozov <usenet@eugenem orozov.namewrit es:
            >
            >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.
            >
            Note that's a different python-mode to the old one that lives on SF.
            Yes, there are now two of them.
            Which one is better?
            --
            Michael Hoffman

            Comment

            • John J. Lee

              #7
              Re: Indenting in Emacs

              Michael Hoffman <cam.ac.uk@mh39 1.invalidwrites :
              John J. Lee wrote:
              >Eugene Morozov <usenet@eugenem orozov.namewrit es:
              >>
              >>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.
              >>
              >Note that's a different python-mode to the old one that lives on SF.
              >Yes, there are now two of them.
              >
              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

              Comment

              Working...