(where-is-internal function overriding-local-map t))))
(unless (commandp function)
(error "`%s' is not a valid command name" command-name))
+ ;; Some features, such as novice.el, rely on this-command-keys
+ ;; including M-x COMMAND-NAME RET.
+ (set--this-command-keys (concat "\M-x" (symbol-name function) "\r"))
(setq this-command function)
;; Normally `real-this-command' should never be changed, but here we really
;; want to pretend that M-x <cmd> RET is nothing more than a "key
XVECTOR (this_command_keys)->contents);
}
+DEFUN ("set--this-command-keys", Fset__this_command_keys,
+ Sset__this_command_keys, 1, 1, 0,
+ doc: /* Set the vector to be returned by `this-command-keys'.
+The argument KEYS must be a string.
+Internal use only. */)
+ (Lisp_Object keys)
+{
+ CHECK_STRING (keys);
+
+ this_command_key_count = 0;
+ this_single_command_key_start = 0;
+ int key0 = SREF (keys, 0);
+
+ /* Kludge alert: this makes M-x be in the form expected by
+ novice.el. Any better ideas? */
+ if (key0 == 248)
+ add_command_key (make_number ('x' | meta_modifier));
+ else
+ add_command_key (make_number (key0));
+ for (int i = 1; i < SCHARS (keys); i++)
+ add_command_key (make_number (SREF (keys, i)));
+ return Qnil;
+}
+
DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0,
doc: /* Return the key sequence that invoked this command, as a vector.
However, if the command has called `read-key-sequence', it returns
defsubr (&Sthis_command_keys_vector);
defsubr (&Sthis_single_command_keys);
defsubr (&Sthis_single_command_raw_keys);
+ defsubr (&Sset__this_command_keys);
defsubr (&Sclear_this_command_keys);
defsubr (&Ssuspend_emacs);
defsubr (&Sabort_recursive_edit);