Subject: bug#18432: 24.4.50; python-mode, elif line indentation

From: Sho Takemori <[email-masked]>
Date: Tue, 09 Sep 2014 20:30:44 +0900

Dear developers,

In a Python buffer, I have the following code.
Here _ indicates the position of the cursor.

if (a == 1 or
     a == 2):
     pass
elif (a == 3 or_a == 4):

When I press C-m, then this code becomes as follows:

if (a == 1 or
     a == 2):
     pass
elif (a == 3 or
a == 4):

I expected the following:

if (a == 1 or
     a == 2):
     pass
elif (a == 3 or
       a == 4):

Also I cannot change the indent level at the final line by TAB.

This may not be a bug.
But the 4th line and 5th line lack the compatibility with
the 1st line and the 2nd line.

Best Regards,
Sho Takemori

In GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
  of 2014-09-01 on K430-linux
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:    Ubuntu 14.04.1 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GCONF GSETTINGS NOTIFY LIBXML2
FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
   value of $LC_MONETARY: ja_JP.UTF-8
   value of $LC_NUMERIC: ja_JP.UTF-8
   value of $LC_TIME: ja_JP.UTF-8
   value of $LANG: ja_JP.UTF-8
   value of $XMODIFIERS: @im=fcitx
   locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
   tooltip-mode: t
   electric-indent-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

Recent input:
C-x b a a <return> M-x p y t h o n - m o d e <return>
i f SPC ( ) <left> a SPC = = SPC 1 SPC o r SPC a SPC
= = SPC 2 <right> : <left> <left> <left> <left> <left>
<left> <left> <left> <left> <return> <right> <right>
<right> <right> <right> C-e <return> p a s s <return>
e l i f SPC ( ) <left> a SPC = = SPC 3 SPC o r SPC
a SPC = = SPC 4 <right> : <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <right> <return>
TAB TAB TAB M-x r e p o r TAB RET

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Can't guess python-indent-offset, using defaults: 4
Closes if (a == 1 or [5 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils python easymenu json comint ring
cl-loaddefs cl-lib ansi-color time-date japan-util tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 85419 8164)
  (symbols 48 18988 0)
  (miscs 40 42 124)
  (strings 32 13521 4707)
  (string-bytes 1 398319)
  (vectors 16 11417)
  (vector-slots 8 480329 22421)
  (floats 8 70 275)
  (intervals 56 209 6)
  (buffers 976 12)
  (heap 1024 35387 982))