mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* lisp/simple.el (execute-extended-command): Set real-this-command.
* 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
This commit is contained in:
parent
7bd5c1f4a4
commit
f2d6a3df6a
6 changed files with 47 additions and 29 deletions
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1378,13 +1378,17 @@ give to the command you invoke, if it asks for an argument."
|
|||
(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.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ invoke it. If KEYS is omitted or nil, the return value of
|
|||
|
||||
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))
|
||||
|
|
@ -295,7 +295,7 @@ invoke it. If KEYS is omitted or nil, the return value of
|
|||
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))
|
||||
|
|
@ -310,7 +310,8 @@ invoke it. If KEYS is omitted or nil, the return value of
|
|||
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. */
|
||||
|
|
@ -370,14 +371,14 @@ invoke it. If KEYS is omitted or nil, the return value of
|
|||
|
||||
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++)
|
||||
|
|
@ -841,7 +842,7 @@ invoke it. If KEYS is omitted or nil, the return value of
|
|||
|
||||
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;
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -217,9 +217,6 @@ uintmax_t num_input_events;
|
|||
|
||||
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;
|
||||
|
||||
|
|
@ -1376,9 +1373,9 @@ command_loop_1 (void)
|
|||
|
||||
/* 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)
|
||||
{
|
||||
|
|
@ -1445,7 +1442,7 @@ command_loop_1 (void)
|
|||
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;
|
||||
|
||||
|
|
@ -1529,7 +1526,7 @@ command_loop_1 (void)
|
|||
/* Execute the command. */
|
||||
|
||||
Vthis_command = cmd;
|
||||
real_this_command = cmd;
|
||||
Vreal_this_command = cmd;
|
||||
safe_run_hooks (Qpre_command_hook);
|
||||
|
||||
already_adjusted = 0;
|
||||
|
|
@ -1613,12 +1610,14 @@ command_loop_1 (void)
|
|||
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;
|
||||
|
|
@ -11472,9 +11471,6 @@ syms_of_keyboard (void)
|
|||
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");
|
||||
|
|
@ -11728,12 +11724,14 @@ was a kill 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.
|
||||
|
|
@ -11741,6 +11739,10 @@ The command can set this variable; whatever is put here
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
|
|||
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");
|
||||
|
|
@ -286,7 +286,7 @@ pop_kbd_macro (Lisp_Object info)
|
|||
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;
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
|
|||
|
||||
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);
|
||||
|
|
@ -352,7 +352,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
|
|||
|
||||
executing_kbd_macro = Qnil;
|
||||
|
||||
real_this_command = Vexecuting_kbd_macro;
|
||||
Vreal_this_command = Vexecuting_kbd_macro;
|
||||
|
||||
UNGCPRO;
|
||||
return unbind_to (pdlcount, Qnil);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue