From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68559: [PATCH] Improve Python shell completion Date: Fri, 16 Feb 2024 17:52:04 +0200 Message-ID: <86jzn4v23f.fsf@gnu.org> References: <6BAFD8BF-8F18-4D9F-9DB3-A185AEF2EBCA@gmail.com> <8B4172D0-FC31-4437-99C4-683C892C5F86@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22110"; mail-complaints-to="usenet@ciao.gmane.io" Cc: liuhui1610@gmail.com, mattias.engdegard@gmail.com, 68559@debbugs.gnu.org To: kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 16 16:55:05 2024 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 1rb0YK-0005S1-IS for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Feb 2024 16:55:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb0Y2-0004V0-ON; Fri, 16 Feb 2024 10:54:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb0Xz-0004Ui-Nu for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:54:43 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb0Xz-0003ET-Co for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:54:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rb0YI-0008AN-CH for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Feb 2024 15:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68559-submit@debbugs.gnu.org id=B68559.170809888531355 (code B ref 68559); Fri, 16 Feb 2024 15:55:02 +0000 Original-Received: (at 68559) by debbugs.gnu.org; 16 Feb 2024 15:54:45 +0000 Original-Received: from localhost ([127.0.0.1]:60000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rb0Y0-00089e-RW for submit@debbugs.gnu.org; Fri, 16 Feb 2024 10:54:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49964) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rb0Xz-00089P-37 for 68559@debbugs.gnu.org; Fri, 16 Feb 2024 10:54:44 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb0VT-000325-8E; Fri, 16 Feb 2024 10:52:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=HyoO6stO5ibi0R6BwJ6WGkAPKJoJZ9JwNe74v9tEq+c=; b=Ov+tk6Pk7ek5 hnNe8nS2m4j0wibzpqmmd09wzyI9lVMDlg3FmDzorNdzmnnwnDZa0iO0Z/ZrkqSujTg0FkIsiaum9 2nbarM9jNZlrdbYy4JX+3zoyDDw1h87OJVOczNAgKA5p/bfhe1/a9/WPEwFU0Pxfcw4TCHl8dNHDR bMNRtR7KuFJFe/nVceJyFZHnxrQg02ILmoJIBTx/en5WRrrn94IdjD7fo/06aITLafWrBjpvblsVj dtm+IU4PUgV0obkBhTyWM7dFddYngx3Qdsh4PAnN2Io3RSpTw8GxyVAO4BlaKcJhzRZMxmB6f32Aa ErKTbOyC8r6BUaNgxFK0HQ==; In-Reply-To: (message from kobarity on Sat, 17 Feb 2024 00:24:29 +0900) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280104 Archived-At: > Date: Sat, 17 Feb 2024 00:24:29 +0900 > From: kobarity > Cc: Liu Hui , > Eli Zaretskii , > 68559@debbugs.gnu.org > > Right, that bug needs to be fixed as well, but the echo problem existed prior to the change that broke the tests. > > > > An alternative might be to disable the tty echo altogether. If I do it right after process creation then it has no effect; presumably Python or its readline module turns on echo just a bit later on. Anyway, running > > > > import tty > > tty.setraw(0) > > > > in the python shell seems to put it right, with working completion and the annoying echo gone. > > > > > So one workaround would be to remove the echoed back string before > > > parsing as JSON. > > > > Yes, either that or turning off echo in the tty. > > I made prototype patches for each method. I don't use Mac so it would > be helpful if you could try these. > > 0001-Remove-echoed-back-string-in-python-shell-completion.patch > extracts only the last line to exclude echoed back strings. > > 0001-Set-tty-mode-to-raw-when-setting-up-Inferior-Python.patch sets > the Inferior Python tty to raw mode. python-ffap-module-path-1 will > no longer need to be skipped on Mac. If it is safe to set tty to raw > mode on all UNIX based systems, I prefer this method. Will this work on MS-Windows as well? If you are unsure, would you please tell me how to test whether this works on Windows, so I could collect the information for you? Thanks.