From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#29104: [PATCH]: xterm-mouse-mode clicks in the modeline dont use the keymap properties of the modeline strings Date: Sat, 11 Nov 2017 11:44:25 +0200 Message-ID: <83375lp2ti.fsf@gnu.org> References: <87zi869koz.fsf@t-online.de> <877ev3nf5b.fsf@t-online.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1510393512 17269 195.159.176.226 (11 Nov 2017 09:45:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Nov 2017 09:45:12 +0000 (UTC) Cc: 29104@debbugs.gnu.org To: Olaf Rogalsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 11 10:45:06 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDSLZ-00048m-1u for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Nov 2017 10:45:05 +0100 Original-Received: from localhost ([::1]:44973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDSLf-000321-N8 for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Nov 2017 04:45:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDSLZ-00031c-T9 for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2017 04:45:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDSLW-0004ri-Pg for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2017 04:45:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54282) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eDSLW-0004ra-Lj for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2017 04:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eDSLW-0007aO-CX for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2017 04:45: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: Sat, 11 Nov 2017 09:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29104 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 29104-submit@debbugs.gnu.org id=B29104.151039347729104 (code B ref 29104); Sat, 11 Nov 2017 09:45:02 +0000 Original-Received: (at 29104) by debbugs.gnu.org; 11 Nov 2017 09:44:37 +0000 Original-Received: from localhost ([127.0.0.1]:34730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDSL7-0007ZL-FQ for submit@debbugs.gnu.org; Sat, 11 Nov 2017 04:44:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37299) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDSL5-0007Z5-PB for 29104@debbugs.gnu.org; Sat, 11 Nov 2017 04:44:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDSKx-0004j9-C2 for 29104@debbugs.gnu.org; Sat, 11 Nov 2017 04:44:30 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDSKx-0004j5-8U; Sat, 11 Nov 2017 04:44:27 -0500 Original-Received: from [176.228.60.248] (port=1860 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eDSKw-0000jg-0u; Sat, 11 Nov 2017 04:44:26 -0500 In-reply-to: <877ev3nf5b.fsf@t-online.de> (message from Olaf Rogalsky on Tue, 07 Nov 2017 00:47:28 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139750 Archived-At: > From: Olaf Rogalsky > Date: Tue, 07 Nov 2017 00:47:28 +0100 > > My patch takes place after a key translation has been performed. It > checks, that the key translation is not empty, (or more precisely, that > the current event sequence is not empty), > > first_event = mock_input > 0 ? keybuf[0] : Qnil; > ^^^^^^^^^^^^^^ > > and if so, sets the variable first_event to the first event in the > sequence. > > first_event = mock_input > 0 ? keybuf[0] : Qnil; > ^^^^^^^^^ > > Here, all key translations where allready replaced by their > corresponding binding. If the current event sequence is empty, > first_event is set to Qnil, which means that the default active keymaps > should be used. This would be the case, if the raw key sequence was > bound to an empty vector in a translation map. > > first_event = mock_input > 0 ? keybuf[0] : Qnil; > ^^^^ > > Now back to my original problem: mouse clicks in the mode line do not > work correctly. xterm-mouse-mode uses the input-decode-map to translate > special character sequences coming from xterm (starting with "\e[") into > proper mouse events. Without the patch, first_event is set to ?\e. > Therefore the esc-map is used to find a binding for the mouse event, > which of cause does not work as intended. With the patch, first_event is > set to the mouse event and the binding in the local-map property will be > found. > > Et vola, mouse clicks in the mode line will work :-) Thanks for the detailed explanations, they help a lot. I have a few questions. First, why did you need this hunk: > @@ -9669,6 +9672,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, > indec.start += diff; > fkey.end += diff; > fkey.start += diff; > + first_event = mock_input > 0 ? keybuf[0] : Qnil; > > goto replay_sequence; > } This is no longer about input-decode-map, it's about key-translation-map. And xterm-mouse-mode doesn't use key-translation-map, so why change this part? The next question is whether this patch caters correctly to features other than xterm-mouse-mode. The input-decode-map is used by terminal-specific support in xterm.el and rxvt.el -- does it still make sense to use keybuf[0] as first_event for replaying their sequences?