GNU bug report logs - #20560
24.5; I am not happy with the new Python mode indentation behaviour

Previous Next

Package: emacs;

Reported by: Fabrice Salvaire <fabrice.salvaire <at> orange.fr>

Date: Tue, 12 May 2015 15:44:02 UTC

Severity: wishlist

Tags: confirmed

Merged with 33979

Found in versions 24.5, 26.1

To reply to this bug, email your comments to 20560 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20560; Package emacs. (Tue, 12 May 2015 15:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fabrice Salvaire <fabrice.salvaire <at> orange.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 May 2015 15:44:02 GMT) Full text and rfc822 format available.

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

From: Fabrice Salvaire <fabrice.salvaire <at> orange.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; I am not happy with the new Python mode indentation behaviour
Date: Tue, 12 May 2015 12:13:07 +0200
Dear Emacs devs,

I noticed after an Emacs update the Python mode changed its indentation 
behaviour.

I checked my .emacs and .gnu-emacs-custion for settings that could 
interfere with the Python mode, but I found anything.

First it imposes a newer indentation style, the closing 
brace/bracket/parenthesis on multi-line constructs line up under the 
first character of the line that starts the multi-line construct:

my_list = [
____1, 2, 3,
____4, 5, 6,
]

while I have thousands lines of codes typed on Emacs where  the closing 
character is indented, e.g.:

my_list = [
____1, 2, 3,
____4, 5, 6,
____]

Moreover if you press enter in the following construct at the location 
marked by *  to add an empty line or to add codes after the if:

if foo:
____a = 1
*a = 2

then the line is automatically indented:

if foo:
____a = 1

____a = 2

Thus I have to fight continuously with the indentation and it will 
probably increase the indentation noise in the VCS.

I guess Python is not the most easier language to indent automatically, 
but I would prefer manual indentation than to fight against my editor.

Sincerely yours,

