Subject: bug#64912: 28.2; insert-kbd-macro creates a unicode character for Alt prefixed keysequences

From: Eli Zaretskii <[email-masked]>
Date: Fri, 28 Jul 2023 21:41:00 +0300

> Cc: [email-masked]
> Date: Fri, 28 Jul 2023 07:01:12 -0700
> From: Johnathan Mantey <[email-masked]>
> 
> On 7/28/23 02:57, Robert Pluim wrote:
> >>>>>> On Thu, 27 Jul 2023 10:47:24 -0700, Johnathan Mantey <[email-masked]> said:
> >      Johnathan> I created a keyboard macro that used the zap-to-char (Alt-z) keyboard
> >      Johnathan> sequence.
> >      Johnathan> The macro functions correctly in the session in which it was created.
> >      Johnathan> The macro is given a name.
> >      Johnathan> The macro is inserted into an elisp file using insert-kbd-macro.
> >      Johnathan> The macro, abbreviated here, creates an invalid character.
> >      Johnathan>    (fset 'test-macro
> >      Johnathan>    (kmacro-lambda-form [?\C-a ?ú ?\; ?\C-k] 0 "%d"))
> >      Johnathan> Evaluating this form causes the named macro to quit working.
> >      Johnathan> Instead of performing zap-to-char ';' it inserts the unicode char.
> >      Johnathan> Rerecording the macro using ESC, naming, and saving results in:
> >      Johnathan> macro to function correctly.
> >      Johnathan>    (fset 'test-macro
> >      Johnathan>    (kmacro-lambda-form [?\C-a escape ?z ?\; ?\C-k] 0 "%d"))
> >      Johnathan> Re-evaluating this source results in the macro functioning correctly.
> >
> > This works correctly in emacs-29, where the resulting macro form now
> > uses the `key-parse' syntax instead of the internal vector syntax, so
> > you get:
> >
> >      (defalias 'test-macro
> >         (kmacro "C-a M-z ; C-k"))
> >
> >  From etc/NEWS:
> >
> > ** Kmacro
> > Kmacros are now OClosures and have a new constructor 'kmacro' which
> > uses the 'key-parse' syntax.  It replaces the old 'kmacro-lambda-form'
> > (which is now declared obsolete).
> 
> I had a saved macro in the kmacro form. It must have been a result of 
> compiling and using source code in active development. I had some issue 
> with using the leading edge, and returned to my distributions 28.2 
> released version. The two versions aren't in sync, and I forgot how I 
> had an out of cycle Emacs in use, and probably active when I first 
> created that keyboard macro.
> 
> Thank you for your triage, and response.

So can we now close this bug, or is there anything else left to do
about it?