GNU bug report logs - #70617
30.0.50; python-indent-shift-right indents left when line is whitespace

Previous Next

Package: emacs;

Reported by: Patrick Poitras <patrick.f.poitras <at> gmail.com>

Date: Sat, 27 Apr 2024 23:18:01 UTC

Severity: normal

Tags: wontfix

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 70617 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: kobarity <kobarity <at> gmail.com>
Cc: 70617 <at> debbugs.gnu.org, patrick.f.poitras <at> gmail.com
Subject: Re: bug#70617: 30.0.50;
 python-indent-shift-right indents left when line is whitespace
Date: Thu, 09 May 2024 10:39:37 +0300
tags 70617 wontfix
close 70617
thanks

> Date: Tue, 30 Apr 2024 16:26:13 +0900
> From: kobarity <kobarity <at> gmail.com>
> Cc: 70617 <at> debbugs.gnu.org
> 
> Eli Zaretskii wrote:
> > 
> > > From: Patrick Poitras <patrick.f.poitras <at> gmail.com>
> > > Date: Sat, 27 Apr 2024 16:16:46 -0700
> > > 
> > > Hi all.
> > > 
> > > I've noticed this weird behavior of python-indent-shift-right.
> > > 
> > > Let's say I have a block of code. The "|" character represents my cursor
> > > 
> > > In a python file, I write
> > > 
> > > if True:
> > > |
> > > 
> > > (... file contents continue)
> > > 
> > > and then call python-indent-shift-right on an empty line. It does nothing. If the second line has any amount of
> > > spaces, the whitespace is entirely deleted. 
> > > 
> > > Given that Python's whitespace is syntactically significant, the expected behavior should be to add an indent
> > > to an empty line, or to prepend 4 characters (or 8, given user choice) to the empty line if it has whitespace.
> > > From a cursory glance, I think we're running into some behavior of indent-rigidly that tries to prevent the
> > > addition of superfluous white space following an indented block of code. I assume this would be potentially
> > > desirable for languages with non-significant whitespace, but in the case of the python-specific function, the
> > > resulting behavior defies both the function name and description.
> > 
> > Any comments?
> 
> Hi Patrick,
> 
> I believe this behavior is intended to avoid adding extra whitespaces
> when processing a region containing blank lines.  There may be an
> approach to change to indent even a blank line as a special case when
> the region is not active, but I personally think that Enter or TAB
> indentation is sufficient in such cases.

No further comments, so I'm now closing this bug as wontfix.

Thanks.




This bug report was last modified 1 year and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.