GNU bug report logs -
#17658
Python mode has odd indentation behavior
Previous Next
Reported by: Adam Connor <adamc55 <at> gmail.com>
Date: Sun, 1 Jun 2014 02:25:02 UTC
Severity: normal
Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> ------------------------------ 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.
Indeed, I can reproduce this in Emacs-24.3.91. The important detail is
not to hit "," but to insert a char right before the inner close paren.
The problem seems to be in python-indent-post-self-insert-function,
where the "still in parenthesis" check doesn't realize that it's within
a different pair of parens.
> Is this a bug?
Looks like it, yes. Fabián, can you take care of it?
> Is there a way to turn this off?
A temporary workaround could be
(add-hook 'python-mode-hook
(lambda ()
(remove-hook 'post-self-insert-hook
#'python-indent-post-self-insert-function 'local)))
-- Stefan
This bug report was last modified 11 years and 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.