From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53219: 27.2; shell-mode output is stolen by python-eldoc Date: Thu, 13 Jan 2022 18:26:23 +0100 Message-ID: <87a6fzmts0.fsf@miha-pc> References: <87iluo9n9q.fsf@gnus.org> Reply-To: miha@kamnitnik.top Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32272"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53219@debbugs.gnu.org To: Lars Ingebrigtsen , awrhygty@outlook.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 13 18:34:07 2022 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 1n83zC-0008FO-3Z for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jan 2022 18:34:06 +0100 Original-Received: from localhost ([::1]:60062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n83zB-0004xJ-5R for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jan 2022 12:34:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n83mZ-0005Vn-GH for bug-gnu-emacs@gnu.org; Thu, 13 Jan 2022 12:21:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n83mY-0000XQ-4P for bug-gnu-emacs@gnu.org; Thu, 13 Jan 2022 12:21:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n83mY-0002DE-1q for bug-gnu-emacs@gnu.org; Thu, 13 Jan 2022 12:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: miha@kamnitnik.top Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jan 2022 17:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53219 X-GNU-PR-Package: emacs Original-Received: via spool by 53219-submit@debbugs.gnu.org id=B53219.16420944208417 (code B ref 53219); Thu, 13 Jan 2022 17:21:01 +0000 Original-Received: (at 53219) by debbugs.gnu.org; 13 Jan 2022 17:20:20 +0000 Original-Received: from localhost ([127.0.0.1]:34419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n83ls-0002Bh-G6 for submit@debbugs.gnu.org; Thu, 13 Jan 2022 12:20:20 -0500 Original-Received: from kamnitnik.top ([209.250.245.214]:34990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n83lq-0002BY-6N for 53219@debbugs.gnu.org; Thu, 13 Jan 2022 12:20:19 -0500 Original-Received: from localhost (BSN-77-156-43.static.siol.net [193.77.156.43]) by kamnitnik.top (Postfix) with ESMTPSA id E7AE39C71A; Thu, 13 Jan 2022 17:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1642094417; bh=JedR2GjFHbP0QDYGu6Pkrcqh71Ret1BNR+UnL+tqMRw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ID5c+WWLveZTFZNBgpKmydq5hJ+ojV1C7YrIcBZ2lwzIeEOjUnxIODcZwvQHEWEg8 Ggrj1aMXIJ/5xGuc+ys5xVGpV73fn2FAHd3GEnskLHXJmq/rMbwq2MkaelkQPyp1lJ wxYP/tF2HhrEsTWOrEJ5I9AQSmHGjoP+kJyRSycWUTkyT9IwtEN6fpmx0nwNnxdjnP G53HiAVPB20WHCD/iNXMTlnoVdz/yXdE8MVJwHcwBZ2UynfCLWw20HI9Hv5rnyMc5l 3JaJPxjWs2g4JY/iQUTJ/w6/VgKHfbtzMOYW7ulokDiOhJck9sUgd6fElecBKV8Buf 6XHRwk1mdPGAA== In-Reply-To: <87iluo9n9q.fsf@gnus.org> 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:224125 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > awrhygty@outlook.com writes: > >> Evaluate the form below and type 'C-p' or 'C-n' repeatedly to display >> python eldoc messages. >> After 20-30 key input, an error occurs. >> Then look at the *shell* buffer, some numbers in output lines are >> absent. >> If setting debug-on-error to 't, *Backtrace* buffer popups, > > That sounds familiar -- I think I recall something like this being fixed > in eldoc... > > Yes, I can reproduce this problem in Emacs 27.2, but not in Emacs 29. > So I guess this has been fixed by now, and I'm closing this bug report. Not quite yet. I found a more reliable reproducer for Emacs 29, which could reproduce the bug on my machine with emacs -q. (progn (setq debug-on-error t) (shell) (insert " i=0; while sleep 0.05; do i=$((i + 1)); echo $i; done") (comint-send-input) (run-python) (switch-to-buffer (generate-new-buffer "tmp")) (insert "len\nstr") (python-mode)) If it doesn't work bug immediately, try lowering the "0.05" number. Please consider applying the following patch to fix this. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-python-eldoc-affecting-unrelated-comint-processe.patch Content-Transfer-Encoding: quoted-printable From=2045c345f0b170c3ffc41f186b3c2b70dbccaa23fd Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Thu, 13 Jan 2022 18:20:13 +0100 Subject: [PATCH] Fix python-eldoc affecting unrelated comint processes * lisp/progmodes/python.el (python-shell-send-string-no-output): Don't let-bind comint-preoutput-filter-functions globally for all comint processes. Modify the behaviour of only the current python process (bug#53219). =2D-- lisp/progmodes/python.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index edd3139a7a..5889f2ab67 100644 =2D-- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3216,11 +3216,13 @@ python-shell-output-filter (defun python-shell-send-string-no-output (string &optional process) "Send STRING to PROCESS and inhibit output. Return the output." =2D (let ((process (or process (python-shell-get-process-or-error))) =2D (comint-preoutput-filter-functions =2D '(python-shell-output-filter)) =2D (python-shell-output-filter-in-progress t) =2D (inhibit-quit t)) + (or process (setq process (python-shell-get-process-or-error))) + (cl-letf (((process-filter process) + (lambda (_proc str) + (with-current-buffer (process-buffer process) + (python-shell-output-filter str)))) + (python-shell-output-filter-in-progress t) + (inhibit-quit t)) (or (with-local-quit (python-shell-send-string string process) =2D-=20 2.34.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmHgYL8THG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP9TeEACw8Bfx8JgnaoY/VBFXtW4UdogWYGT0 cgIoohLX2r2AmDmczFJTvCgxxpz6jSECR8ApiBfZ8Hbwe1ogEp7D2c529+/AHUB0 IRxJ2cCyFruXGaEwoEmQ9scC2jVml8gfu+z9pJjvH0N8+ZaCdt832YJusCoopCRU YcgDQZTwJZ735WfjTJomK5MQPXZekRJUtmayj6K8c37vcrK1af8el27TITilwQ2i Jt8Juo3A9DlonPcxS/AKgsre9CFCZ3aUVEHikseuqM3025eSunEFEnzAsF/SnPFV b8IbtJgnt2rn8PCY4KHSPmuwc0Pl3HwUZMQDDouSlVaLFT3si3WnlE6WveTcofUD KNrb9qMUzA79qGoM2OUGhLMuatvGS25Fa6sy3IbkzuUpC7ym3JFGHqJjUjk9tV7N P7r7a+Bj4wg+D6/UCkJbyLm3SfsVZlPYATgUFUM2DDm94xA9XqRBiyOKYM+BWQap LI+gB5y0J2iEAenK8xP9mH0ud9JjRU7HU65p5MyQFrNnf8aRgCjC9dr8t7zfpvtL aQcCRfsTDfSuKuJfB+fthwSig4fJ+b/GlyJSpzPHDMjnI1EDeeyaETRlzKryaFHp xbsj/B4Feiyh0Yg2KTM+xhCdfl10YF/5Vz3zriMJaIxVIjjc3+OOR8m2Ex+pL8ob jhhkNxJeA3OoHw== =fzkL -----END PGP SIGNATURE----- --==-=-=--