|
From: | Andreas Röhler |
Subject: | bug#17658: Python mode has odd indentation behavior |
Date: | Sun, 01 Jun 2014 17:32:02 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.5.0 |
On 01.06.2014 04:47, Stefan Monnier wrote:
------------------------------ snip ------------------------------ from django.conf.urls import patterns, include, urlfrom django.contrib import adminfrom myapp import viewsurlpatterns = 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-+ <help-echo> <help-echo> <help-echo> <help-echo> <backspace> , C-x 1 <next> <prior> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <left> C-SPC M-f M-f M-f M-w <help-echo> <help-echo> <left> C-h v <return> C-x 1 <next> <prior> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <left> <help-echo> <help-echo> <help-echo> M-+ C-x b <return> <backspace> <help-echo> <help-echo> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> , <backspace> C-x b <return> M-x e d e b C-g M-x e x i t - r <tab> <return> q <left> <left> <up> <up> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <down> <right> <right> <right> <right> <right> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> <tab> c o u q C-_ M-x c l u <tab> <backspace> <backspace> o l u <tab> <return> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> , 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 <help-echo> M-x e <backspace> r e p o r t - e m <tab> <return> 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))
[Prev in Thread] | Current Thread | [Next in Thread] |