From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Al Go Newsgroups: gmane.emacs.bugs Subject: bug#49826: 26.1; Clicking on error in Inferior Python mode jumps to wrong line after source file edit Date: Mon, 2 Aug 2021 11:25:41 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d5b50005c890276f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31729"; mail-complaints-to="usenet@ciao.gmane.io" To: 49826@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 02 17:45:19 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAa7w-0007xx-Ti for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Aug 2021 17:45:17 +0200 Original-Received: from localhost ([::1]:38680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAa7u-0007AC-Qv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Aug 2021 11:45:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAa7k-00078A-2y for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 11:45:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAa7j-0001Gl-DH for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 11:45:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mAa7j-0004nN-Ck for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 11:45:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Al Go Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Aug 2021 15:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49826 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162791909118363 (code B ref -1); Mon, 02 Aug 2021 15:45:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Aug 2021 15:44:51 +0000 Original-Received: from localhost ([127.0.0.1]:38992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAa7W-0004m0-E5 for submit@debbugs.gnu.org; Mon, 02 Aug 2021 11:44:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAUCv-0001BA-0X for submit@debbugs.gnu.org; Mon, 02 Aug 2021 05:26:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAUCu-0000fa-Iw for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 05:26:00 -0400 Original-Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]:41656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAUCo-0000vQ-Ms for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 05:26:00 -0400 Original-Received: by mail-yb1-xb43.google.com with SMTP id z18so732847ybg.8 for ; Mon, 02 Aug 2021 02:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=qxOTm3PFq7dne9Neesq2G3Z3MLLo2YygBc6Xheexnnc=; b=m/b9jyqGfDpLylZim/W777m6gVjmy2zmCe8TPqYxo4SvuulHnB6WtddOejfuVqqZUp ZGMSvtgpePeHJafCEyCtS13Q5o4s5Eqx5LLFth+/DmEpkeKcwvrOQZhs7P9V1AWqgfc5 BFwp+gLDAMYSOQD9c7g/HO6GbMTZX7Aw8nyQ4vxjszOftGa5Jwv4kkCD9sx0jGkKWnSu dytBpQW2y/MRe6B3JNKdvvhD/tsdMUwDJXwuuQmEs78JUIlnjvpGxItSRcdmj3tH5wrd v0Dz3vG54YD6F2+wjsxIvdH2re17M+Z62uwbqR/Do7WUHNcTKzLkXtbp+KleMWJh2+Z8 dsPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=qxOTm3PFq7dne9Neesq2G3Z3MLLo2YygBc6Xheexnnc=; b=oU0UVppyr0vaycCyuJOa9h12eXZD2RZJsRQSQkFdI0mJ9+MDLX+1J1Z1TSF88Mmaol EtreX3RHwks5mSrl/vYepp82AwiBNxc9cr2Or3RG3+YKt1/c8qgc7eTxJIF75Be2t4pS igGoeJFTp7pcevCcYTgcw9LsmMJ4zb6gzmKj6Tmm0zGsMpwDkTHKKpv6I8pSb2m2CR22 K2fa9Kh+rg4AhG13o4cqJwKRsdppvl6eoH3vVkrRan0y9olJmB+5daTjcseiiAFcoaLU h0ZSBjK5RsIDD2Lu6M3GckusojCLp2mGe5Q1etsV8jCoZlvdmca8C6RbCPEMf0SdGdw3 y37A== X-Gm-Message-State: AOAM532P6AHCWqv3DHiG6X1wXgZA+amH/Jw0oWu5aZS4u2xE6Pbu/dJP 5cQxmDQiTdazTpuab5vAjcZHbsoxk8qyfugnh7YSB7hMCxC/pDVa X-Google-Smtp-Source: ABdhPJxFwfkWd7O/t4A32flwXspY4t4pXLQVFVR2xnnQsrD35Da3FwKlqoK+wHSPgNBJ4Qsx46rEhJbvpXODvE458zY= X-Received: by 2002:a25:b993:: with SMTP id r19mr19552806ybg.445.1627896352714; Mon, 02 Aug 2021 02:25:52 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::b43; envelope-from=al.go.robot.42@gmail.com; helo=mail-yb1-xb43.google.com X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 02 Aug 2021 11:44:48 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:211078 Archived-At: --000000000000d5b50005c890276f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Description: Editing the source file in Python mode before a line with an error results in the incorrect jump when clicking on the error line in inferior Python mode. Same when pressing RET on the error line. It seems that python-mode.el compensates for that edit twice (adding lines before the error sends me TOO FAR DOWN instead of up, by the amount of added lines). Reproducing with minimal example works 90% of the time, but not 100%. Tested with emacs -Q. Steps to reproduce: If I create a file t.py containing: #1 assert False #b #c Then visit it with emacs -Q (which starts Python mode) and start an inferior Python mode with C-c C-p then run the file with C-c C-c, the inferior mode buffer shows: "File "[...]/t.py", line 2, in Which is correct, and clicking on that line takes me to the "assert False" line in the Python mode buffer, which is correct. BUT, if I then edit the source file by adding or removing lines before the error, for example: #1 #2 assert False #b #c the inferior mode buffer now shows: "File "[...]/t.py", line 3, in Which is still correct, but clicking on it now sends me to line 4 (#b) instead of line 3. If I instead edit the file as such: #1 #2 #3 assert False #b #c the inferior mode buffer now shows: "File "[...]/t.py", line 4, in But clicking on it now sends me to line 6 (#c), and so on. (End description) In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2021-01-31, modified by Debian built on x86-csail-01 Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Can=E2=80=99t guess python-indent-offset, using defaults: 4 Shell native completion is enabled. Can=E2=80=99t guess python-indent-offset, using defaults: 4 Sent: #1... Making completion list... Configured using: 'configure --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:= /usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share= /emacs/site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:= /usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share= /emacs/site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2 -fdebug-prefix-map=3D/build/emacs-9Yet8u/emacs-26.1+1=3D. -fstack-protector-strong -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2' LDFLAGS=3D-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2 Important settings: value of $LANG: en_US.utf8 locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: diff-auto-refine-mode: t shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils compile cl-extra help-mode vc-git diff-mode easy-mmode python easymenu tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete parse-time format-spec advice auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map seq byte-opt gv bytecomp byte-compile cconv comint ring cl-loaddefs cl-lib ansi-color elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 233945 10187) (symbols 48 23449 2) (miscs 40 67 162) (strings 32 39308 2263) (string-bytes 1 1169100) (vectors 16 40258) (vector-slots 8 779773 12526) (floats 8 76 189) (intervals 56 309 1) (buffers 992 16)) --000000000000d5b50005c890276f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Description:

