From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?UTF-8?Q?R=C3=B6hler?= Newsgroups: gmane.emacs.bugs Subject: bug#17658: Python mode has odd indentation behavior Date: Sun, 01 Jun 2014 17:32:02 +0200 Message-ID: <538B4772.2010109@easy-emacs.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1401636811 14176 80.91.229.3 (1 Jun 2014 15:33:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Jun 2014 15:33:31 +0000 (UTC) To: 17658@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 01 17:33:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wr7lB-0004uT-VM for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jun 2014 17:33:22 +0200 Original-Received: from localhost ([::1]:41183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr7lB-0001HE-Jk for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jun 2014 11:33:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr7l0-0001Ga-D4 for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:33:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wr7kt-0005Ad-0N for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:33:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr7ks-0005AV-UC for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wr7ks-0001TM-AE for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jun 2014 15:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17658 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14016367725640 (code B ref -1); Sun, 01 Jun 2014 15:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jun 2014 15:32:52 +0000 Original-Received: from localhost ([127.0.0.1]:40010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wr7kh-0001St-3C for submit@debbugs.gnu.org; Sun, 01 Jun 2014 11:32:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50014) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wr7ke-0001Sf-4M for submit@debbugs.gnu.org; Sun, 01 Jun 2014 11:32:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wr7kR-00051W-Lp for submit@debbugs.gnu.org; Sun, 01 Jun 2014 11:32:42 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:37739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr7kR-00051S-IB for submit@debbugs.gnu.org; Sun, 01 Jun 2014 11:32:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr7kL-0001BV-1V for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:32:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wr7kE-00050C-NG for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:32:28 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.187]:54923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr7kE-000501-EY for bug-gnu-emacs@gnu.org; Sun, 01 Jun 2014 11:32:22 -0400 Original-Received: from [192.168.178.32] (brln-4dba332f.pool.mediaWays.net [77.186.51.47]) by mrelayeu.kundenserver.de (node=mreue006) with ESMTP (Nemesis) id 0LenO7-1WTOG43UI3-00qmzx; Sun, 01 Jun 2014 17:32:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.5.0 In-Reply-To: X-Provags-ID: V02:K0:btt6b41fb4IYkynLFiqrtnqlmqcq5/748DkwTyw2IMm C8EjhReMwyxZt5ONvriMyKE6Vmo17BEGJHDCMDjyfgJct8G1/6 yMY8+x5IkDNXSwzYZ2Tqzf4g1iiahafPvlWe6nPVJNe0kP2e9C ABpwclU1sIyqmPP+L+SiFFvUKawj0zhKPD8VdcHHD/gZ9J74Sw ZzR+5sVMWyJ6HsWLWpL0gfyNgGWuQ0U4KvQ1S+RQXAX/IE1pRV cybxpNa0oZsk9c6n+hdMOmlgahjEuaZWTeUJh23SGiC5+Fxh4W poMXaXaQqLzt2xAMfJhZw9226iowF6zYiEeCUuCqSoN5g0Qk3h ZOSFFsbwkIG4NHBgtBT2fkh4LLSqtXT7oIpvKrkT5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89861 Archived-At: On 01.06.2014 04:47, Stefan Monnier wrote: >> ------------------------------ 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 > > > > Can't reproduce. Indents to column 23, which seems correct. BTW setting `electric-indent-mode' to nil would also be an alternative to avoid it. Andreas ;;;;;;;;;;;;;; In GNU Emacs 24.3.90.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2014-04-24 Windowing system distributor `The X.Org Foundation', version 11.0.11204000 System Description: Debian GNU/Linux 7.5 (wheezy) Important settings: value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: 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 blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC M-+ , C-x 1 C-SPC M-f M-f M-f M-w C-h v C-x 1 M-+ C-x b , C-x b M-x e d e b C-g M-x e x i t - r q c o u q C-_ M-x c l u o l u , SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC M-x e r e p o r t - e m Recent messages: Result: 23 (#o27, #x17, ?\C-w) Result: 23 (#o27, #x17, ?\C-w) Result: 23 (#o27, #x17, ?\C-w) Result: 23 (#o27, #x17, ?\C-w) Result: 23 (#o27, #x17, ?\C-w) Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message 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 mail-prsvr mail-utils cus-start cus-load mule-util edebug cl-loaddefs cl-lib find-func help-mode help-fns python easymenu comint ring ansi-color 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 inotify dynamic-setting x-toolkit x multi-tty emacs) Memory information: ((conses 8 131478 7096) (symbols 24 37591 0) (miscs 20 149 1193) (strings 16 50813 4816) (string-bytes 1 715481) (vectors 8 11545) (vector-slots 4 408689 5730) (floats 8 69 778) (intervals 28 658 16) (buffers 512 15) (heap 1024 18515 438))