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.devel Subject: Re: Additional cleanup around xterm-mouse Date: Sat, 21 Nov 2020 11:31:04 +0200 Message-ID: <838savys2v.fsf@gnu.org> References: <83o8jupnqd.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5837"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jared Finder Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 21 10:32:26 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kgPFq-0001PA-8e for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Nov 2020 10:32:26 +0100 Original-Received: from localhost ([::1]:41432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgPFp-0008V0-Am for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Nov 2020 04:32:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgPEl-0007eb-5Y for emacs-devel@gnu.org; Sat, 21 Nov 2020 04:31:19 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55603) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgPEk-0007qP-CP; Sat, 21 Nov 2020 04:31:18 -0500 Original-Received: from [176.228.60.248] (port=2055 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kgPEj-00069s-8J; Sat, 21 Nov 2020 04:31:18 -0500 In-Reply-To: (message from Jared Finder on Thu, 19 Nov 2020 00:03:30 -0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:259520 Archived-At: > Date: Thu, 19 Nov 2020 00:03:30 -0800 > From: Jared Finder > Cc: emacs-devel@gnu.org > > > I don't think I follow. All the places where you need changes are > > related to handling mouse events, so why cannot it be specific to > > xt-mouse? > > There is a bug in widget-key-sequence-read-event's usage of keyboard > events specifically. > > The function widget-key-sequence-read-event currently does not correctly > translate function keys for the terminal. It has code that attempts to > apply function-key-map, but does not apply input-decode-map, so it can > not read function keys. (Additionally, it should be using > local-function-key-map now.) OK, but that means widget-key-sequence-read-event has a bug that needs to be fixed regardless. So I'm still asking why can't we do something like (if xterm-mouse-mode (read-key) (read-event)) in all the affected places that currently call read-event? > Changing to read-key fixes this as read-key goes through > read-key-sequence which applies input-decode-map. However, to get the > same intended functionality requires some new parameters, which I also > add in my patch. The problem is that we get lots of unintended functionalities even with the new parameters. read-key-sequence consults many internal variables that read-event doesn't. So I'm still wary of making such a significant change, even though we are talking about a small number of relatively minor feature (with the sole exception of Ediff, perhaps). If the above less-elegant change which will only affect usage under xterm-mouse-mode is feasible, I'd prefer to go that way instead. > (let ((ev2 (and (memq 'down (event-modifiers ev)) > - (read-event))) > - (tr (and (keymapp function-key-map) > - (lookup-key function-key-map (vector ev))))) > + (read-key))) > + ;; This is actually a separate bug-fix. `function-key-map' > + ;; does not contain any term-specific function key mappings > + ;; like f13 --> S-f1. > + (tr (and (keymapp local-function-key-map) > + (lookup-key local-function-key-map (vector ev))))) Let's fix this part separately.