bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56742: 29.0.50; Python indendation problem after comment


From: Stephen Berman
Subject: bug#56742: 29.0.50; Python indendation problem after comment
Date: Sun, 24 Jul 2022 17:42:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

0. emacs -Q
1. C-x b test RET
2. Insert the following into buffer "test":

def test(n):
    if n < 0:
        return -1
    # test
    else:
        return 0

2. M-x python-mode RET (with buffer "test" current)
3. Put point on the line containing "else:" and type TAB
=> "else:" is dedented to column 0 and remains there on typing TAB
again (and again).

If the line containing "# test" is deleted and point put back on the
line containing "else:", then typing TAB indents "else:" to column 4
(where it was before being wrongly dedented) and remains there on typing
TAB again (as it should).

The same behavior happens with "elif" lines preceded by a comment line.

The attached patch prevents the wrong dedenting, but I'm not familiar
enough with the python.el code to be confident it's the correct fix.


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo 
version 1.17.6)
 of 2022-07-22 built on strobelfs2
Repository revision: 8434396fa362c6644ff23e1f48acace7b85ffe8f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Linux From Scratch r11.0-165

Configured using:
 'configure --with-xinput2 --with-xwidgets 'CFLAGS=-Og -g3'
 PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix


Attachment: txtlub9OxJ9Dv.txt
Description: python.el patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]