Subject: Re: bug#29349: [Patch] Bug 29349: read_key_sequence is only partially recursive. This is a bug.

From: Alan Mackenzie <[email-masked]>
Date: Sun, 19 Nov 2017 20:41:21 +0000

Hello, Eli.

On Sun, Nov 19, 2017 at 20:02:23 +0200, Eli Zaretskii wrote:
> > Date: Sun, 19 Nov 2017 17:45:22 +0000
> > Cc: [email-masked]
> > From: Alan Mackenzie <[email-masked]>

> > In the emacs-26 branch, in a Linux tty with GPM configured and working,
> > type:

> >     C-h c  C-mouse-3 mouse-1 mouse-1

> > , without moving the mouse.  This will end up clicking on
> > "emacs-tutorial".  The message printed in the message area is then:

> >     <C-down-mouse-3> <help-menu> <emacs-tutorial> (translated from
> >     <mouse-1> <emacs-tutorial>) at that spot runs the command
> >     help-with-tutorial

> > .  In the "translated from <mouse-1> <emacs-tutorial>", the first event,
> > C-mouse-3 has been overwritten by mouse-1.  This mouse-1 is a mouse-click
> > from the menu processing.  `describe-key-briefly' can then do nothing
> > other than printing a spurious "translated from" message.

> > With the patch applied, the C-down-mouse-3 survives in the raw key
> > buffer, enabling `describe-key-briefly' to do the Right Thing.  It does
> > this by collecting the menu processing's mouse events in a separate
> > buffer, then copying that buffer to the main one afterwards.

> OK, but then (a) please install the patch on master, not on the
> release branch, ....

I'll do that, but probably not tonight.

> .... and (b) why do we need the followup patch -- with the mouse-1
> events injected into the sequence the "translation" looks correct and
> even educational.

I don't think it looks correct.  The C-down-mouse-3 which exists as an
essential part of the key sequence has been overwritten in the
"translation".

The other thing is that if mouse-movements get into the raw event buffer
(which I've seen, but for some reason amn't seeing any more) the
"translated from" could become objectionably long.

I think the "translated from" bit is intended to document a sequence the
user is aware of (such as a double click) being translated into a
different sequence she's aware of (such as a single click).  The mouse-1,
I believe, is more part of the user's subconsciousness rather than
awareness.

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).