From 72ba149cfaae030bf2b17351681c89d0a04c35bc Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 9 Apr 2026 12:23:26 -0400 Subject: [PATCH] (listify-key-sequence): Fix breakage with unibyte chars * lisp/subr.el (listify-key-sequence): The funny "7th bit is Meta" applies only to unibyte strings. * test/lisp/subr-tests.el (subr-listify-key-sequence): New test. --- lisp/subr.el | 2 +- test/lisp/subr-tests.el | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/subr.el b/lisp/subr.el index 682e156de12..036f414262a 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1806,7 +1806,7 @@ See also `current-global-map'.") (defun listify-key-sequence (key) "Convert a key sequence to a list of events." (declare (side-effect-free t)) - (if (vectorp key) + (if (or (vectorp key) (multibyte-string-p key)) (append key nil) (mapcar (lambda (c) (if (> c 127) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 791b06f9edf..b99328459d6 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -433,6 +433,9 @@ (should (eq (global-key-binding "x") 'self-insert-command)) (should-not (global-key-binding [f12]))) +(ert-deftest subr-listify-key-sequence () + (should (equal (listify-key-sequence "ŕ°") '(?ŕ ?°)))) + ;;;; Mode hooks.