When running a python interpreter in inferior-python mode, sometimes calling auto-completion with C-M-i on an indented line causes the underlying python interpreter to get confused, leading it to produce an unexpected indent error. Steps to reproduce: 1. Start emacs with a blank config 2. run-python 3. run this code, performing auto-completion (C-M-i) between the "5" and ":" on line 2: for i in range(10): if i < 5: print(i) Python will break after hitting enter on the second line, reporting an unexpected indent. The same code without the C-M-i will run fine, printing the integers between 0 and 4 (inclusive). In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.3) of 2016-05-05 on arojas Windowing system distributor `The X.Org Foundation', version 11.0.11803000 System Description: Arch Linux Configured using: `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Inferior Python Minor modes in effect: compilation-shell-minor-mode: t 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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Starting Emacs daemon. When done with this frame, type C-x 5 0 Making python-shell-interpreter local to *Python* while let-bound! Making python-shell-interpreter-args local to *Python* while let-bound! Sent python-shell-completion-setup-code Sent python-ffap-setup-code Sent python-eldoc-setup-code No match Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message idna 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 compile cl-extra python easymenu json comint ring cl-loaddefs cl-lib ansi-color server time-date 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 84389 8157) (symbols 48 18864 0) (miscs 40 56 174) (strings 32 13129 4758) (string-bytes 1 399070) (vectors 16 10809) (vector-slots 8 401723 6355) (floats 8 73 175) (intervals 56 270 0) (buffers 960 13) (heap 1024 37934 927))