summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/simple.el12
2 files changed, 13 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b973d09fc43..e39b8a64205 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
diff --git a/lisp/simple.el b/lisp/simple.el
index 561d3656eb7..655298e4fea 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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.