GNU bug report logs - #30309
C-u M-x insert-kbd-macro RET RET inserts many unrelated "bindings" (menu separators?)

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Wed, 31 Jan 2018 16:28:01 UTC

Severity: minor

Tags: confirmed, easy

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 30309 <at> debbugs.gnu.org
Subject: bug#30309: Surprising behaviour of insert-kbd-macro
Date: Fri, 29 Mar 2019 16:06:44 +0100
>>>>> On Fri, 29 Mar 2019 10:16:50 -0400, Noam Postavsky <npostavs <at> users.sourceforge.net> said:

    Noam> On Fri, 30 Nov 2018 at 03:37, Robert Pluim <rpluim <at> gmail.com> wrote:
    >> So I guess just checking for last-kbd-macro should be enough,
    >> since that should never have a legitimate key binding.

    Noam> I think avoiding passing nil to where-is-internal would be
    Noam> cleaner (or else stop where-is-internal from looking for
    Noam> bindings of nil). And it would handle the non-interactive
    Noam> case of

    Noam> (insert-kbd-macro 'something-not-fbound t)

That would work as well. Something like this (utterly untested beyond
'insert-kbd-macro'):

diff --git a/src/keymap.c b/src/keymap.c
index 2ac3d33460..2e9f3d5a96 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2489,6 +2489,7 @@ where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
 
 DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 5, 0,
        doc: /* Return list of keys that invoke DEFINITION.
+If DEFINITION is nil, return nil.
 If KEYMAP is a keymap, search only KEYMAP and the global keymap.
 If KEYMAP is nil, search all the currently active keymaps, except
  for `overriding-local-map' (which is ignored).
@@ -2536,6 +2537,9 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
   bool remapped = 0;
   Lisp_Object tem = Qnil;
 
+  if (NILP (definition))
+    return Qnil;
+
   /* Refresh the C version of the modifier preference.  */
   where_is_preferred_modifier
     = parse_solitary_modifier (Vwhere_is_preferred_modifier);




This bug report was last modified 3 years and 177 days ago.

Previous Next


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