Subject: bug#9922: 24.0.91; prompt by y-or-n-p changes tool bar on another frame

From: Eli Zaretskii <[email-masked]>
Date: Sat, 19 Nov 2011 15:57:11 +0200

> Date: Mon, 31 Oct 2011 20:24:06 +0200
> From: Eli Zaretskii <[email-masked]>
> 
>  emacs -Q
>  C-h i
>  C-x 5 b RET
>  
> Now switch to the frame that shows the "*info*" buffer and type
> 
>  M-: (y-or-n-p "Foo?") RET
> 
> After you hit RET, Emacs prompts in the minibuffer, and the tool bar
> on the frame that shows "*scratch*" suddenly shows button
> configuration of the Info mode!  It returns to its correct
> configuration once you exit the minibuffer.

First, this is a regression: Emacs 23.3 does not exhibit this
behavior.

Second, the problem seems to be caused by this fragment from
subr.el:read-key:

	  (use-global-map
           (let ((map (make-sparse-keymap)))
             ;; Don't hide the menu-bar and tool-bar entries.
             (define-key map [menu-bar] (lookup-key global-map [menu-bar]))
             (define-key map [tool-bar] (lookup-key global-map [tool-bar]))
             map))

This seems as if it actually intends to produce the buggy behavior.
Curiously, the same code exists in Emacs 23.3, but the tool bars on
the other frames are not affected in Emacs 23.3.  I couldn't find the
change in Emacs 24 that are responsible for the different behavior.