Fabrice





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20560; Package emacs. (Tue, 12 May 2015 16:07:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Fabrice Salvaire <fabrice.salvaire <at> orange.fr>
Cc: 20560 <at> debbugs.gnu.org
Subject: Re: bug#20560: 24.5;
 I am not happy with the new Python mode indentation behaviour
Date: Tue, 12 May 2015 12:06:38 -0400
Fabrice Salvaire wrote:

> my_list = [
> ____1, 2, 3,
> ____4, 5, 6,
> ]

When I type that, I get an error, so perhaps it is not intended:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  =(nil 5)
  python-syntax-closing-paren-p()
  (and (python-syntax-closing-paren-p) (progn (forward-char 1) (not (nth 1 (or nil (syntax-ppss))))))
  (if (and (python-syntax-closing-paren-p) (progn (forward-char 1) (not (nth 1 (or nil (syntax-ppss)))))) (progn (cons :inside-paren-at-closing-paren start)))
  (save-excursion (skip-syntax-forward " ") (if (and (python-syntax-closing-paren-p) (progn (forward-char 1) (not (nth 1 (or nil (syntax-ppss)))))) (progn (cons :inside-paren-at-closing-paren start))))

> automatically, but I would prefer manual indentation than to fight
> against my editor.

Sounds like you want to turn off electric-indent-mode.




Merged 20560. Request was from fgallina <at> gnu.org (Fabián Ezequiel Gallina) to control <at> debbugs.gnu.org. (Mon, 06 Jul 2015 02:22:02 GMT) Full text and rfc822 format available.

Merged 19906 20560 20742. Request was from fgallina <at> gnu.org (Fabián Ezequiel Gallina) to control <at> debbugs.gnu.org. (Mon, 06 Jul 2015 02:25:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 20 Apr 2019 20:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20560; Package emacs. (Sat, 20 Apr 2019 20:59:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Fabrice Salvaire <fabrice.salvaire <at> orange.fr>, 20560 <at> debbugs.gnu.org
Subject: Re: bug#20560: 24.5;
 I am not happy with the new Python mode indentation behaviour
Date: Sat, 20 Apr 2019 16:58:37 -0400
# patch for 20742 doesn't help for 20560
unmerge 20560
forcemerge 33979 20560
quit

Glenn Morris <rgm <at> gnu.org> writes:

> Fabrice Salvaire wrote:
>
>> my_list = [
>> ____1, 2, 3,
>> ____4, 5, 6,
>> ]
>
> When I type that, I get an error, so perhaps it is not intended:
>
> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>   =(nil 5)
>   python-syntax-closing-paren-p()
>   (and (python-syntax-closing-paren-p) (progn (forward-char 1) (not (nth 1 (or nil (syntax-ppss))))))
>   (if (and (python-syntax-closing-paren-p) (progn (forward-char 1) (not (nth 1 (or nil (syntax-ppss)))))) (progn (cons :inside-paren-at-closing-paren start)))
>   (save-excursion (skip-syntax-forward " ") (if (and (python-syntax-closing-paren-p) (progn (forward-char 1) (not (nth 1 (or nil (syntax-ppss)))))) (progn (cons :inside-paren-at-closing-paren start))))

I'm not getting this anymore, perhaps it's been fixed in the meantime
(I've tested only in 25.3 and 26.2, I don't have 24.5 building at the
moment).

At any rate, the OP seems to be the same as 33979 (though different from
20742 which it was previously merged to).




Disconnected #20560 from all other report(s). Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 20 Apr 2019 20:59:02 GMT) Full text and rfc822 format available.

Forcibly Merged 20560 33979. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 20 Apr 2019 20:59:02 GMT) Full text and rfc822 format available.

Removed tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 20 Apr 2019 21:08:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20560; Package emacs. (Thu, 17 Sep 2020 19:00:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 20742 <at> debbugs.gnu.org, Tommi Komulainen <tommi.komulainen <at> iki.fi>,
 20560 <at> debbugs.gnu.org
Subject: Re: bug#20742: 24.5; [PATCH] python.el: fix close paren indentation
 to match pep8
Date: Thu, 17 Sep 2020 20:59:01 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> I managed to get this applied; I've replaced the python-test.el
> modifications, partly because they're written as updates to the existing
> tests which makes them a bit harder to follow, and partly to make more
> clear that the patch is below the 15 line copyright limit.
>
> I'll push to master in a week or so if there are no further comments.

Looks like this was done, so I'm closing this bug report.

commit 3fc1d77a43818666542740fc34167c1faee30d5f
Author:     Tommi Komulainen <tommi.komulainen <at> iki.fi>
AuthorDate: Fri Jun 19 18:53:52 2015 +0200
Commit:     Noam Postavsky <npostavs <at> gmail.com>
CommitDate: Sun Apr 28 16:45:13 2019 -0400

    python.el: Fix close paren indentation to match pep8 (Bug#20742)
    
    * lisp/progmodes/python.el (python-indent--calculate-indentation):
    When opening paren is followed by newline the closing paren should
    follow the current indentation.  Otherwise the closing paren should be
    aligned with the opening paren.  This fixes the latter case.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 20560 <at> debbugs.gnu.org and Fabrice Salvaire <fabrice.salvaire <at> orange.fr> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 17 Sep 2020 19:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20560; Package emacs. (Thu, 17 Sep 2020 19:23:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 20560 <at> debbugs.gnu.org
Subject: Re: bug#20742: 24.5; [PATCH] python.el: fix close paren indentation
 to match pep8
Date: Thu, 17 Sep 2020 15:22:10 -0400
On Thu, 17 Sep 2020 at 14:59, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Looks like this was done, so I'm closing this bug report.

>     python.el: Fix close paren indentation to match pep8 (Bug#20742)
>
>     * lisp/progmodes/python.el (python-indent--calculate-indentation):
>     When opening paren is followed by newline the closing paren should
>     follow the current indentation.  Otherwise the closing paren should be
>     aligned with the opening paren.  This fixes the latter case.
                                                      ^^^^^^

You're mixing up bugs, I think. As far as I know, 20560/33979 isn't
fixed. I had closed 20742/19906 already when pushing that commit.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20560; Package emacs. (Fri, 18 Sep 2020 11:12:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 20560 <at> debbugs.gnu.org
Subject: Re: bug#20560: bug#20742: 24.5; [PATCH] python.el: fix close paren
 indentation to match pep8
Date: Fri, 18 Sep 2020 13:11:28 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> You're mixing up bugs, I think. As far as I know, 20560/33979 isn't
> fixed. I had closed 20742/19906 already when pushing that commit.

OK; reopening.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 18 Sep 2020 11:12:02 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 271 days ago.

Previous Next


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