GNU bug report logs - #24809
25.1; Python.el improper indention after backslash-assignment-continuation

Previous Next

Package: emacs;

Reported by: Jules Tamagnan <jtamagnan <at> gmail.com>

Date: Thu, 27 Oct 2016 22:04:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 25.1

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: 24809 <at> debbugs.gnu.org
Cc: Jules Tamagnan <jtamagnan <at> gmail.com>
Subject: bug#24809: 25.1; Python.el improper indention after backslash-assignment-continuation
Date: Mon, 22 May 2017 20:26:29 -0400
[Message part 1 (text/plain, inline)]
[Please use "Reply All" to keep 24809 <at> debbugs.gnu.org on Cc]

[Message part 2 (message/rfc822, inline)]
From: Jules Tamagnan <jtamagnan <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Subject: Re: bug#24809: 25.1; Python.el improper indention after backslash-assignment-continuation
Date: Mon, 22 May 2017 11:46:32 -0700
npostavs <at> users.sourceforge.net writes:

> Jules Tamagnan <jtamagnan <at> gmail.com> writes:
>
>> The bug is quite simple.
>>   - Open a python file.
>>   - Type:
>>     hello = \
>>   - C-m ; newline
>>
>> The point will now be directly under the backslash character. This is
>> indented incorrectly according to the pep8 style guide and the
>> pycodestyle checker, it should instead be indented
>> `python-indent-offset` further than the previous line.
>
> So the patch works (additionally the python-indent-after-backslash-4
> test would need to be updated) but I'm not sure if it's correct.
> Currently, the pep8 style guide doesn't really say anything about
> indentation following backslash, it just recommends using parens
> instead.

I can update the test. Yeah it is a sort of gray zone because the style
guide isn't explicit. I think that the goal of putting a backslash after
the equal sign would be to split a line that was too long. The current
way that emacs chooses to split a line is not really consistent that
goal or with the outcome of using an open paren. I think that the
following long line:

an_overly_long_variable_name = some_object.some_method(some_argument_to_some_method)

could be split like this:

an_overly_long_variable_name = (
    some_object.some_method(some_argument_to_some_method))

or if someone wanted to use a backslash like this:

an_overly_long_variable_name = \
    some_object.some_method(some_argument_to_some_method)

instead of like:

an_overly_long_variable_name = \
                               some_object.some_method(some_argument_to_some_method)

This bug report was last modified 7 years and 356 days ago.

Previous Next


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