GNU bug report logs - #9730
24.0.50; `M-o' should not be _invoked_ in `global-set-key'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Tue, 11 Oct 2011 18:31:01 UTC

Severity: minor

Tags: fixed

Found in version 24.0.50

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.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 9730 in the body.
You can then email your comments to 9730 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#9730; Package emacs. (Tue, 11 Oct 2011 18:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 11 Oct 2011 18:31:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
Date: Tue, 11 Oct 2011 11:30:18 -0700
emacs -Q
 
M-x global-set-key
 
Hit `M-o'
 
The (prefix-key) binding of `M-o' is _invoked_, interrupting the
`global-set-key dialog etc.  Bad.
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-09-19 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Tue, 11 Oct 2011 19:01:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9730 <at> debbugs.gnu.org
Subject: Re: bug#9730: 24.0.50;
	`M-o' should not be _invoked_ in `global-set-key'
Date: Tue, 11 Oct 2011 14:59:32 -0400
> emacs -Q
> M-x global-set-key
> Hit `M-o'
> The (prefix-key) binding of `M-o' is _invoked_, interrupting the
> `global-set-key dialog etc.  Bad.

Actually, the binding is not really invoked, but the "hierarKey" menu is
displayed, overwriting the minibuffer prompt, which is indeed confusing.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Tue, 11 Oct 2011 19:32:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 9730 <at> debbugs.gnu.org
Subject: RE: bug#9730: 24.0.50;
	`M-o' should not be _invoked_ in `global-set-key'
Date: Tue, 11 Oct 2011 12:30:49 -0700
> Actually, the binding is not really invoked, but the 
> "hierarKey" menu is displayed, overwriting the minibuffer
> prompt, which is indeed confusing.

Oh, right; forgot about ol' hierarKey.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 11:35:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 9730 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 13:34:04 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> emacs -Q
>> M-x global-set-key
>> Hit `M-o'
>> The (prefix-key) binding of `M-o' is _invoked_, interrupting the
>> `global-set-key dialog etc.  Bad.
>
> Actually, the binding is not really invoked, but the "hierarKey" menu is
> displayed, overwriting the minibuffer prompt, which is indeed confusing.

What is...  the heirarKey menu?  :-)

Anyway, I've always thought that the `M-o' thing is massively unuseful.
Any chance of removing it from the global keymap?  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 12:11:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 9730 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 08:10:32 -0400
> What is...  the heirarKey menu?  :-)

It's the "kind of menu" that gets displayed in the minibuffer when you
hit M-o.

> Anyway, I've always thought that the `M-o' thing is massively unuseful.

FWIW I completely agree.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 12:48:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 9730 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 14:46:55 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> What is...  the heirarKey menu?  :-)
>
> It's the "kind of menu" that gets displayed in the minibuffer when you
> hit M-o.

Where is that defined?  I tried looking for the code in question, but it
seems to be happening outside the normal Emacs...  channels...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 13:02:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <nrichard <at> ulb.ac.be>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 9730 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 15:01:33 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>>> What is...  the heirarKey menu?  :-)
>>
>> It's the "kind of menu" that gets displayed in the minibuffer when you
>> hit M-o.
>
> Where is that defined?  I tried looking for the code in question, but it
> seems to be happening outside the normal Emacs...  channels...

It's in facemenu.el

See (info "(elisp) Defining Menus")

Here's a simple example :

(global-set-key
 (kbd "s-s")
 (let ((keymap (make-sparse-keymap "Options are...")))
   (define-key keymap (kbd "s-d") (cons "Doctor" 'doctor))
   (define-key keymap (kbd "s-b") (cons "Butterfly power" 'butterfly))
   keymap))

-- 
Nicolas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 13:26:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Nicolas Richard <nrichard <at> ulb.ac.be>
Cc: 9730 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 15:25:17 +0200
Nicolas Richard <nrichard <at> ulb.ac.be> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>
>>>> What is...  the heirarKey menu?  :-)
>>>
>>> It's the "kind of menu" that gets displayed in the minibuffer when you
>>> hit M-o.
>>
>> Where is that defined?  I tried looking for the code in question, but it
>> seems to be happening outside the normal Emacs...  channels...
>
> It's in facemenu.el
>
> See (info "(elisp) Defining Menus")
>
> Here's a simple example :
>
> (global-set-key
>  (kbd "s-s")
>  (let ((keymap (make-sparse-keymap "Options are...")))
>    (define-key keymap (kbd "s-d") (cons "Doctor" 'doctor))
>    (define-key keymap (kbd "s-b") (cons "Butterfly power" 'butterfly))
>    keymap))

Yes, but what's the code that ends up calling `message'?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 13:34:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 9730 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 09:33:30 -0400
> Where is that defined?  I tried looking for the code in question, but it
> seems to be happening outside the normal Emacs...  channels...

It's fairly well hidden inside the large C code for read-key-sequence.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 13:38:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 9730 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 15:37:00 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Where is that defined?  I tried looking for the code in question, but it
>> seems to be happening outside the normal Emacs...  channels...
>
> It's fairly well hidden inside the large C code for read-key-sequence.

Ah, thanks.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Thu, 28 Apr 2016 13:51:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <nrichard <at> ulb.ac.be>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 9730 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Thu, 28 Apr 2016 15:50:38 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

[...]

>>> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>>> It's the "kind of menu" that gets displayed in the minibuffer when you
>>>> hit M-o.

[...]

> but what's the code that ends up calling `message'?

I think it's in keyboard.c, where read_char_minibuf_menu_prompt does:

      message3_nolog (apply1 (intern ("concat"), Fnreverse (menu_strings)));


-- 
Nicolas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9730; Package emacs. (Sun, 01 May 2016 19:14:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Nicolas Richard <nrichard <at> ulb.ac.be>
Cc: 9730 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9730: 24.0.50;
 `M-o' should not be _invoked_ in `global-set-key'
Date: Sun, 01 May 2016 21:13:37 +0200
Nicolas Richard <nrichard <at> ulb.ac.be> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> [...]
>
>>>> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>>>> It's the "kind of menu" that gets displayed in the minibuffer when you
>>>>> hit M-o.
>
> [...]
>
>> but what's the code that ends up calling `message'?
>
> I think it's in keyboard.c, where read_char_minibuf_menu_prompt does:
>
>       message3_nolog (apply1 (intern ("concat"), Fnreverse (menu_strings)));

Aha.  The menu stuff seems to be controlled by the `menu-prompting'
variable, so I though `global-set-key' could just bind that variable.

And that seems to work.

I've now applied a patch to the trunk that seems to do the right thing.

diff --git a/lisp/subr.el b/lisp/subr.el
index 5f8d830..afc86a7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -849,7 +849,12 @@ global-set-key
 Note that if KEY has a local binding in the current buffer,
 that local binding will continue to shadow any global binding
 that you make with this function."
-  (interactive "KSet key globally: \nCSet key %s to command: ")
+  (interactive
+   (let* ((menu-prompting nil)
+          (key (read-key-sequence "Set key globally: ")))
+     (list key
+           (read-command (format "Set key %s to command: "
+                                 (key-description key))))))
   (or (vectorp key) (stringp key)
       (signal 'wrong-type-argument (list 'arrayp key)))
   (define-key (current-global-map) key command))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 01 May 2016 19:16:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 9730 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 01 May 2016 19:16: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. (Mon, 30 May 2016 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:03 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:03 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:03 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. (Sun, 01 Jan 2017 12:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 165 days ago.

Previous Next


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