From: Eli Zaretskii Date: Fri, 4 Aug 2023 06:34:55 +0000 (+0300) Subject: Fix "Paste from Kill Menu" in non X toolkit builds X-Git-Tag: emacs-29.1.90~260 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=acfcf7f3690630344b090b4af6afa4d02d0147a3;p=emacs.git Fix "Paste from Kill Menu" in non X toolkit builds * src/keymap.c (possibly_translate_key_sequence): Don't signal an error if 'key-valid-p' returns nil. Suggested by Stefan Monnier . (Bug#64927) --- diff --git a/src/keymap.c b/src/keymap.c index 7f5777c9251..41ca43d6a95 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1065,8 +1065,12 @@ possibly_translate_key_sequence (Lisp_Object key, ptrdiff_t *length) xsignal2 (Qerror, build_string ("`key-valid-p' is not defined, so this syntax can't be used: %s"), key); + /* If key-valid-p is unhappy about KEY, we return it as-is. + This happens when menu items define as bindings strings that + should be inserted into the buffer, not commands. See + bug#64927, for example. */ if (NILP (call1 (Qkey_valid_p, AREF (key, 0)))) - xsignal2 (Qerror, build_string ("Invalid `key-parse' syntax: %S"), key); + return key; key = call1 (Qkey_parse, AREF (key, 0)); *length = CHECK_VECTOR_OR_STRING (key); if (*length == 0)