unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20560: 24.5; I am not happy with the new Python mode indentation behaviour
@ 2015-05-12 10:13 Fabrice Salvaire
  2015-05-12 16:06 ` Glenn Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Salvaire @ 2015-05-12 10:13 UTC (permalink / raw)
  To: 20560

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






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

* bug#20560: 24.5; I am not happy with the new Python mode indentation behaviour
  2015-05-12 10:13 bug#20560: 24.5; I am not happy with the new Python mode indentation behaviour Fabrice Salvaire
@ 2015-05-12 16:06 ` Glenn Morris
  2019-04-20 20:58   ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2015-05-12 16:06 UTC (permalink / raw)
  To: Fabrice Salvaire; +Cc: 20560

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.





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

* bug#20560: 24.5; I am not happy with the new Python mode indentation behaviour
  2015-05-12 16:06 ` Glenn Morris
@ 2019-04-20 20:58   ` Noam Postavsky
  0 siblings, 0 replies; 3+ messages in thread
From: Noam Postavsky @ 2019-04-20 20:58 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Fabrice Salvaire, 20560

# patch for 20742 doesn't help for 20560
unmerge 20560
forcemerge 33979 20560
quit

Glenn Morris <rgm@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).





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

end of thread, other threads:[~2019-04-20 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 10:13 bug#20560: 24.5; I am not happy with the new Python mode indentation behaviour Fabrice Salvaire
2015-05-12 16:06 ` Glenn Morris
2019-04-20 20:58   ` Noam Postavsky

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).