unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 30309@debbugs.gnu.org
Subject: bug#30309: Surprising behaviour of insert-kbd-macro
Date: Mon, 15 Apr 2019 20:23:19 -0400	[thread overview]
Message-ID: <87pnpmztl4.fsf@gmail.com> (raw)
In-Reply-To: <m2y34xg1ob.fsf@gmail.com> (Robert Pluim's message of "Fri, 29 Mar 2019 16:06:44 +0100")

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	other threads:[~2019-04-16  0:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 16:26 bug#30309: Surprising behaviour of insert-kbd-macro Robert Pluim
2018-02-06  1:02 ` Noam Postavsky
2018-11-30  8:36   ` Robert Pluim
2019-03-29 14:16     ` Noam Postavsky
2019-03-29 15:06       ` Robert Pluim
2019-04-16  0:23         ` Noam Postavsky [this message]
2019-04-16  7:47           ` Robert Pluim
2022-01-23 15:48 ` bug#30309: C-u M-x insert-kbd-macro RET RET inserts many unrelated "bindings" (menu separators?) Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnpmztl4.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=30309@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).