Subject: Re: bug#35486: 26.1; insert-kbd-macro now creates unreadable list code

From: [email-masked]
Date: Mon, 29 Apr 2019 17:55:42 -0400

Francesco Potortì <[email-masked]> writes:

> The insert-kbd-macro function now creates code like this:
>
> (fset 'rmail-remove-me
>    (lambda (&optional arg) "Keyboard macro." (interactive "p")
>    (kmacro-exec-ring-item (quote ([21 114 80 108 101 101 97 97 115 97
>    115 ...
>
> rather than this as before:
>
> (fset 'approve
>    "\C-[xundigestify\C-mdd\C-xqde\M-k\M-k\M-k\M-k\C-c\C-crApproved: ...

By "before", do you mean Emacs 21?  It looks like the (lambda ()
(kmacro-exec-ring-item ...)) thing was added in [1: 18d1e6c], which was
fairly long ago.

[1: 18d1e6c]: 2004-09-09 20:48:12 +0000
  (kmacro-bind-to-key): Associate dedicated macro counter and format with binding.
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=18d1e6c9fd4d8d446329ceb48a83ddca373f72c0

> This makes it impossible to understand at a glance what a given macro
> does by browsing the lisp code.  I find this to be a regression.  Can
> this be undone, or at least controlled by an option?

I think the kmacro-bind-to-key is important to preserve the way macro
counters work, but it seems like we should be able to add some special
casing to at least get something like this:

(fset 'approve
   (lambda (&optional arg)
     "Keyboard macro."
     (interactive "p")
     (kmacro-exec-ring-item (quote ([?\M-x ?u ?n ?d ?i ?g ?e ?s ?t ?i ?f ?y return ?d ?d ?\C-x ?q ?d ?e ?\M-k] 0 "%d")) arg)))