Subject: 29.3; indentation issue for Python mode
From: Fabrice Salvaire <[email-masked]>
To: [email-masked]
Date: Fri, 31 May 2024 16:52:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

I observed many times indentation issues for modern Python 3.

For examples:
```
class Foo:
def __init__(self, ...):
self.foo = ... # TAB won't indent to pos+4
```

A workaround is sometimes to close and reopen the file.
Thus I suspect a wrong state.
But I don't found any explanation.

I am using Python mode with treesitter enabled but I think it is not yet 
used for indentation ???

---
In GNU Emacs 29.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 
3.24.41, cairo version 1.18.0) of
2024-03-25 built on 8d1efaa99cf549ff83f11657c3f4678a
Windowing system distributor 'The X.Org Foundation', version 11.0.12302006
System Description: Fedora Linux 39 (Workstation Edition)

Configured using:
'configure --build=x86_64-redhat-linux-gnu 
--host=x86_64-redhat-linux-gnu --program-prefix=
--disable-dependency-tracking --prefix=/usr --exec-prefix=/usr 
--bindir=/usr/bin
--sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share 
--includedir=/usr/include
--libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var 
--runstatedir=/run
--sharedstatedir=/var/lib --mandir=/usr/share/man 
--infodir=/usr/share/info --with-dbus --with-gif
--with-jpeg --with-png --with-rsvg --with-tiff --with-xpm 
--with-x-toolkit=gtk3 --with-gpm=no
--with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json
--with-native-compilation=aot --with-tree-sitter --with-sqlite3 
--with-webp --with-xinput2
build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu 
CC=gcc
'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions 
-g -grecord-gcc-switches
-pipe -Wall -Werror=format-security 
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 
-fstack-protector-strong
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic 
-fasynchronous-unwind-tables
-fstack-clash-protection -fcf-protection -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer '
LDFLAGS=-Wl,-z,relro 
PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig CXX=g++
'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g 
-grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 
-Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic 
-fasynchronous-unwind-tables
-fstack-clash-protection -fcf-protection -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer ''

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

Important settings:
value of $LC_ALL: fr_FR.utf8
value of $LANG: fr_FR.utf8
locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
global-flycheck-eglot-mode: t
flycheck-eglot-mode: t
eglot--managed-mode: t
treemacs-icons-dired-mode: t
treemacs-filewatch-mode: t
treemacs-follow-mode: t
treemacs-hide-gitignored-files-mode: t
treemacs-git-mode: t
treemacs-fringe-indicator-mode: always
shell-dirtrack-mode: t
flycheck-color-mode-line-mode: t
whitespace-mode: t
highlight-indent-guides-mode: t
doom-modeline-mode: t
server-mode: t
global-git-gutter-mode: t
git-gutter-mode: t
flycheck-pos-tip-mode: t
yas-global-mode: t
yas-minor-mode: t
global-corfu-mode: t
corfu-mode: t
global-treesit-auto-mode: t
global-flycheck-mode: t
flycheck-mode: t
flyspell-lazy-mode: t
undo-fu-session-global-mode: t
undo-fu-session-mode: t
which-key-mode: t
ivy-mode: t
recentf-mode: t
override-global-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t

