cascading indent

Bug #1101962 reported by Glenn Linderman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
High
Andreas Roehler

Bug Description

python-mode.el 6.1.0 emacs 24.0.93.1

I did an indent-region (which doesn't seem to be the default for TAB when a region is selected, which it seemed to be in 6.0.5), and got a cascading indent. Happily, I was able to quickly reduce it to:

def foo():
    pgdt = []
        pdwd = []

and the next line wants one more indent...

Revision history for this message
Glenn Linderman (v+python) wrote :
Revision history for this message
Andreas Roehler (a-roehler) wrote :

hmm, don't get it - see attachment.

Please send some more info on preceding commands - extension of region, cursor position etc.
Maybe send output from M-x report-emacs-bug

Changed in python-mode:
milestone: none → 6.1.1
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Medium
Revision history for this message
Glenn Linderman (v+python) wrote :
Download full text (4.1 KiB)

For the test case, I started a fresh emacs, visited a new file bar.py, and began typing what you see, but I didn't type any tabs or repeated spaces at the beginning of the lines, the python-mode did that. For the below, I used the filename bar2.py, since I already had a bar.py from the earlier report.

I'll include the report-emacs-bug output below. I note it talks about emacs -Q, I've no clue what that does.

To: <email address hidden>
Subject: 24.0.93; python-mode cascading indent
--text follows this line--
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org. Please check that
the From: line contains a valid email address. After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug. If you can, give a recipe
starting from `emacs -Q':

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
d:/emacs/etc/DEBUG.

In GNU Emacs 24.0.93.1 (i386-mingw-nt6.1.7601)
 of 2012-02-15 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Py

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f f o <backspace> <backspace> b a r 2 . p y <return>
d e f SPC f o o ( ) : <return> p d <backspace> g d
t SPC = SPC [ ] <return> p d w d SPC = SPC [ ] <return>
<escape> x r e p o r t - e m a c s - b u g <return
>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Warning: no abbrev-file found, customize `abbrev-file-name' in order to make mode-specific abbrevs work.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-enc...

Read more...

Changed in python-mode:
status: New → In Progress
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1101962] Re: cascading indent

Am 21.01.2013 04:15, schrieb Glenn Linderman:
> For the test case, I started a fresh emacs, visited a new file bar.py,
> and began typing what you see, but I didn't type any tabs or repeated
> spaces at the beginning of the lines, the python-mode did that. For the
> below, I used the filename bar2.py, since I already had a bar.py from
> the earlier report.
>
> I'll include the report-emacs-bug output below. I note it talks about
> emacs -Q, I've no clue what that does.
>

M-x info RET m Emacs m Initial Options

Call emacs with option "-Q" from a command line and see if it happens again.
Still can't reproduce...

Revision history for this message
Glenn Linderman (v+python) wrote :

Well, with -Q it doesn't happen... but then with -Q, python-mode doesn't get loaded, either.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 21.01.2013 20:10, schrieb Glenn Linderman:
> Well, with -Q it doesn't happen... but then with -Q, python-mode doesn't
> get loaded, either.
>

Well, M-x find-file RET MY-PATH-TO-python-mode.el RET eval-buffer RET

Then open your example.py

after error, please send the output from M-x report-emacs-bug

Revision history for this message
Glenn Linderman (v+python) wrote :
Download full text (4.3 KiB)

OK. Thanks for the instructions. I use emacs as a tool, not a career, so I know the editing keystrokes, and stumble through the rest...

It did still reproduce for me. Here's the report-emacs-bug output:

To: <email address hidden>
Subject: 24.0.93; cascading indent
--text follows this line--
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org. Please check that
the From: line contains a valid email address. After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug. If you can, give a recipe
starting from `emacs -Q':

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
d:/emacs/etc/DEBUG.

In GNU Emacs 24.0.93.1 (i386-mingw-nt6.1.7601)
 of 2012-02-15 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Py

Minor modes in effect:
  outline-minor-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <escape> x f i n d - f i l e <return> m
y \ e m <tab> <backspace> <backspace> <backspace> <backspace>
<backspace> e m a c <tab> / <tab> <help-echo> <mouse-1>
<mouse-1> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
C-y / <tab> p y <tab> <return> <escape> x e v a l -
b u f f e r <return> C-x C-f b o <backspace> a r 3
. p y <return> d e f SPC f o o ( ) : <return> p d <backspace>
g d t SPC = SPC [ ] <return> p d w d SPC = SPC [ ]
<return> <escape> x r e p o r t - e m a c s - b i g
<backspace> <backspace> u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
You can run the command `find-file' with C-x C-f
Warning: no abbrev-file found, customize `abbrev-file-name' in order to make mode-sp...

Read more...

Revision history for this message
Andreas Roehler (a-roehler) wrote :

please check out current trunk with bazaar:

bzr branch lp:python-mode

Do you still experience this then?

Changed in python-mode:
status: In Progress → Incomplete
Revision history for this message
Glenn Linderman (v+python) wrote :

This certainly fixed the test case, I reported.

However, going back to my original case, I still get a cascading indent. I will try to reduce the size of that case, to be able to report it easier.

OK, the attached bar3.py, although it won't compile because it references variables that are not defined, is syntactically correct... except the lines 5 and beyond, are indented too far. So I select them, and choose Indent-region. Line 5 gets indented correctly. But lines 9 and beyond are indented too far.

Revision history for this message
Glenn Linderman (v+python) wrote :

Oh, and I don't have a bzr command on my system. So I just downloaded what seems to be the trunk version of python-mode.el by browsing the trunk code, and choosing to download that file. If I need anything else, let me know. That used to be all I needed, I have no clue what the other files are for.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Okay, get a from indent after the cItemLik assignement, thanks!

Changed in python-mode:
status: Incomplete → Confirmed
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 31.01.2013 01:57, schrieb Glenn Linderman:
> Oh, and I don't have a bzr command on my system. So I just downloaded
> what seems to be the trunk version of python-mode.el by browsing the
> trunk code, and choosing to download that file.

That's okay. You should get a download button at

http://bazaar.launchpad.net/~python-mode-devs/python-mode/python-mode/files

  If I need anything
> else, let me know. That used to be all I needed, I have no clue what the
> other files are for.
>

Changed in python-mode:
importance: Medium → High
Changed in python-mode:
status: Confirmed → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.