Subject: bug#22663: 25.0.91; python.el electric-indent misbehaviour with 'except:'

From: Matthew Woodcraft <[email-masked]>
Date: Sun, 14 Feb 2016 17:13:18 +0000

If I have the following code and add the colon after the 'ValueError',
python.el's electric-indent helpfully dedents the 'except' line, but
also indents the line below.

def foo():
    try:
        a = int(s)
        except ValueError
    bar(a)

In practice this is never what I want to happen: if I'm adding
try/except around part of an existing function, the existing lines after
'except' are for the non-exceptional case.

(Seen in emacs 25.0.91; 24.5 is the same; checked with 'emacs -Q'.)

In GNU Emacs 25.0.91.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2016-02-14, modified by Debian built on golux
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.3 (jessie)

Configured using:
 'configure --build i586-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/25.0.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.0.91/site-lisp:/usr/share/emacs/site-lisp
 --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/25.0.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.0.91/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall -fno-omit-frame-pointer'
 CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_CTYPE: en_GB.UTF-8
  locale-coding-system: utf-8-unix