[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9922: 24.0.91; prompt by y-or-n-p changes tool bar on another frame
From: |
Chong Yidong |
Subject: |
bug#9922: 24.0.91; prompt by y-or-n-p changes tool bar on another frame |
Date: |
Thu, 26 Apr 2012 22:46:47 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> 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!
> 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))
The above `lookup-key' call returns the tool bar map generated by
evaluating `tool-bar-make-keymap' (which is the :filter function for the
menu item bound to [tool-bar]). The value returned by that function is
frame- and buffer-specific, but because it gets applied to the
replacement global map, it takes effect in all frames.
Unfortunately, currently we don't have a way to tell `lookup-key' to
just return the menu item without evaluating :filter functions. The
following hack would work around this for 24.1, though it's a bit
black-magicky.
Stefan, AFAICT think you wrote the code in question. Opinions?
=== modified file 'lisp/subr.el'
*** lisp/subr.el 2012-04-19 06:04:05 +0000
--- lisp/subr.el 2012-04-26 14:40:59 +0000
***************
*** 2019,2025 ****
(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))
(aref (catch 'read-key (read-key-sequence-vector prompt nil t)) 0))
(cancel-timer timer)
--- 2019,2027 ----
(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]
! (or (cdr (assq 'tool-bar global-map))
! (lookup-key global-map [tool-bar])))
map))
(aref (catch 'read-key (read-key-sequence-vector prompt nil t)) 0))
(cancel-timer timer)
- bug#9922: 24.0.91; prompt by y-or-n-p changes tool bar on another frame,
Chong Yidong <=