[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108461: * lisp/simple.el (execute-ex
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108461: * lisp/simple.el (execute-extended-command): Set real-this-command. |
Date: |
Sat, 02 Jun 2012 15:21:34 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108461
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11506
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2012-06-02 15:21:34 -0400
message:
* 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.
modified:
lisp/ChangeLog
lisp/simple.el
src/ChangeLog
src/callint.c
src/keyboard.c
src/macros.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-06-02 12:29:21 +0000
+++ b/lisp/ChangeLog 2012-06-02 19:21:34 +0000
@@ -1,3 +1,8 @@
+2012-06-02 Stefan Monnier <address@hidden>
+
+ * simple.el (execute-extended-command): Set real-this-command
+ (bug#11506).
+
2012-06-02 Chong Yidong <address@hidden>
Remove incorrect uses of "modeline" in comments, docstrings, and
=== modified file 'lisp/simple.el'
--- a/lisp/simple.el 2012-06-01 13:44:48 +0000
+++ b/lisp/simple.el 2012-06-02 19:21:34 +0000
@@ -1378,13 +1378,17 @@
(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.
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-06-02 17:03:49 +0000
+++ b/src/ChangeLog 2012-06-02 19:21:34 +0000
@@ -1,3 +1,9 @@
+2012-06-02 Stefan Monnier <address@hidden>
+
+ * 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 <address@hidden>
* minibuf.c (Fassoc_string): Remove duplicate declaration.
=== modified file 'src/callint.c'
--- a/src/callint.c 2012-04-09 22:54:59 +0000
+++ b/src/callint.c 2012-06-02 19:21:34 +0000
@@ -284,7 +284,7 @@
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 @@
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 @@
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 @@
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 @@
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;
{
=== modified file 'src/keyboard.c'
--- a/src/keyboard.c 2012-06-01 03:41:03 +0000
+++ b/src/keyboard.c 2012-06-02 19:21:34 +0000
@@ -217,9 +217,6 @@
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 @@
/* 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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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.
=== modified file 'src/macros.c'
--- a/src/macros.c 2012-02-10 18:58:48 +0000
+++ b/src/macros.c 2012-06-02 19:21:34 +0000
@@ -259,7 +259,7 @@
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 @@
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 @@
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 @@
executing_kbd_macro = Qnil;
- real_this_command = Vexecuting_kbd_macro;
+ Vreal_this_command = Vexecuting_kbd_macro;
UNGCPRO;
return unbind_to (pdlcount, Qnil);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108461: * lisp/simple.el (execute-extended-command): Set real-this-command.,
Stefan Monnier <=