emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 59b5dc6: Fix this-command-keys for "M-x foo" comm


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 59b5dc6: Fix this-command-keys for "M-x foo" commands
Date: Thu, 12 Oct 2017 16:40:00 -0400 (EDT)

branch: emacs-26
commit 59b5dc60d660f81f8b781068d13727ed812ad555
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix this-command-keys for "M-x foo" commands
    
    * src/keyboard.c (Fset__this_command_keys): Don't assume KEYS is a
    unibyte string.  (Bug#28798)
---
 src/keyboard.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/keyboard.c b/src/keyboard.c
index ee353d2..7ddd6b9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10055,7 +10055,12 @@ Internal use only.  */)
 
   this_command_key_count = 0;
   this_single_command_key_start = 0;
-  int key0 = SREF (keys, 0);
+
+  int charidx = 0, byteidx = 0;
+  int key0;
+  FETCH_STRING_CHAR_ADVANCE (key0, keys, charidx, byteidx);
+  if (CHAR_BYTE8_P (key0))
+    key0 = CHAR_TO_BYTE8 (key0);
 
   /* Kludge alert: this makes M-x be in the form expected by
      novice.el.  (248 is \370, a.k.a. "Meta-x".)  Any better ideas?  */
@@ -10064,7 +10069,13 @@ Internal use only.  */)
   else
     add_command_key (make_number (key0));
   for (ptrdiff_t i = 1; i < SCHARS (keys); i++)
-    add_command_key (make_number (SREF (keys, i)));
+    {
+      int key_i;
+      FETCH_STRING_CHAR_ADVANCE (key_i, keys, charidx, byteidx);
+      if (CHAR_BYTE8_P (key_i))
+       key_i = CHAR_TO_BYTE8 (key_i);
+      add_command_key (make_number (key_i));
+    }
   return Qnil;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]