unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 30309@debbugs.gnu.org
Subject: bug#30309: Surprising behaviour of insert-kbd-macro
Date: Fri, 29 Mar 2019 16:06:44 +0100	[thread overview]
Message-ID: <m2y34xg1ob.fsf@gmail.com> (raw)
In-Reply-To: <CAM-tV-9P-fjsOSUJ+Vr=T4_-hrXcak-Hh34nmJXOjsO=zRAGPA@mail.gmail.com> (Noam Postavsky's message of "Fri, 29 Mar 2019 10:16:50 -0400")

>>>>> On Fri, 29 Mar 2019 10:16:50 -0400, Noam Postavsky <npostavs@users.sourceforge.net> said:

    Noam> On Fri, 30 Nov 2018 at 03:37, Robert Pluim <rpluim@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);





  reply	other threads:[~2019-03-29 15:06 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 [this message]
2019-04-16  0:23         ` Noam Postavsky
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=m2y34xg1ob.fsf@gmail.com \
    --to=rpluim@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).