unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Colin Baxter <m43cap@yandex.com>
Cc: 48523@debbugs.gnu.org
Subject: bug#48523: 27.2; kbd macro fails evaluation
Date: Wed, 19 May 2021 11:20:53 -0400	[thread overview]
Message-ID: <jwv7djulpim.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87tumyzut3.fsf@yandex.com> (Colin Baxter's message of "Wed, 19 May 2021 15:01:44 +0100")

> This gives:
>
> #+begin_src elisp
>  (fset 'myfullstop
>    (kmacro-lambda-form [?\C-x ?8 return ?F ?U ?L ?L ?W ?I ?D ?T ?H ?  ?F
>    ?U ?L ?L ?  ?S ?T ?O ?P return] 0 "%d"))
> #+end_src
>
>
> An eval (C-j with point at end) of the above expression gives the error:
>
> ----- Begin --------
>
> Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 3)

I installed the patch below which should fix this blunder, thanks.


        Stefan


diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 3700a1964a6..afc486f4edc 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -782,17 +782,23 @@ kmacro-end-call-mouse
 ;; executing the macro later on (but that's controversial...)
 
 ;;;###autoload
-(defun kmacro-lambda-form (mac)
+(defun kmacro-lambda-form (mac &optional counter format)
   "Create lambda form for macro bound to symbol or key."
-  ;; FIXME: This should be a "funcallable struct"!
-  (lambda (&optional arg)
-    "Keyboard macro."
-    ;; We put an "unused prompt" as a special marker so
-    ;; `kmacro-extract-lambda' can see it's "one of us".
-    (interactive "pkmacro")
-    (if (eq arg 'kmacro--extract-lambda)
-        (cons 'kmacro--extract-lambda mac)
-      (kmacro-exec-ring-item mac arg))))
+  ;; Apparently, there are two different ways this is called:
+  ;; either `counter' and `format' are both provided and `mac' is a vector,
+  ;; or only `mac' is provided, as a list (MAC COUNTER FORMAT).
+  ;; The first is used from `insert-kbd-macro' and `edmacro-finish-edit',
+  ;; while the second is used from within this file.
+  (let ((mac (if counter (list mac counter format) mac)))
+    ;; FIXME: This should be a "funcallable struct"!
+    (lambda (&optional arg)
+      "Keyboard macro."
+      ;; We put an "unused prompt" as a special marker so
+      ;; `kmacro-extract-lambda' can see it's "one of us".
+      (interactive "pkmacro")
+      (if (eq arg 'kmacro--extract-lambda)
+          (cons 'kmacro--extract-lambda mac)
+        (kmacro-exec-ring-item mac arg)))))
 
 (defun kmacro-extract-lambda (mac)
   "Extract kmacro from a kmacro lambda form."






  reply	other threads:[~2021-05-19 15:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 14:01 bug#48523: 27.2; kbd macro fails evaluation Colin Baxter
2021-05-19 15:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-05-19 16:49   ` Colin Baxter
2021-05-19 19:10     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=jwv7djulpim.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=48523@debbugs.gnu.org \
    --cc=m43cap@yandex.com \
    --cc=monnier@iro.umontreal.ca \
    /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).