unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
@ 2011-10-11 18:30 Drew Adams
  2011-10-11 18:59 ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2011-10-11 18:30 UTC (permalink / raw)
  To: 9730

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'
 






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2011-10-11 18:30 bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key' Drew Adams
@ 2011-10-11 18:59 ` Stefan Monnier
  2011-10-11 19:30   ` Drew Adams
  2016-04-28 11:34   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2011-10-11 18:59 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9730

> 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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2011-10-11 18:59 ` Stefan Monnier
@ 2011-10-11 19:30   ` Drew Adams
  2016-04-28 11:34   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Drew Adams @ 2011-10-11 19:30 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 9730

> 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.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2011-10-11 18:59 ` Stefan Monnier
  2011-10-11 19:30   ` Drew Adams
@ 2016-04-28 11:34   ` Lars Ingebrigtsen
  2016-04-28 12:10     ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-28 11:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9730

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 11:34   ` Lars Ingebrigtsen
@ 2016-04-28 12:10     ` Stefan Monnier
  2016-04-28 12:46       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2016-04-28 12:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 9730

> 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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 12:10     ` Stefan Monnier
@ 2016-04-28 12:46       ` Lars Ingebrigtsen
  2016-04-28 13:01         ` Nicolas Richard
  2016-04-28 13:33         ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-28 12:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9730

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 12:46       ` Lars Ingebrigtsen
@ 2016-04-28 13:01         ` Nicolas Richard
  2016-04-28 13:25           ` Lars Ingebrigtsen
  2016-04-28 13:33         ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Nicolas Richard @ 2016-04-28 13:01 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 9730, Stefan Monnier

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 13:01         ` Nicolas Richard
@ 2016-04-28 13:25           ` Lars Ingebrigtsen
  2016-04-28 13:50             ` Nicolas Richard
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-28 13:25 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: 9730, Stefan Monnier

Nicolas Richard <nrichard@ulb.ac.be> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 12:46       ` Lars Ingebrigtsen
  2016-04-28 13:01         ` Nicolas Richard
@ 2016-04-28 13:33         ` Stefan Monnier
  2016-04-28 13:37           ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2016-04-28 13:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 9730

> 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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 13:33         ` Stefan Monnier
@ 2016-04-28 13:37           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-28 13:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9730

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 13:25           ` Lars Ingebrigtsen
@ 2016-04-28 13:50             ` Nicolas Richard
  2016-05-01 19:13               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Richard @ 2016-04-28 13:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 9730, Stefan Monnier


Lars Ingebrigtsen <larsi@gnus.org> writes:

[...]

>>> Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key'
  2016-04-28 13:50             ` Nicolas Richard
@ 2016-05-01 19:13               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2016-05-01 19:13 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: 9730, Stefan Monnier

Nicolas Richard <nrichard@ulb.ac.be> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
> [...]
>
>>>> Stefan Monnier <monnier@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





^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-05-01 19:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11 18:30 bug#9730: 24.0.50; `M-o' should not be _invoked_ in `global-set-key' Drew Adams
2011-10-11 18:59 ` Stefan Monnier
2011-10-11 19:30   ` Drew Adams
2016-04-28 11:34   ` Lars Ingebrigtsen
2016-04-28 12:10     ` Stefan Monnier
2016-04-28 12:46       ` Lars Ingebrigtsen
2016-04-28 13:01         ` Nicolas Richard
2016-04-28 13:25           ` Lars Ingebrigtsen
2016-04-28 13:50             ` Nicolas Richard
2016-05-01 19:13               ` Lars Ingebrigtsen
2016-04-28 13:33         ` Stefan Monnier
2016-04-28 13:37           ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).