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, 30 Nov 2018 09:36:43 +0100	[thread overview]
Message-ID: <m2a7lr0xno.fsf@gmail.com> (raw)
In-Reply-To: <87vafbdj6i.fsf@users.sourceforge.net> (Noam Postavsky's message of "Mon, 05 Feb 2018 20:02:29 -0500")

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> tags 30309 + confirmed easy
> retitle 30309 C-u M-x insert-kbd-macro RET RET inserts many unrelated "bindings" (menu separators?)
> quit
>
> Robert Pluim <rpluim@gmail.com> writes:
>
>> #emacs-26
>> emacs -Q
>> C-u M-x insert-kbd-macro RET RET
>> =>
>> (setq last-kbd-macro
>>    nil)
>> (global-set-key [C-down-mouse-2 s2] 'last-kbd-macro)
>> (global-set-key [C-down-mouse-2 s1] 'last-kbd-macro)
>> (global-set-key [menu-bar help-menu sep1] 'last-kbd-macro)
> [...]
>
> Yeah, I guess no keybindings should be inserted in that case.

So I guess just checking for last-kbd-macro should be enough, since
that should never have a legitimate key binding.

diff --git i/lisp/macros.el w/lisp/macros.el
index 4078b983ec..53a688a367 100644
--- i/lisp/macros.el
+++ w/lisp/macros.el
@@ -125,7 +125,7 @@ insert-kbd-macro
         ;; (kmacro-create [<keys>] 0 "%d").
 	(prin1 definition (current-buffer))))
     (insert ")\n")
-    (if keys
+    (and keys (not (eq macroname 'last-kbd-macro))
         (let ((keys (or (where-is-internal (symbol-function macroname)
                                            '(keymap))
                         (where-is-internal macroname '(keymap)))))





  reply	other threads:[~2018-11-30  8:36 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 [this message]
2019-03-29 14:16     ` Noam Postavsky
2019-03-29 15:06       ` Robert Pluim
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=m2a7lr0xno.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).