all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Adam Connor <adamc55@gmail.com>
Cc: "Fabián E. Gallina" <fabian@anue.biz>, 17658@debbugs.gnu.org
Subject: bug#17658: Python mode has odd indentation behavior
Date: Sat, 31 May 2014 22:47:59 -0400	[thread overview]
Message-ID: <jwvlhthice2.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CAC_vAoG0i9eyEk6R1F=bqh9=eia1wn-cZUPciEGWZ1RTfxghYw@mail.gmail.com> (Adam Connor's message of "Sat, 31 May 2014 20:49:09 -0500")

> ------------------------------ 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





  reply	other threads:[~2014-06-01  2:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01  1:49 bug#17658: Python mode has odd indentation behavior Adam Connor
2014-06-01  2:47 ` Stefan Monnier [this message]
2014-06-01 15:32   ` Andreas Röhler
2014-06-01 21:18     ` Stefan Monnier
2014-06-02  6:19       ` Andreas Röhler
2014-06-02 13:36         ` Stefan Monnier
2014-06-02 16:05           ` Andreas Röhler
2014-07-01  2:33 ` Fabián Ezequiel Gallina
2014-07-01  4:00 ` Fabián Ezequiel Gallina

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=jwvlhthice2.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=17658@debbugs.gnu.org \
    --cc=adamc55@gmail.com \
    --cc=fabian@anue.biz \
    /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.