GNU bug report logs - #9922
24.0.91; prompt by y-or-n-p changes tool bar on another frame

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Mon, 31 Oct 2011 18:27:02 UTC

Severity: normal

Found in version 24.0.91

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9922 in the body.
You can then email your comments to 9922 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9922; Package emacs. (Mon, 31 Oct 2011 18:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eli Zaretskii <eliz <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 31 Oct 2011 18:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.91; prompt by y-or-n-p changes tool bar on another frame
Date: Mon, 31 Oct 2011 20:24:06 +0200
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

 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.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
d:/gnu/bzr/emacs/trunk/etc/DEBUG.


In GNU Emacs 24.0.91.1 (i386-mingw-nt5.1.2600)
 of 2011-10-31 on HOME-C4E4A596F7
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1255
  default enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-h i <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <right> <right> <return> <next> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <right> <right> 
<right> <return> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <next> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <left> <left> <left> <left> <left> 
<left> <return> l C-x 5 b <return> <help-echo> <help-echo> 
<switch-frame> M-x r e v e r t - b <tab> <return> y 
M-x r e p o r t - e m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Composing main Info directory...done
Revert info buffer? (y or n)  y
Reverted d:/usr/emacs/info/emacs

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug info easymenu time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer button faces cus-face files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9922; Package emacs. (Sat, 19 Nov 2011 14:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 9922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: 9922 <at> debbugs.gnu.org
Subject: Re: bug#9922: 24.0.91;
	prompt by y-or-n-p changes tool bar on another frame
Date: Sat, 19 Nov 2011 15:57:11 +0200
> Date: Mon, 31 Oct 2011 20:24:06 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
>  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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9922; Package emacs. (Thu, 26 Apr 2012 14:48:02 GMT) Full text and rfc822 format available.

Message #11 received at 9922 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9922 <at> debbugs.gnu.org
Subject: Re: 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
Eli Zaretskii <eliz <at> 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)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9922; Package emacs. (Thu, 26 Apr 2012 15:11:02 GMT) Full text and rfc822 format available.

Message #14 received at 9922 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 9922 <at> debbugs.gnu.org
Subject: Re: bug#9922: 24.0.91;
	prompt by y-or-n-p changes tool bar on another frame
Date: Thu, 26 Apr 2012 18:09:28 +0300
> From: Chong Yidong <cyd <at> gnu.org>
> Cc: 9922 <at> debbugs.gnu.org
> Date: Thu, 26 Apr 2012 22:46:47 +0800
> 
> The following hack would work around this for 24.1

It does, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9922; Package emacs. (Fri, 27 Apr 2012 01:03:01 GMT) Full text and rfc822 format available.

Message #17 received at 9922 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 9922 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#9922: 24.0.91;
	prompt by y-or-n-p changes tool bar on another frame
Date: Thu, 26 Apr 2012 21:01:40 -0400
> 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?

I think it's an OK workaround, tho it needs a comment like "lookup-key
without running :filters".

A better approach might be to provide a lookup-key which doesn't
run :filters.  Tho semantically, this is a murky area: without running
the filter we can't know whether the binding is nil, a keymap, or
something else, so we can't know whether it hides (or merges with)
other bindings in parent keymaps.  IOW, such a function should probably
return a list of "raw unreduced bindings".


        Stefan


> === 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 closed, send any further explanations to 9922 <at> debbugs.gnu.org and Eli Zaretskii <eliz <at> gnu.org> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 27 Apr 2012 02:26:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 25 May 2012 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 360 days ago.

Previous Next


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