bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30309: Surprising behaviour of insert-kbd-macro


From: Noam Postavsky
Subject: bug#30309: Surprising behaviour of insert-kbd-macro
Date: Mon, 15 Apr 2019 20:23:19 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Robert Pluim <rpluim@gmail.com> writes:

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

>  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 (NILP (definition))
> +    return Qnil;
> +

Hmm, on the one hand no keys invoke 'nil', so returning nil in that
situation is already covered by the current docstring (and doing
something else could be considered a plain bug).  On the other hand, I
see it returns keys for which (define-key global-map KEY nil) was
called, which is potentially useful.  I don't know if anything uses
that, but I hesitate to remove the capability.

By the way, I noticed the diff below also fixes this bug, although I
don't quite understand why.

--- i/lisp/macros.el
+++ w/lisp/macros.el
@@ -127,7 +127,7 @@ (defun insert-kbd-macro (macroname &optional keys)
     (insert ")\n")
     (if keys
         (let ((keys (or (where-is-internal (symbol-function macroname)
-                                           '(keymap))
+                                           '(keymap) nil t)
                         (where-is-internal macroname '(keymap)))))
          (while keys
            (insert "(global-set-key ")






reply via email to

[Prev in Thread] Current Thread [Next in Thread]