unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18843: Invalid block indentation in Python mode
@ 2014-10-26 14:18 Paul Pogonyshev
  2014-10-30 19:13 ` bug#18843: Carlos Pita
  2014-11-15 21:21 ` bug#18843: Invalid block indentation in Python mode Fabián Ezequiel Gallina
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Pogonyshev @ 2014-10-26 14:18 UTC (permalink / raw)
  To: 18843

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Block indentation in Python mode often gives silly results. For example,
with 'emacs -q' create a Python buffer and type this:

def foo ():
    try:
        pass
    except:
        pass

Now 'C-x h TAB' gives something that is not valid at all:

def foo ():
    try:
        pass
except:
    pass

Note that if you go to the 'except:' line and press 'TAB', 'except:' is
indented back to its proper position. Further 'TAB's don't change this,
i.e. mode understands that it cannot place 'except:' at any other
indentation level.

Emacs version (just compiled):
GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9) of
2014-10-26

Paul

[-- Attachment #2: Type: text/html, Size: 874 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#18843:
  2014-10-26 14:18 bug#18843: Invalid block indentation in Python mode Paul Pogonyshev
@ 2014-10-30 19:13 ` Carlos Pita
  2014-11-15 21:21 ` bug#18843: Invalid block indentation in Python mode Fabián Ezequiel Gallina
  1 sibling, 0 replies; 3+ messages in thread
From: Carlos Pita @ 2014-10-30 19:13 UTC (permalink / raw)
  To: 18843

This is a duplicate of my own report #18796.

Take a look at that report for a very simple fix.

Hope it gets commited soon.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#18843: Invalid block indentation in Python mode
  2014-10-26 14:18 bug#18843: Invalid block indentation in Python mode Paul Pogonyshev
  2014-10-30 19:13 ` bug#18843: Carlos Pita
@ 2014-11-15 21:21 ` Fabián Ezequiel Gallina
  1 sibling, 0 replies; 3+ messages in thread
From: Fabián Ezequiel Gallina @ 2014-11-15 21:21 UTC (permalink / raw)
  To: 18843-done


Fixed at 89ebffc in the emacs-24 branch.

`python-indent-region` region now follows saner approach, it uses
`python-indent-line` and skips special cases: namely block starts,
enders and dedenters.

The idea is that those mark the base indentation and stuff within them
could be re-indented.

I tested this approach in few large codebases and the results are quite
promising, in fact I found several bad indented stuff thanks to this.


PS: I unmerged this from #18796, it's not really the same thing.



Thanks for the report,
Fabián





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-15 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-26 14:18 bug#18843: Invalid block indentation in Python mode Paul Pogonyshev
2014-10-30 19:13 ` bug#18843: Carlos Pita
2014-11-15 21:21 ` bug#18843: Invalid block indentation in Python mode Fabián Ezequiel Gallina

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).