diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index f0a95c3e5ab..19f8dbb3b57 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6901,11 +6901,10 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ | |||
| 6901 | (prefixarg) | 6901 | (prefixarg) |
| 6902 | Lisp_Object prefixarg; | 6902 | Lisp_Object prefixarg; |
| 6903 | { | 6903 | { |
| 6904 | defsubr (&Sfocus_frame); | ||
| 6905 | defsubr (&Sunfocus_frame); | ||
| 6906 | Lisp_Object function; | 6904 | Lisp_Object function; |
| 6907 | char buf[40]; | 6905 | char buf[40]; |
| 6908 | Lisp_Object saved_keys; | 6906 | Lisp_Object saved_keys; |
| 6907 | Lisp_Object bindings, value; | ||
| 6909 | struct gcpro gcpro1, gcpro2; | 6908 | struct gcpro gcpro1, gcpro2; |
| 6910 | 6909 | ||
| 6911 | saved_keys = Fvector (this_command_key_count, | 6910 | saved_keys = Fvector (this_command_key_count, |
| @@ -6988,24 +6987,46 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ | |||
| 6988 | if (!NILP (Vsuggest_key_bindings) | 6987 | if (!NILP (Vsuggest_key_bindings) |
| 6989 | && NILP (Vexecuting_macro) | 6988 | && NILP (Vexecuting_macro) |
| 6990 | && SYMBOLP (function)) | 6989 | && SYMBOLP (function)) |
| 6991 | { | 6990 | bindings = Fwhere_is_internal (function, Voverriding_local_map, |
| 6992 | Lisp_Object bindings; | 6991 | Qt, Qnil); |
| 6992 | else | ||
| 6993 | bindings = Qnil; | ||
| 6993 | 6994 | ||
| 6994 | bindings = Fwhere_is_internal (function, Voverriding_local_map, | 6995 | value = Qnil; |
| 6995 | Qt, Qnil); | 6996 | GCPRO2 (bindings, value); |
| 6997 | value = Fcommand_execute (function, Qt, Qnil, Qnil); | ||
| 6996 | 6998 | ||
| 6997 | if (!NILP (bindings)) | 6999 | /* If the command has a key binding, print it now. */ |
| 7000 | if (!NILP (bindings)) | ||
| 7001 | { | ||
| 7002 | /* But first wait, and skip the message if there is input. */ | ||
| 7003 | if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings) | ||
| 7004 | ? Vsuggest_key_bindings : make_number (2)), | ||
| 7005 | Qnil, Qnil))) | ||
| 6998 | { | 7006 | { |
| 6999 | message ("You can run the command `%s' by typing %s", | 7007 | Lisp_Object binding; |
| 7008 | char *newmessage; | ||
| 7009 | char *oldmessage = echo_area_glyphs; | ||
| 7010 | int oldmessage_len = echo_area_glyphs_length; | ||
| 7011 | |||
| 7012 | binding = Fkey_description (bindings); | ||
| 7013 | |||
| 7014 | newmessage | ||
| 7015 | = (char *) alloca (XSYMBOL (function)->name->size | ||
| 7016 | + XSTRING (binding)->size | ||
| 7017 | + 100); | ||
| 7018 | sprintf (newmessage, "You can run the command `%s' by typing %s", | ||
| 7000 | XSYMBOL (function)->name->data, | 7019 | XSYMBOL (function)->name->data, |
| 7001 | XSTRING (Fkey_description (bindings))->data); | 7020 | XSTRING (binding)->data); |
| 7002 | Fsit_for ((NUMBERP (Vsuggest_key_bindings) | 7021 | message1_nolog (newmessage); |
| 7003 | ? Vsuggest_key_bindings : make_number (2)), | 7022 | if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings) |
| 7004 | Qnil, Qnil); | 7023 | ? Vsuggest_key_bindings : make_number (2)), |
| 7024 | Qnil, Qnil))) | ||
| 7025 | message2_nolog (oldmessage, oldmessage_len); | ||
| 7005 | } | 7026 | } |
| 7006 | } | 7027 | } |
| 7007 | 7028 | ||
| 7008 | return Fcommand_execute (function, Qt, Qnil, Qnil); | 7029 | RETURN_UNGCPRO (value); |
| 7009 | } | 7030 | } |
| 7010 | 7031 | ||
| 7011 | /* Find the set of keymaps now active. | 7032 | /* Find the set of keymaps now active. |