GNU bug report logs - #29349
read_key_sequence is only partially recursive. This is a bug.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 18 Nov 2017 09:42:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#29349: closed (read_key_sequence is only partially recursive.
  This is a bug.)
Date: Mon, 20 Nov 2017 18:16:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 20 Nov 2017 18:12:27 +0000
with message-id <20171120181227.GA15871 <at> ACM>
and subject line Re: [Patch] Bug 29349: read_key_sequence is only partially recursive.  This is a bug.
has caused the debbugs.gnu.org bug report #29349,
regarding read_key_sequence is only partially recursive.  This is a bug.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
29349: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29349
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: read_key_sequence is only partially recursive.  This is a bug.
Date: Sat, 18 Nov 2017 09:38:43 +0000
Hello, Emacs.

In branch emacs-26.

I came across this bug whilst working on bug #29272 ("C-h k C-mouse-3"
followed by menu selection asks for more keys).

In a Linux tty using the GPM mouse package, doing read_key_sequence (the
C function in keyboard.c), when a menu action is activated,
read_key_sequence calls itself recursively to handle all the mouse
manipulation.

Unfortunately, the variable raw_keybuf_count is initialised to 0 in
r_k_s.  This includes in the recursive call.  This variable indexes the
global buffer raw_keybuf, which accumulates the raw events which make up
the key sequence.

The result of this is that the events in the recursive call overwrite
the stored events of the outer r_k_s call, leaving a mess.

r_k_s is static in keyboard.c and is called from three functions:
command_loop_1, read_menu_command (the one that gives the trouble), and
read_key_sequence_vs.

So I propose as a solution that raw_keybuf_count be initialised to zero
in two of these three functions, but not in read_menu_command (and no
longer in read_key_sequence).  I've tried this, and it seems to work.
It has the disadvantage of being ugly, and it makes read_menu_command
only callable as a subfunction of r_k_s.

Has anybody any thoughts on this?

#########################################################################

As a second problem, is there any way, preferably at the Lisp level, to
determine that a key sequence is a menu key sequence?

-- 
Alan Mackenzie (Nuremberg, Germany).


[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: 29349-done <at> debbugs.gnu.org
Subject: Re: [Patch] Bug 29349: read_key_sequence is only partially
 recursive.  This is a bug.
Date: Mon, 20 Nov 2017 18:12:27 +0000
Bug fixed in master.

-- 
Alan Mackenzie (Nuremberg, Germany).


This bug report was last modified 7 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.