From: Don March Date: Tue, 2 Aug 2011 15:27:38 +0000 (+0200) Subject: Fix non-prefix key error message when last character M-[char] is translated to ESC... X-Git-Tag: emacs-pretest-24.0.90~104^2~124^2~66^2~17 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b099e0639249800f68792c11ef0415916d75f598;p=emacs.git Fix non-prefix key error message when last character M-[char] is translated to ESC [char] --- diff --git a/src/ChangeLog b/src/ChangeLog index 80508531b1a..858833dbe25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-12-03 Don March + + * keymap.c (Fdefine_key): Fix non-prefix key error message when + last character M-[char] is translated to ESC [char] (bug#7541). + 2011-08-02 Kenichi Handa * lisp.h (uniprop_table): Extern it. diff --git a/src/keymap.c b/src/keymap.c index 0169276bef9..03688abfe4c 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1216,13 +1216,27 @@ binding KEY to DEF is added at the front of KEYMAP. */) keymap = get_keymap (cmd, 0, 1); if (!CONSP (keymap)) - /* We must use Fkey_description rather than just passing key to - error; key might be a vector, not a string. */ - error ("Key sequence %s starts with non-prefix key %s", - SDATA (Fkey_description (key, Qnil)), - SDATA (Fkey_description (Fsubstring (key, make_number (0), - make_number (idx)), - Qnil))); + { + char trailing_esc[5]; + if (c == meta_prefix_char && metized) + { + if (idx == 0) + strcpy(trailing_esc, "ESC"); + else + strcpy(trailing_esc, " ESC"); + } + else + strcpy(trailing_esc, ""); + + /* We must use Fkey_description rather than just passing key to + error; key might be a vector, not a string. */ + error ("Key sequence %s starts with non-prefix key %s%s", + SDATA (Fkey_description (key, Qnil)), + SDATA (Fkey_description (Fsubstring (key, make_number (0), + make_number (idx)), + Qnil)), + trailing_esc); + } } }