From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#49253: 27.2; Emacs non-responsive when pasting into terminal-mode Date: Sat, 09 Dec 2023 13:38:50 -0800 Message-ID: <11108ebcb87fae9390410fa4f3355967@finder.org> References: <87r12lqmco.fsf@gnus.org> <838r63y6kj.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16457"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, Matt Bisson , 49253@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 09 22:40:04 2023 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 1rC53L-00043P-Sg for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Dec 2023 22:40:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rC537-0003cs-UK; Sat, 09 Dec 2023 16:39:49 -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 1rC536-0003cS-BI for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 16:39:48 -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 1rC536-0008Jy-2x for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 16:39:48 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rC53J-0007ez-R1 for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 16:40:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jared Finder Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Dec 2023 21:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49253 X-GNU-PR-Package: emacs Original-Received: via spool by 49253-submit@debbugs.gnu.org id=B49253.170215795129366 (code B ref 49253); Sat, 09 Dec 2023 21:40:01 +0000 Original-Received: (at 49253) by debbugs.gnu.org; 9 Dec 2023 21:39:11 +0000 Original-Received: from localhost ([127.0.0.1]:49113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC52U-0007da-GK for submit@debbugs.gnu.org; Sat, 09 Dec 2023 16:39:10 -0500 Original-Received: from greenhill.hpalace.com ([192.155.80.58]:37070) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC52P-0007dP-RQ for 49253@debbugs.gnu.org; Sat, 09 Dec 2023 16:39:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1702157930; bh=wDzlQC6JZbYx3Z8VVqxYskX/I8lgktMSj3QZGeFltlQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lZyEcGKvsd96IYsf3IM2W9yRTpyvx7mpp2sjNrunGWry2B4q0RJL3feSMPMmCrdLP 9QzscC1BbhBaTkXIfGKn4bvBOYGXpcedCCWdF0pX2TPXnH6S05BHup/JWCOud0DhHe NREF07SuKU/W8KLQSh5NdRWiGC+50YHKvciOAddI+Dom+NhGYW73t/dPfxbOpUu7/t qC+xMmagacj1fSZBNUdoutaricqEPratkAS2F5c7Rq+qOUE2Eq6f3GMsD/2BFjrimO xTYe7DRarZ5SEmRNSL8HLWHIclwdY10h6wPDiOoe6yj6qIoBzZpBXCV4ZcC9wj8NYs xCUklpsmzlwCg== Original-Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id C67BC48C6; Sat, 9 Dec 2023 21:38:50 +0000 (UTC) In-Reply-To: <838r63y6kj.fsf@gnu.org> X-Sender: jared@finder.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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275883 Archived-At: On 2023-12-09 03:10, Eli Zaretskii wrote: > Jared, can I ask you to look into this and share your thoughts and > comments to the proposed change? TIA. > >> Cc: 49253@debbugs.gnu.org >> From: Matt Bisson >> Date: Fri, 8 Dec 2023 15:35:36 -0500 >> >> Right, so this silly little fix works, but it's an obvious hack. I >> clearly don't know enough about how the key-bindings work, because I >> would have expected those set by term-mode to override those in the >> global keybindings (from xterm.el), but they don't. The xterm.el one >> runs first. Here's the diff: >> >> diff --git a/lisp/term.el b/lisp/term.el >> index 81746e0c20d..e047fa767e8 100644 >> --- a/lisp/term.el >> +++ b/lisp/term.el >> @@ -956,6 +956,7 @@ term-raw-map >> (define-key map [?\C- ] #'term-send-C-@) >> (define-key map [?\C-\M-/] #'term-send-C-M-_) >> (define-key map [?\C-\M- ] #'term-send-C-M-@) >> + (define-key map "\e[200~" #'term--xterm-paste) >> >> (when term-bind-function-keys >> (dotimes (key 21) Thanks for the investigation. I don't think this is the right approach. The xterm escape codes all go through input-decode-map and I would expect to preserve that. Looking at code, the current behavior in xterm.el is the following: Step 1: \e[200~ is put on input-decode-map, using xterm-translate-backeted-paste to decode. Step 2: The function xterm-translate-bracketed-paste reads the pasted text and creates an event (xterm-paste "PASTED TEXT HERE") Step 3: Globally, the event xterm-paste is bound to the function also named xterm-paste, which grabs the pasted text and puts it on the kill ring, then runs the function insert-for-yank. Step 3a: In Term mode, the event xterm-paste is instead bound to the function term--xterm-paste. However, instead of reading the pasted text off the event, it calls (xterm-pasted-text) again. I think the correct fix is to change term--xterm-paste to read the pasted text off of the event generated in Step 2. So something like the following (a real fix would add error checking like in xterm-paste): (defun term--xterm-paste (event) "Insert the text pasted in an XTerm bracketed paste operation." (interactive "e") (term-send-raw-string (nth 1 event))) Matt, can you try this change locally? It worked for me. -- MJF