From: Matthew Woodcraft <matthew@woodcraft.me.uk>
To: 22661@debbugs.gnu.org
Subject: bug#22661: 25.0.91; python.el electric-indent misbehaviour with 'else:' and nested 'if:'
Date: Sun, 14 Feb 2016 17:09:31 +0000 [thread overview]
Message-ID: <87a8n3z0ac.fsf@golux.woodcraft.me.uk> (raw)
If I have the following code and add the colon after the 'else',
python.el's electric-indent moves the 'else' to align with the inner
'if'.
def foo()
if aaa:
if bbb:
x = 1
y = 1
else
I think it would be much better to leave the else alone in this
situation (ie, when its current position matches an outer 'if'), for two
reasons:
- it's generally better to leave things alone than to make a guess
which is quite likely to be wrong;
- if the user has typed the whole thing in one go, then to reach this
situation they must have explicitly dedented the 'else' already.
(Seen in emacs 25.1 pretest; 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
next reply other threads:[~2016-02-14 17:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-14 17:09 Matthew Woodcraft [this message]
2016-12-13 2:01 ` bug#22661: 25.0.91; python.el electric-indent misbehaviour with 'else:' and nested 'if:' Hong Xu
2017-01-21 17:34 ` Matthew Woodcraft
2017-01-22 2:08 ` Hong Xu
2017-01-22 22:34 ` Matthew Woodcraft
2017-01-22 23:08 ` npostavs
2017-01-23 0:50 ` Hong Xu
2017-01-24 1:24 ` npostavs
2017-01-27 1:20 ` npostavs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8n3z0ac.fsf@golux.woodcraft.me.uk \
--to=matthew@woodcraft.me.uk \
--cc=22661@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.