[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17658: Python mode has odd indentation behavior

From: Adam Connor
Subject: bug#17658: Python mode has odd indentation behavior
Date: Sat, 31 May 2014 20:49:09 -0500

I've seen this most often in Django coding. Suppose the following file:
------------------------------ snip ------------------------------
from django.conf.urls import patterns, include, url

from django.contrib import admin

from myapp import views

urlpatterns = patterns('',
    url(r'^$', views.index),
------------------------------ snip ------------------------------

When I try to change the "url..." line to
------------------------------ snip ------------------------------
    url(r'^$', views.index, name="myapp_index"),
------------------------------ snip ------------------------------

the moment I type the comma, the whole line bounces way over to the left.

Is this a bug? Is there a way to turn this off? It is highly

(For what it is worth, I've seen the same issue in Windows Emacs.)

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

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2)
 of 2013-07-26 on roseapple, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11405000
System Description:    Linux Mint 16 Petra

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  shell-dirtrack-mode: t
  my-keys-minor-mode: t
  global-undo-tree-mode: t
  tabbar-mode: t
  recentf-mode: t
  global-linum-mode: t
  linum-mode: t
  fci-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-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:
s e <down> <down-mouse-1> <mouse-movement> <mouse-1>
r e s <backspace> t u r n SPC H t t p R e s p o n s
e ( ' H e l l o ' ) C-x C-s <help-echo> <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <down-mouse-1>
<mouse-1> <return> C-v C-y <help-echo> <help-echo>
<down-mouse-1> <mouse-1> <return> C-y <home> SPC SPC
SPC SPC <down-mouse-1> <mouse-movement> <mouse-1> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <right> <down-mouse-1>
<mouse-1> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> r e a l m s _ o
f _ s o u r <backspace> <backspace> r c e r y ' <home>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> C-x
C-s <help-echo> <help-echo> C-h v i n d e n t - l i
n e - f u n c t i o n <return> <help-echo> <help-echo>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1>
<mouse-1> <return> SPC SPC SPC SPC U <backspace> u
r l ( ' <backspace> r ' ^ $ ' , SPC v i e w s . i n
d e x , SPC n a m e <backspace> <home> C-k C-k <down-mouse-1>
<mouse-1> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
, SPC <backspace> <backspace> <home> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> <kp-delete> <kp-delete> <kp-delete> <kp-delete>
<kp-delete> SPC SPC SPC SPC <down-mouse-1> <mouse-movement>
<mouse-movement> <drag-mouse-1> M-w <help-echo> <help-echo>
C-x h M-w <help-echo> <help-echo> <help-echo> <help-echo>
M-x r e p o r t - e m a c s - b u g <return>

Recent messages:
Can't guess python-indent-offset, using defaults: 4
Saving file /home/adam/django_projs/ros/character/views.py...
Wrote /home/adam/django_projs/ros/character/views.py
scroll-up-command: End of buffer
Mark set [2 times]
Saving file /home/adam/django_projs/ros/ros/urls.py...
Wrote /home/adam/django_projs/ros/ros/urls.py
Type "q" in help window to restore its previous buffer.

Load-path shadows:
/home/adam/.emacs.d/elpa/python-django-20131214.1841/python-django hides ~/.emacs.d/lib/python-django
/home/adam/.emacs.d/elpa/undo-tree-0.6.5/undo-tree hides ~/.emacs.d/lib/undo-tree
~/.emacs.d/elisp/virtualenv hides ~/.emacs.d/lib/virtualenv
/usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
~/.emacs.d/lib/indent hides /usr/share/emacs/24.3/lisp/indent
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.3/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.3/lisp/textmodes/flyspell

(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils tramp-cache tramp
tramp-compat auth-source eieio byte-opt bytecomp byte-compile cconv
gnus-util mm-util mail-prsvr password-cache tramp-loaddefs cl-macs gv
shell pcomplete format-spec pp misearch multi-isearch python-django sql
thingatpt json hippie-exp help-mode haskell-font-lock haskell-mode
haskell-string haskell-sort-imports haskell-align-imports cl noutline
outline flymake compile dabbrev disp-table python rx comint ring
ansi-color sh-script smie executable vc-git util undo-tree diff tabbar
indent revbufs recentf tree-widget wid-edit linum ido framemove advice
help-fns cl-lib advice-preload fill-column-indicator easy-mmode desktop
haskell-mode-autoloads edmacro kmacro info easymenu ov-autoloads
finder-inf python-django-autoloads undo-tree-autoloads package
misterioso-theme time-date tooltip 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 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 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 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]