[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15163: 24.3; python-mode, electric colon bug

From: Stefan Monnier
Subject: bug#15163: 24.3; python-mode, electric colon bug
Date: Mon, 26 Aug 2013 23:00:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> if a:
>     if b:
>         pass
>     else:
>         pass
>         else:

> The last 'else' isn't indented properly.

Fabián, could you look into it?
When tracing through python-indent-electric-colon, I see that
python-info-closing-block-message returns nil, so we indent back to the
original indentation.
And while you're looking at this code, could you add a comment
explaining why you do

      (when (> indentation calculated-indentation)
          (indent-line-to calculated-indentation)
          (when (not (python-info-closing-block-message))
            (indent-line-to indentation)))))))

instead of (say)
      (when (and (python-info-closing-block-message)
                 (> indentation calculated-indentation))
          (indent-line-to calculated-indentation)))

-- Stefan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]