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

From: Robert Pluim <[email-masked]>
Date: Fri, 28 Jul 2023 11:57:13 +0200

>>>>> 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).

Robert
--