Editing the source file in Python mode= before a line with an error results in the incorrect jump when clicking on= the error line in inferior Python mode. Same when pressing RET on the erro= r line. It seems that python-mode.el compensates for that edit twice (addin= g lines before the error sends me TOO FAR DOWN instead of up, by the amount= of added lines). Reproducing with minimal example works 90% of the time, b= ut not 100%. Tested with emacs -Q.

Steps to reproduce:

If I = create a file t.py containing:

#1
assert False
#b
#c
Then visit it with emacs -Q (which starts Python mode) and start an inferi= or Python mode with C-c C-p then run the file with C-c C-c, the inferior mo= de buffer shows:

"File "[...]/t.py", line 2, in <m= odule>

Which is correct, and clicking on that line takes me to th= e "assert False" line in the Python mode buffer, which is correct= .

BUT, if I then edit the source file by adding or removing lines be= fore the error, for example:

#1
#2
assert False
#b
#c
the inferior mode buffer now shows:

"File "[...]/t.py= ", line 3, in <module>

Which is still correct, but clicki= ng on it now sends me to line 4 (#b) instead of line 3. If I instead edit t= he file as such:

#1
#2
#3
assert False
#b
#c

t= he inferior mode buffer now shows:

"File "[...]/t.py"= , line 4, in <module>

But clicking on it now sends me to line = 6 (#c), and so on.
(End description)


In GNU Emacs 26.1 (build= 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
=C2=A0of 2021-01-31, modif= ied by Debian built on x86-csail-01
Windowing system distributor 'Th= e X.Org Foundation', version 11.0.12004000
System Description: Debia= n GNU/Linux 10 (buster)

Recent messages:
For information about GN= U Emacs and the GNU system, type C-h C-a.
Can=E2=80=99t guess python-ind= ent-offset, using defaults: 4
Shell native completion is enabled.
Can= =E2=80=99t guess python-indent-offset, using defaults: 4
Sent: #1...
= Making completion list...

Configured using:
=C2=A0'configure = --build x86_64-linux-gnu --prefix=3D/usr
=C2=A0--sharedstatedir=3D/var/l= ib --libexecdir=3D/usr/lib
=C2=A0--localstatedir=3D/var/lib --infodir=3D= /usr/share/info
=C2=A0--mandir=3D/usr/share/man --enable-libsystemd --wi= th-pop=3Dyes
=C2=A0--enable-locallisppath=3D/etc/emacs:/usr/local/share/= emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1= /site-lisp:/usr/share/emacs/site-lisp
=C2=A0--with-sound=3Dalsa --withou= t-gconf --with-mailutils --build
=C2=A0x86_64-linux-gnu --prefix=3D/usr = --sharedstatedir=3D/var/lib
=C2=A0--libexecdir=3D/usr/lib --localstatedi= r=3D/var/lib
=C2=A0--infodir=3D/usr/share/info --mandir=3D/usr/share/man= --enable-libsystemd
=C2=A0--with-pop=3Dyes
=C2=A0--enable-locallispp= ath=3D/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/ema= cs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
= =C2=A0--with-sound=3Dalsa --without-gconf --with-mailutils --with-x=3Dyes=C2=A0--with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g= -O2
=C2=A0-fdebug-prefix-map=3D/build/emacs-9Yet8u/emacs-26.1+1=3D. -fs= tack-protector-strong
=C2=A0-Wformat -Werror=3Dformat-security -Wall'= ; 'CPPFLAGS=3D-Wdate-time
=C2=A0-D_FORTIFY_SOURCE=3D2' LDFLAGS= =3D-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG R= SVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LI= BXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THR= EADS LIBSYSTEMD LCMS2

Important settings:
=C2=A0 value of $LANG: = en_US.utf8
=C2=A0 locale-coding-system: utf-8-unix

Major mode: Py= thon

Minor modes in effect:
=C2=A0 diff-auto-refine-mode: t
= =C2=A0 shell-dirtrack-mode: t
=C2=A0 tooltip-mode: t
=C2=A0 global-el= doc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 electric-indent-mode: t
= =C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mo= de: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t=
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-= composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compre= ssion-mode: t
=C2=A0 line-number-mode: t
=C2=A0 transient-mark-mode: = t

Load-path shadows:
None found.

Features:
(shadow sort= mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml= -sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode= mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader = sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils compil= e cl-extra help-mode vc-git
diff-mode easy-mmode python easymenu tramp-s= h tramp tramp-compat
tramp-loaddefs trampver ucs-normalize shell pcomple= te parse-time
format-spec advice auth-source cl-seq eieio eieio-core cl-= macs
eieio-loaddefs password-cache json map seq byte-opt gv bytecomp
= byte-compile cconv comint ring cl-loaddefs cl-lib ansi-color elec-pair
t= ime-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
l= isp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dn= d fontset image regexp-opt fringe tabulated-list replace newcomment
text= -mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow = isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu= font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang mis= c-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp5= 1932 hebrew greek romanian slovak czech european
ethiopic indian cyrilli= c chinese composite charscript charprop
case-table epa-hook jka-cmpr-hoo= k help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs bu= tton faces cus-face macroexp files
text-properties overlay sha1 md5 base= 64 format env code-pages mule
custom widget hashtable-print-readable bac= kquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-r= ender-setting move-toolbar gtk
x-toolkit x multi-tty make-network-proces= s emacs)

Memory information:
((conses 16 233945 10187)
=C2=A0(= symbols 48 23449 2)
=C2=A0(miscs 40 67 162)
=C2=A0(strings 32 39308 2= 263)
=C2=A0(string-bytes 1 1169100)
=C2=A0(vectors 16 40258)
=C2= =A0(vector-slots 8 779773 12526)
=C2=A0(floats 8 76 189)
=C2=A0(inter= vals 56 309 1)
=C2=A0(buffers 992 16))
--000000000000d5b50005c890276f--