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.

Full log


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




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

Previous Next


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