* bug#15163: 24.3; python-mode, electric colon bug
@ 2013-08-22 16:17 Alexis Roda
2013-08-23 6:35 ` Andreas Röhler
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Alexis Roda @ 2013-08-22 16:17 UTC (permalink / raw)
To: 15163
Electric colon don't indent when used in conjunction with
newline-and-indent in some nested statements.
To reproduce:
emacs -Q /tmp/bugtest.py
and type:
i f SPC a : C-j i f SPC b : C-j p a s s C-j e l s e : C-j p a s s C-j
e l s e :
you'll get:
if a:
if b:
pass
else:
pass
else:
The last 'else' isn't indented properly.
In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
of 2013-08-17 on superjul
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description: Ubuntu 12.04.2 LTS
Configured using:
`configure '--prefix=/opt/emacs/24.3''
Important settings:
value of $LANG: ca_ES.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Python
Minor modes in effect:
hi-lock-mode: t
show-paren-mode: t
global-hl-line-mode: t
display-time-mode: t
shell-dirtrack-mode: t
yas-global-mode: t
yas-minor-mode: t
autopair-global-mode: t
autopair-mode: t
outline-minor-mode: t
diff-auto-refine-mode: t
tooltip-mode: t
mouse-wheel-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:
<down> <down> <down> C-SPC <down> <down> <down> <down>
<down> <down> C-w i f SPC a : <return> p a s s <tab>
<return> e l s e : <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> i f <backspace> <backspace>
<backspace> i f SPC b : <tab> <return> p a s s <tab>
<return> e l s e : <tab> <return> e l s e : <return>
p a s s <tab> <return> <down-mouse-1> <mouse-1> <down>
C-SPC <down> <down> <down> <down> <down> <down> C-w
i f SPC a : C-j i f SPC b : C-j p a s s C-j e l s e
: C-j p a s s C-j e l s e : C-j p a s s C-j M-x r e
p o <tab> r <tab> <return>
Recent messages:
[yas] Loading for `python-mode', just-in-time: (yas--load-directory-1
/home/alex/emacslib/shared/yasnippets/snippets/python-mode (quote
python-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from
/home/alex/emacslib/shared/yasnippets/snippets/python-mode
Mark set
Closes if a: [2 times]
Closes if b:
Closes if a:
Auto-saving...done
Mark activated
Closes if b:
Making completion list...
Load-path shadows:
~/emacslib/site-lisp/rst hides
/opt/emacs/24.3/share/emacs/24.3/lisp/textmodes/rst
Features:
(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 hi-lock cus-edit uniquify
warnings paren hl-line time cus-start cus-load rainbow-mode color
css-mode buffer-move windmove todo todo-util python-pep8 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 flymake compile pydoc-info info-look info
arv-py yasnippet edmacro kmacro help-mode w3m-load template sql
thingatpt he-utils etags hippie-exp python rx comint ansi-color deft
autopair noutline outline pymacs psvn advice help-fns advice-preload
wid-edit cl cl-lib log-edit ring pcvs-util add-log diff-mode easy-mmode
easymenu multiple-cursors-autoloads rainbow-mode-autoloads
smart-operator-autoloads solarized-theme-autoloads package find-dired
dired 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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#15163: 24.3; python-mode, electric colon bug
2013-08-22 16:17 bug#15163: 24.3; python-mode, electric colon bug Alexis Roda
@ 2013-08-23 6:35 ` Andreas Röhler
2013-08-23 11:17 ` Alexis Roda
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2013-08-23 6:35 UTC (permalink / raw)
To: 15163
Am 22.08.2013 18:17, schrieb Alexis Roda:
> Electric colon don't indent when used in conjunction with
> newline-and-indent in some nested statements.
>
> To reproduce:
>
> emacs -Q /tmp/bugtest.py
>
> and type:
>
> i f SPC a : C-j i f SPC b : C-j p a s s C-j e l s e : C-j p a s s C-j e l s e :
>
> you'll get:
>
> if a:
> if b:
> pass
> else:
> pass
> else:
>
> The last 'else' isn't indented properly.
>
>
IMO 'else' shouldn't be indented at all here, as an "if" can't have two "else"-clauses
May confirm the bug with
GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2013-07-06
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#15163: 24.3; python-mode, electric colon bug
2013-08-22 16:17 bug#15163: 24.3; python-mode, electric colon bug Alexis Roda
2013-08-23 6:35 ` Andreas Röhler
@ 2013-08-23 11:17 ` Alexis Roda
2013-08-27 3:00 ` Stefan Monnier
2014-07-09 3:58 ` Fabián Ezequiel Gallina
3 siblings, 0 replies; 6+ messages in thread
From: Alexis Roda @ 2013-08-23 11:17 UTC (permalink / raw)
To: 15163
Reading the bugreport afterwards looks like it lacks the final point. I
meant: I'd expect the last "else" to be aligned with the outermost "if".
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#15163: 24.3; python-mode, electric colon bug
2013-08-22 16:17 bug#15163: 24.3; python-mode, electric colon bug Alexis Roda
2013-08-23 6:35 ` Andreas Röhler
2013-08-23 11:17 ` Alexis Roda
@ 2013-08-27 3:00 ` Stefan Monnier
2014-07-09 3:58 ` Fabián Ezequiel Gallina
3 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-08-27 3:00 UTC (permalink / raw)
To: Fabián E. Gallina; +Cc: 15163
> if a:
> if b:
> pass
> else:
> pass
> else:
> The last 'else' isn't indented properly.
Fabián, could you look into it?
When tracing through python-indent-electric-colon, I see that
python-info-closing-block-message returns nil, so we indent back to the
original indentation.
And while you're looking at this code, could you add a comment
explaining why you do
(python-info-closing-block-message)
(when (> indentation calculated-indentation)
(save-excursion
(indent-line-to calculated-indentation)
(when (not (python-info-closing-block-message))
(indent-line-to indentation)))))))
instead of (say)
(when (and (python-info-closing-block-message)
(> indentation calculated-indentation))
(save-excursion
(indent-line-to calculated-indentation)))
-- Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#15163: 24.3; python-mode, electric colon bug
2013-08-22 16:17 bug#15163: 24.3; python-mode, electric colon bug Alexis Roda
` (2 preceding siblings ...)
2013-08-27 3:00 ` Stefan Monnier
@ 2014-07-09 3:58 ` Fabián Ezequiel Gallina
2014-07-09 4:01 ` Fabián Ezequiel Gallina
3 siblings, 1 reply; 6+ messages in thread
From: Fabián Ezequiel Gallina @ 2014-07-09 3:58 UTC (permalink / raw)
To: 15163-done
Fixed in revno 117366.
Cheers,
Fabián
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#15163: 24.3; python-mode, electric colon bug
2014-07-09 3:58 ` Fabián Ezequiel Gallina
@ 2014-07-09 4:01 ` Fabián Ezequiel Gallina
0 siblings, 0 replies; 6+ messages in thread
From: Fabián Ezequiel Gallina @ 2014-07-09 4:01 UTC (permalink / raw)
To: 15163-done
(emacs-24 branch)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-09 4:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 16:17 bug#15163: 24.3; python-mode, electric colon bug Alexis Roda
2013-08-23 6:35 ` Andreas Röhler
2013-08-23 11:17 ` Alexis Roda
2013-08-27 3:00 ` Stefan Monnier
2014-07-09 3:58 ` Fabián Ezequiel Gallina
2014-07-09 4:01 ` Fabián Ezequiel Gallina
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.