GNU bug report logs -
#72750
29.3; indent-region changes semantics of python code
Previous Next
Reported by: Michael Arndt <michael <at> rndt.dev>
Date: Wed, 21 Aug 2024 18:09:01 UTC
Severity: normal
Tags: notabug, wontfix
Found in version 29.3
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Am 21.08.24 um 20:06 schrieb Michael Arndt via Bug reports for GNU
Emacs, the Swiss army knife of text editors:
> Hi,
>
> I have a problem when indenting python files. There seems to be a case
> when using indent-region changes the semantics of the python code. When
> there is no blank line after an if-statement, the next line becomes part
> of the if statement.
>
> The problem can be reproduced by the following steps:
>
> 1. Start emacs -Q
> 2. Create a python file with the following contents:
>
> if False:
> print("output1")
> print("output2")
>
> 3. Use M-x mark-whole-buffer
> 4. Use M-x indent-region
> 5. The file contents change into:
>
> if False:
> print("output1")
> print("output2")
>
> The problem can be avoided by adding a blank line after the if statement.
> Because I use a custom indentation function that calls (indent-region
> (point-min) (point-max)) this can happen pretty quickly. Is this a
> limitation of python-indent-region?
>
> Greetings
> Michael
>
>
Hi Michael,
I'm not maintaining the related code, just a comment:
as indent might by syntax at Python, there is not way for
auto-formatting - unless you are happy with the outmost reasonable indent.
|Best,|
|Andreas
|
[Message part 2 (text/html, inline)]
This bug report was last modified 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.