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, 18 Nov 2017 11:52:56 +0200 Message-ID: <83y3n3gbgn.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 1510998851 25387 195.159.176.226 (18 Nov 2017 09:54:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2017 09:54:11 +0000 (UTC) Cc: 29104@debbugs.gnu.org To: Olaf Rogalsky , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 18 10:54: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 1eFzp7-0006Dp-SZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 10:54:06 +0100 Original-Received: from localhost ([::1]:49324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFzpF-0003lz-5Q for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 04:54:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFzp8-0003lh-Nr for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 04:54:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFzp4-0003o1-PN for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 04:54:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eFzp4-0003nt-L7 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 04:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eFzp4-0008L3-Ea for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 04:54: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, 18 Nov 2017 09:54: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.151099880232002 (code B ref 29104); Sat, 18 Nov 2017 09:54:02 +0000 Original-Received: (at 29104) by debbugs.gnu.org; 18 Nov 2017 09:53:22 +0000 Original-Received: from localhost ([127.0.0.1]:45559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFzoQ-0008K6-8Z for submit@debbugs.gnu.org; Sat, 18 Nov 2017 04:53:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFzoN-0008Js-T7 for 29104@debbugs.gnu.org; Sat, 18 Nov 2017 04:53:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFzoE-0003f4-Sr for 29104@debbugs.gnu.org; Sat, 18 Nov 2017 04:53:14 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFzoE-0003ey-Oj; Sat, 18 Nov 2017 04:53:10 -0500 Original-Received: from [176.228.60.248] (port=4491 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eFzoD-0005N2-MF; Sat, 18 Nov 2017 04:53:10 -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:140047 Archived-At: > From: Olaf Rogalsky > Date: Tue, 07 Nov 2017 00:47:28 +0100 > > I would like to give some more details on the patch and which problem it > tries to solve. > > Ultimately I try to get better support of the mouse under xterm. The > following features currently do not work with the mouse under xterm: > > 1. Mouse clicks on menu-bar always brings up the left-most menu, but not > the menu under the spot. > > 2. A mouse click on the mode-line activates the window, but does not > trigger the local-map property on the spot. > > 3. When moving the mouse over some text with a mouse-face property or > help-echo property nothing happens, because xterm-mouse-mode does not > receive any mouse motion events from the controlling xterm (except > during dragging operations). > > I haven't looked into (1), but I am testing a solution for (2) and (3). > > This patch (#29104) addresses (2). It does not implement a new feature, > but tries to make a bugfix to keyboard.c:read_key_sequence. This > function is a 900 lines nightmare of spaggheti code, full of global > state and goto's. At least it is somehow documented. > > But here we go, this is what I understood so far: > > The function reads input characters until some keybinding is found or > until the sequence does not form a prefix key sequence anymore. If the > trailing characters, which have been read so far, form a sequence in a > translation keymap (input-decode-map, key-translation-map, > local-function-key-map), those trailing characters are replaced by the > binding of the translation map. Thereafter a jump back close to the > beginning of the function is made and all events up to the replacement > event are reinterpreted again. > > Such jumps ("goto replay_sequence;") take place immediately after the > lines, which I introduced in the patch. When replaying the sequence, > the variable "first_event" will be used to select the currently active > keymaps (line 9035). In case, that the first characters are bound in a > key translation map, first_event still holds (incrorrectly, as I > presume) the first character of the translation sequence and not its > binding. > > 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 :-) Stefan, any comments? I'm thinking of installing this on master. Thanks.