X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fcmdloop.el;h=a9ae8b2b59c186e52b2d70eb6d3397280c23b859;hb=db2eae9655a3e3f4d653d885535815da78d98fe8;hp=e5b4be0f8fbf4b89b61f6bd4ebec14503a21373c;hpb=77dcef404dc78635f6ffa8f71a803d2bc7cc8921;p=chise%2Fxemacs-chise.git- diff --git a/lisp/cmdloop.el b/lisp/cmdloop.el index e5b4be0..a9ae8b2 100644 --- a/lisp/cmdloop.el +++ b/lisp/cmdloop.el @@ -319,23 +319,36 @@ when called from Lisp." (if (and teach-extended-commands-p (interactive-p)) - ;; We need to fiddle with keys: remember the keys, run the - ;; command, and show the keys (if any). + ;; Remember the keys, run the command, and show the keys (if + ;; any). The funny variable names are a poor man's guarantee + ;; that we don't get tripped by this-command doing something + ;; funny. Quoth our forefathers: "We want lexical scope!" (let ((_execute_command_keys_ (where-is-internal this-command)) (_execute_command_name_ this-command)) ; the name can change (command-execute this-command t) - (when (and _execute_command_keys_ - ;; Wait for a while, so the user can see a message - ;; printed, if any. - (sit-for 1)) - (display-message - 'no-log - (format "Command `%s' is bound to key%s: %s" - _execute_command_name_ - (if (cdr _execute_command_keys_) "s" "") - (sorted-key-descriptions _execute_command_keys_))) - (sit-for teach-extended-commands-timeout) - (clear-message 'no-log))) + (when _execute_command_keys_ + ;; Normally the region is adjusted in post_command_hook; + ;; however, it is not called until after we finish. It + ;; looks ugly for the region to get updated after the + ;; delays, so we do it now. The code below is a Lispified + ;; copy of code in event-stream.c:post_command_hook(). + (if (and (not zmacs-region-stays) + (or (not (eq (selected-window) (minibuffer-window))) + (eq (zmacs-region-buffer) (current-buffer)))) + (zmacs-deactivate-region) + (zmacs-update-region)) + ;; Wait for a while, so the user can see a message printed, + ;; if any. + (when (sit-for 1) + (display-message + 'no-log + (format (if (cdr _execute_command_keys_) + "Command `%s' is bound to keys: %s" + "Command `%s' is bound to key: %s") + _execute_command_name_ + (sorted-key-descriptions _execute_command_keys_))) + (sit-for teach-extended-commands-timeout) + (clear-message 'no-log)))) ;; Else, just run the command. (command-execute this-command t)))