Many thanks Andreas - that's certainly more concise than using a lambda. 

I do think this is a trap for users who may expect that a key definition that a single character string simply specifies the character to be inserted when that key is pressed rather than a macro. Treating a string with a single character as a character to insert rather than a one-character macro might avoid that, or if that is awkward to implement or otherwise undesirable an explicit warning in the documentation might help. The documentation for define-key does say that a string is treated as a keyboard macro, but the significance of that is easy to miss.


On Sat, 7 Jun 2025 at 15:29, Andreas Schwab <schwab@linux-m68k.org> wrote:
On Jun 07 2025, John Holman wrote:

> However the same syntax fails for some characters (so far I've noticed this
> for \u00B0 to \u00B6 but there will be more) e.g
> after (define-key my-test-mode-map (kbd "a") "\u00B2") C-h k shows

Use vector notation instead: [?\u0082].  Generally, use of strings to
represent key sequences should be avoided.

--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."