summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/callint.c13
-rw-r--r--src/keyboard.c32
-rw-r--r--src/macros.c8
4 files changed, 34 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e5fddec94a4..ed808a39742 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/callint.c b/src/callint.c
index 506698a4e4e..bfa981ec65a 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -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;
{
diff --git a/src/keyboard.c b/src/keyboard.c
index 2642ad7734b..093e33ec67c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -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.
diff --git a/src/macros.c b/src/macros.c
index 3f4f8624479..0db7e63d622 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -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);