* src/keyboard.c: Export real-this-command to Elisp.
(syms_of_keyboard): Rename real_this_command to Vreal_this_command
and DEFVAR it. Update all users.
Fixes: debbugs:11506
+2012-06-02 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * simple.el (execute-extended-command): Set real-this-command
+ (bug#11506).
+
2012-06-02 Chong Yidong <cyd@gnu.org>
Remove incorrect uses of "modeline" in comments, docstrings, and
(if (null command-name) (setq command-name (read-extended-command)))
(let* ((function (and (stringp command-name) (intern-soft command-name)))
(binding (and suggest-key-bindings
- (not executing-kbd-macro)
- (where-is-internal function overriding-local-map t))))
+ (not executing-kbd-macro)
+ (where-is-internal function overriding-local-map t))))
(unless (commandp function)
(error "`%s' is not a valid command name" command-name))
- ;; Set this_command_keys to the concatenation of saved-keys and
- ;; function, followed by a RET.
(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
+ ;; binding" for <cmd>, so the command the user really wanted to run is
+ ;; `function' and not `execute-extended-command'. The difference is
+ ;; visible in cases such as M-x <cmd> RET and then C-x z (bug#11506).
+ (setq real-this-command function)
(let ((prefix-arg prefixarg))
(command-execute function 'record))
;; If enabled, show which key runs this command.
+2012-06-02 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keyboard.c: Export real-this-command to Elisp.
+ (syms_of_keyboard): Rename real_this_command to Vreal_this_command
+ and DEFVAR it. Update all users.
+
2012-06-02 Paul Eggert <eggert@cs.ucla.edu>
* minibuf.c (Fassoc_string): Remove duplicate declaration.
save_this_command = Vthis_command;
save_this_original_command = Vthis_original_command;
- save_real_this_command = real_this_command;
+ save_real_this_command = Vreal_this_command;
save_last_command = KVAR (current_kboard, Vlast_command);
if (NILP (keys))
key_count = ASIZE (keys);
}
- /* Save this now, since use of minibuffer will clobber it. */
+ /* Save this now, since use of minibuffer will clobber it. */
prefix_arg = Vcurrent_prefix_arg;
if (SYMBOLP (function))
The feature is not fully implemented. */
filter_specs = Qnil;
- /* If k or K discard an up-event, save it here so it can be retrieved with U */
+ /* If k or K discard an up-event, save it here so it can be retrieved with
+ U. */
up_event = Qnil;
/* Set SPECS to the interactive form, or barf if not interactive. */
Vthis_command = save_this_command;
Vthis_original_command = save_this_original_command;
- real_this_command= save_real_this_command;
+ Vreal_this_command = save_real_this_command;
KVAR (current_kboard, Vlast_command) = save_last_command;
temporarily_switch_to_single_kboard (NULL);
return unbind_to (speccount, apply1 (function, specs));
}
- /* Here if function specifies a string to control parsing the defaults */
+ /* Here if function specifies a string to control parsing the defaults. */
/* Set next_event to point to the first event with parameters. */
for (next_event = 0; next_event < key_count; next_event++)
Vthis_command = save_this_command;
Vthis_original_command = save_this_original_command;
- real_this_command= save_real_this_command;
+ Vreal_this_command = save_real_this_command;
KVAR (current_kboard, Vlast_command) = save_last_command;
{
static EMACS_INT last_auto_save;
-/* This is like Vthis_command, except that commands never set it. */
-Lisp_Object real_this_command;
-
/* The value of point when the last command was started. */
static ptrdiff_t last_point_position;
/* Do this after running Vpost_command_hook, for consistency. */
KVAR (current_kboard, Vlast_command) = Vthis_command;
- KVAR (current_kboard, Vreal_last_command) = real_this_command;
+ KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
if (!CONSP (last_command_event))
- KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
+ KVAR (current_kboard, Vlast_repeatable_command) = Vreal_this_command;
while (1)
{
before_command_echo_length = echo_length ();
Vthis_command = Qnil;
- real_this_command = Qnil;
+ Vreal_this_command = Qnil;
Vthis_original_command = Qnil;
Vthis_command_keys_shift_translated = Qnil;
/* Execute the command. */
Vthis_command = cmd;
- real_this_command = cmd;
+ Vreal_this_command = cmd;
safe_run_hooks (Qpre_command_hook);
already_adjusted = 0;
If the command didn't actually create a prefix arg,
but is merely a frame event that is transparent to prefix args,
then the above doesn't apply. */
- if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event))
+ if (NILP (KVAR (current_kboard, Vprefix_arg))
+ || CONSP (last_command_event))
{
KVAR (current_kboard, Vlast_command) = Vthis_command;
- KVAR (current_kboard, Vreal_last_command) = real_this_command;
+ KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
if (!CONSP (last_command_event))
- KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
+ KVAR (current_kboard, Vlast_repeatable_command)
+ = Vreal_this_command;
cancel_echoing ();
this_command_key_count = 0;
this_command_key_count_reset = 0;
staticpro (&tool_bar_items_vector);
tool_bar_items_vector = Qnil;
- staticpro (&real_this_command);
- real_this_command = Qnil;
-
DEFSYM (Qtimer_event_handler, "timer-event-handler");
DEFSYM (Qdisabled_command_function, "disabled-command-function");
DEFSYM (Qself_insert_command, "self-insert-command");
See Info node `(elisp)Multiple Terminals'. */);
DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
- doc: /* Same as `last-command', but never altered by Lisp code. */);
+ doc: /* Same as `last-command', but never altered by Lisp code.
+Taken from the previous value of `real-this-command'. */);
DEFVAR_KBOARD ("last-repeatable-command", Vlast_repeatable_command,
doc: /* Last command that may be repeated.
The last command executed that was not bound to an input event.
-This is the command `repeat' will try to repeat. */);
+This is the command `repeat' will try to repeat.
+Taken from a previous value of `real-this-command'. */);
DEFVAR_LISP ("this-command", Vthis_command,
doc: /* The command now being executed.
will be in `last-command' during the following command. */);
Vthis_command = Qnil;
+ DEFVAR_LISP ("real-this-command", Vreal_this_command,
+ doc: /* This is like `this-command', except that commands should never modify it. */);
+ Vreal_this_command = Qnil;
+
DEFVAR_LISP ("this-command-keys-shift-translated",
Vthis_command_keys_shift_translated,
doc: /* Non-nil if the key sequence activating this command was shift-translated.
from before this macro started. */
Vthis_command = KVAR (current_kboard, Vlast_command);
/* C-x z after the macro should repeat the macro. */
- real_this_command = KVAR (current_kboard, Vlast_kbd_macro);
+ Vreal_this_command = KVAR (current_kboard, Vlast_kbd_macro);
if (! NILP (KVAR (current_kboard, defining_kbd_macro)))
error ("Can't execute anonymous macro while defining one");
Vexecuting_kbd_macro = XCAR (info);
tem = XCDR (info);
executing_kbd_macro_index = XINT (XCAR (tem));
- real_this_command = XCDR (tem);
+ Vreal_this_command = XCDR (tem);
Frun_hooks (1, &Qkbd_macro_termination_hook);
return Qnil;
}
tem = Fcons (Vexecuting_kbd_macro,
Fcons (make_number (executing_kbd_macro_index),
- real_this_command));
+ Vreal_this_command));
record_unwind_protect (pop_kbd_macro, tem);
GCPRO2 (final, loopfunc);
executing_kbd_macro = Qnil;
- real_this_command = Vexecuting_kbd_macro;
+ Vreal_this_command = Vexecuting_kbd_macro;
UNGCPRO;
return unbind_to (pdlcount, Qnil);