Load-path shadows:
/home/.../.config/emacs/checkout/highlight-indent-guides/highlight-indent-guides 
hides 
/home/.../.config/emacs/elpa/highlight-indent-guides-20200820.2328/highlight-indent-guides
/home/.../.config/emacs/emacs.d/tree-sitter hides 
/home/.../.config/emacs/elpa/tree-sitter-20220212.1632/tree-sitter
/home/.../.config/emacs/elpa/auctex-14.0.4/tex-site hides 
/usr/share/emacs/site-lisp/tex-site
/home/.../.config/emacs/elpa/cmake-mode-20240412.1329/cmake-mode hides 
/usr/share/emacs/site-lisp/cmake/cmake-mode
/home/.../.config/emacs/elpa/auctex-14.0.4/auctex hides 
/usr/share/emacs/site-lisp/site-start.d/auctex
/home/.../.config/emacs/elpa/transient-20240415.1548/transient hides 
/usr/share/emacs/29.3/lisp/transient
/home/.../.config/emacs/elpa/jsonrpc-1.0.25/jsonrpc hides 
/usr/share/emacs/29.3/lisp/jsonrpc
/home/.../.config/emacs/emacs.d/frame hides 
/usr/share/emacs/29.3/lisp/frame
/home/.../.config/emacs/emacs.d/completion hides 
/usr/share/emacs/29.3/lisp/completion
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package hides 
/usr/share/emacs/29.3/lisp/use-package/use-package
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-ensure 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-ensure
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-lint 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-lint
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-delight 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-delight
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-diminish 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-diminish
/home/.../.config/emacs/elpa/bind-key-20230203.2004/bind-key hides 
/usr/share/emacs/29.3/lisp/use-package/bind-key
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-bind-key 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-bind-key
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-core 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-core
/home/.../.config/emacs/elpa/use-package-20230426.2324/use-package-jump 
hides /usr/share/emacs/29.3/lisp/use-package/use-package-jump
/home/.../.config/emacs/elpa/csharp-mode-20221126.2005/csharp-mode hides 
/usr/share/emacs/29.3/lisp/progmodes/csharp-mode
/home/.../.config/emacs/elpa/eglot-1.17/eglot hides 
/usr/share/emacs/29.3/lisp/progmodes/eglot
/home/.../.config/emacs/elpa/eldoc-1.15.0/eldoc hides 
/usr/share/emacs/29.3/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec epa epg 
rfc6068 epg-config mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader 
sendmail rfc2047 rfc2045
ietf-drums view treemacs-bookmarks treemacs-tags bookmark shortdoc 
smerge-mode help-fns radix-tree
smex ido mule-util dabbrev yank-media markdown-mode edit-indirect 
noutline outline jka-compr vc-git
vc-dispatcher flycheck-eglot eglot external-completion jsonrpc 
flymake-proc flymake diff ert pp ewoc
debug backtrace dired-aux diredfl treemacs-icons-dired treemacs 
treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface 
treemacs-persistence treemacs-filewatch-mode
filenotify treemacs-follow-mode treemacs-rendering treemacs-annotations 
treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals 
treemacs-fringe-indicator treemacs-faces
treemacs-icons treemacs-scope treemacs-themes treemacs-core-utils 
pfuture inline hl-line ht
treemacs-logging treemacs-customization treemacs-macros ffap tramp 
tramp-loaddefs trampver
tramp-integration tramp-compat shell pcomplete parse-time iso8601 
counsel dired-x dired
dired-loaddefs compile swiper pulse flycheck-color-mode-line face-remap 
whitespace
highlight-indent-guides doom-modeline doom-modeline-segments 
doom-modeline-env doom-modeline-core
shrink-path f s dash nerd-icons nerd-icons-faces nerd-icons-data 
nerd-icons-data-mdicon
nerd-icons-data-flicon nerd-icons-data-codicon nerd-icons-data-devicon 
nerd-icons-data-sucicon
nerd-icons-data-wicon nerd-icons-data-faicon nerd-icons-data-powerline 
nerd-icons-data-octicon
nerd-icons-data-pomicon nerd-icons-data-ipsicon server two-column 
git-gutter flycheck-pos-tip
pos-tip astro-ts-mode css-mode smie eww xdg url-queue shr pixel-fill 
kinsoku url-file svg puny
mm-url gnus nnheader gnus-util text-property-search time-date mail-utils 
range mm-util mail-prsvr
typescript-ts-mode rjsx-mode js2-mode etags fileloop js c-ts-common 
cc-mode cc-fonts cc-guess
cc-menus cc-cmds imenu finder-inf pyvenv eshell esh-cmd esh-ext esh-opt 
esh-proc esh-io esh-arg
esh-module esh-groups esh-util cc-styles cc-align cc-engine cc-vars 
cc-defs qmake-mode yasnippet
corfu combobulate combobulate-json combobulate-yaml combobulate-css 
combobulate-js-ts
combobulate-python combobulate-html combobulate-query derived savehist 
xref files-x scheme
combobulate-ui transient format-spec combobulate-display 
combobulate-ztree combobulate-contrib
combobulate-envelope combobulate-manipulation python project compat 
comint ansi-osc
combobulate-navigation combobulate-misc combobulate-interface generator 
combobulate-rules
combobulate-settings diff-mode tempo treesit-auto treesit 
flycheck-languagetool flycheck ansi-color
find-func edmacro kmacro flyspell-lazy flyspell ispell undo-fu 
undo-fu-session column-marker
multiple-cursors mc-separate-operations rectangular-region-mode 
mc-mark-pop mc-edit-lines
mc-hide-unmatched-lines-mode mc-mark-more sgml-mode facemenu dom 
thingatpt mc-cycle-cursors
multiple-cursors-core advice comp comp-cstr warnings icons rect 
which-key ivy delsel ring ivy-faces
ivy-overlay colir color recentf tree-widget wid-edit all-the-icons 
all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons 
data-alltheicons fabrice-dark-theme
cl-extra help-mode use-package use-package-ensure use-package-delight 
use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core preview-latex 
clang-rename
clang-include-fixer let-alist clang-format xml auctex 
astro-ts-mode-autoloads async-autoloads
auto-complete-autoloads cmake-mode-autoloads auctex-autoloads tex-site 
company-box-autoloads
company-autoloads corfu-autoloads counsel-autoloads csv-mode-autoloads 
dap-mode-autoloads
diredfl-autoloads dockerfile-mode-autoloads doom-modeline-autoloads 
anaphora-autoloads
exec-path-from-shell-autoloads flycheck-eglot-autoloads eglot-autoloads 
flycheck-autoloads
gcmh-autoloads ghub-autoloads git-gutter-autoloads 
graphql-mode-autoloads haskell-mode-autoloads
helpful-autoloads elisp-refs-autoloads impatient-showdown-autoloads 
impatient-mode-autoloads
htmlize-autoloads json-mode-autoloads jsonrpc-autoloads 
live-py-mode-autoloads lsp-docker-autoloads
lsp-latex-autoloads consult-autoloads lsp-treemacs-autoloads 
lsp-ui-autoloads lsp-mode-autoloads
eldoc-autoloads multiple-cursors-autoloads nerd-icons-autoloads 
nginx-mode-autoloads
numpydoc-autoloads php-mode-autoloads poly-markdown-autoloads 
markdown-mode-autoloads
pos-tip-autoloads protobuf-mode-autoloads pyimport-autoloads 
python-docstring-autoloads
python-insert-docstring-autoloads f-autoloads smartparens-autoloads 
sphinx-doc-autoloads
swift-mode-autoloads swiper-autoloads ivy-autoloads rx tempel-autoloads 
tree-sitter-langs-autoloads
treemacs-all-the-icons-autoloads treemacs-evil-autoloads evil-autoloads 
goto-chg-autoloads
treemacs-icons-dired-autoloads treemacs-magit-autoloads magit-autoloads 
pcase
magit-section-autoloads git-commit-autoloads transient-autoloads 
treemacs-persp-autoloads
treemacs-projectile-autoloads projectile-autoloads 
treemacs-tab-bar-autoloads treemacs-autoloads
posframe-autoloads dash-autoloads treesit-auto-autoloads 
typescript-mode-autoloads undo-fu-autoloads
undo-fu-session-autoloads edit-indirect-autoloads mmm-mode-autoloads 
web-mode-autoloads
which-key-autoloads with-editor-autoloads info compat-autoloads 
ws-butler-autoloads
xterm-color-autoloads yaml-mode-autoloads yasnippet-autoloads 
zettelkasten-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history 
url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse 
auth-source cl-seq eieio
eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp 
byte-compile url-vars
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric 
uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd 
tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode 
prog-mode register page
tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar 
mouse jit-lock font-lock
syntax font-core term/tty-colors frame minibuffer nadvice seq simple 
cl-generic indonesian
philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai 
tai-viet lao korean japanese
eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic 
indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook 
jka-cmpr-hook help abbrev obarray
oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face 
macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule 
custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind 
inotify dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit 
xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1147620 125902)
(symbols 48 41533 3)
(strings 32 191964 10621)
(string-bytes 1 6293942)
(vectors 16 80207)
(vector-slots 8 2129282 168825)
(floats 8 1126 738)
(intervals 56 51981 11176)
(buffers 984 34))